summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* [MTD] [NAND] Don't panic if a controller driver does ecc its own way.Scott Wood2008-01-081-2/+6
| | | | | | | | | | | | | Some hardware, such as the enhanced local bus controller used on some mpc83xx chips, does ecc transparently when reading and writing data, rather than providing a generic calculate/correct mechanism that can be exported to the nand subsystem. The subsystem should not BUG() when calculate, correct, or hwctl are missing, if the methods that call them have been overridden. Signed-off-by: Scott Wood <scottwood@freescale.com> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
* [JFFS2] Add missing call to posix_acl_releaseJulia Lawall2008-01-081-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | posix_acl_clone does a memory allocation and sets a reference count, so posix_acl_release is needed afterwards to free it. The problem was fixed using the following semantic patch. (http://www.emn.fr/x-info/coccinelle/) // <smpl> @@ type T; identifier E; expression E1, E2; int ret; statement S; @@ T E; <+... ( E = \(posix_acl_clone\|posix_acl_alloc\|posix_acl_dup\)(...); if (E == NULL) S | if ((E = \(posix_acl_clone\|posix_acl_alloc\|posix_acl_dup\)(...)) == NULL) S ) ... when != E2 = E when strict ( posix_acl_release(E); | E1 = E; | + posix_acl_release(E); return; | + posix_acl_release(E); return ret; ) ...+> // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Acked-by: KaiGai Kohei <kaigai@ak.jp.nec.com> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
* [MTD] [MAPS] Remove Photron PNC-2000 map driverDavid Woodhouse2008-01-083-101/+0Star
| | | | | | | It should be done as a physmap device, and people keep turning it on and whining about it. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
* [MTD] mtdchar.c: ioctl always returns 0 as size written for ppc64David Scidmore2008-01-081-2/+6
| | | | | | | | | | | | "include/linux/mtd/mtd.h" declares "mtd_oob_ops.retlen" as size_t, which is 64 bits on targets with a 64 bit addressing. The MEMWRITEOOB ioctl calls copy_to_user() to write it back to "mtd_oob_buf.length", which is declared in "include/linux/mtd-abi.h" as uint32_t. Since powerpc is a big endian architecture, this only copies the upper 32 bits of the address, which is always 0. Signed-off-by: David Scidmore <dscidmore@xes-inc.com> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
* UBI: bugfix: do not forget to increment vol_countArtem Bityutskiy2007-12-262-1/+2
| | | | | | | | | | When creating a new volume, do not forget to increment the vol_count variable. Also, users are not interested in internal volumes, so do not show them in the volumes_count sysfs file. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* UBI: do not support kiBArtem Bityutskiy2007-12-261-3/+1Star
| | | | | | Be strict and accept only KiB, MiB and GiB, not Kib, not kib, etc. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* UBI: add mtd_num sysfs attributeArtem Bityutskiy2007-12-261-1/+9
| | | | | | Expose number or the underlying MTD device in sysfs. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* UBI: fix mtd device string parsingArtem Bityutskiy2007-12-261-24/+12Star
| | | | | | | | | | | | UBI allows to specify MTD device name or number when the module is being loaded. When parsing MTD device identity string, it first tries to treat it as device NAME, and if that fails, it treats it as device number. Make it vice-versa as this is more logical and makes less troubles when you have an MTD device named "1" and try to load mtd1 which has different name. This is especially easy to hit when gluebi is enabled. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* UBI: use separate mutex for volumes checkingArtem Bityutskiy2007-12-263-8/+5Star
| | | | | | | | | Introduce a separate mutex which serializes volumes checking, because we cammot really use volumes_mutex - it cases reverse locking problems with mtd_tbl_mutex when gluebi is used - thanks to lockdep. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* UBI: handle attach ioctlArtem Bityutskiy2007-12-263-42/+135
| | | | | | Actually implement the MTD device attach/detach handlers. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* UBI: introduce attach ioctlsArtem Bityutskiy2007-12-261-8/+72
| | | | Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* UBI: remove data_offsetArtem Bityutskiy2007-12-262-29/+16Star
| | | | | | | 'data_offset' parameter does not really make sense and it is not needed. Get rid of it. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* UBI: prepare attach and detach functionsArtem Bityutskiy2007-12-263-87/+169
| | | | | | | | | | Prepare the attach and detach functions to by used outside of module initialization: * detach function checks reference count before detaching * it kills the background thread as well Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* UBI: add UBI devices reference countingArtem Bityutskiy2007-12-267-63/+201
| | | | | | | | | | This is one more step on the way to "removable" UBI devices. It adds reference counting for UBI devices. Every time a volume on this device is opened - the device's refcount is increased. It is also increased if someone is reading any sysfs file of this UBI device or of one of its volumes. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* UBI: add UBI control deviceArtem Bityutskiy2007-12-263-11/+54
| | | | | | | | | | | | | | | | | This patch is a preparation to make UBI devices dynamic. It adds an UBI control device which has dynamically allocated major number and registers itself as "ubi_ctrl". It does not do anything so far. The idea is that this device will allow to attach/detach MTD devices from userspace. This is symilar to what the Linux device mapper has. The next things to do are: * Fix UBI, because it now assumes UBI devices cannot go away * Implement control device ioctls which will attach/detach MTD devices Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* UBI: fix commentArtem Bityutskiy2007-12-262-9/+5Star
| | | | Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* UBI: fix ubi_wl_flushArtem Bityutskiy2007-12-262-7/+33
| | | | | | | | | | | The flush function should finish all the pending jobs. But if somebody else is doing a work, this function should wait and let it finish. This patche uses rw semaphore for synchronization purpose - it just looks quite convinient. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* UBI: fix printkArtem Bityutskiy2007-12-261-9/+13
| | | | | | Add proper log level to printk's. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* UBI: bugfix: protect from volume removalArtem Bityutskiy2007-12-263-135/+239
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the WL worker is moving an LEB, the volume might go away occasionally. UBI does not handle these situations correctly. This patch introduces a new mutex which serializes wear-levelling worker and the the 'ubi_wl_put_peb()' function. Now, if one puts an LEB, and its PEB is being moved, it will wait on the mutex. And because we unmap all LEBs when removing volumes, this will make the volume remove function to wait while the LEB movement finishes. Below is an example of an oops which should be fixed by this patch: Pid: 9167, comm: io_paral Not tainted (2.6.24-rc5-ubi-2.6.git #2) EIP: 0060:[<f884a379>] EFLAGS: 00010246 CPU: 0 EIP is at prot_tree_del+0x2a/0x63 [ubi] EAX: f39a90e0 EBX: 00000000 ECX: 00000000 EDX: 00000134 ESI: f39a90e0 EDI: f39a90e0 EBP: f2d55ddc ESP: f2d55dd4 DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068 Process io_paral (pid: 9167, ti=f2d54000 task=f72a8030 task.ti=f2d54000) Stack: f39a95f8 ef6aae50 f2d55e08 f884a511 f88538e1 f884ecea 00000134 00000000 f39a9604 f39a95f0 efea8280 00000000 f39a90e0 f2d55e40 f8847261 f8850c3c f884eaad 00000001 000000b9 00000134 00000172 000000b9 00000134 00000001 Call Trace: [<c0105227>] show_trace_log_lvl+0x1a/0x30 [<c01052e2>] show_stack_log_lvl+0xa5/0xca [<c01053d6>] show_registers+0xcf/0x21b [<c0105648>] die+0x126/0x224 [<c0119a62>] do_page_fault+0x27f/0x60d [<c037dd62>] error_code+0x72/0x78 [<f884a511>] ubi_wl_put_peb+0xf0/0x191 [ubi] [<f8847261>] ubi_eba_unmap_leb+0xaf/0xcc [ubi] [<f8843c21>] ubi_remove_volume+0x102/0x1e8 [ubi] [<f8846077>] ubi_cdev_ioctl+0x22a/0x383 [ubi] [<c017d768>] do_ioctl+0x68/0x71 [<c017d7c6>] vfs_ioctl+0x55/0x271 [<c017da15>] sys_ioctl+0x33/0x52 [<c0104152>] sysenter_past_esp+0x5f/0xa5 ======================= Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* UBI: improve commentArtem Bityutskiy2007-12-261-3/+6
| | | | | | Explain better the purpose of thie 'move_to_put' stuff. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* UBI: add PID to debugging printsArtem Bityutskiy2007-12-261-14/+7Star
| | | | | | Also, use single dbg_msg() macro for all prints. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* UBI: tweak volumes locking some moreArtem Bityutskiy2007-12-262-16/+17
| | | | | | | Make the code more consistent by requiring the caller to lock the ubi->volume_mutex, because this is what we do for updates. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* UBI: introduce volume refcountingArtem Bityutskiy2007-12-265-42/+84
| | | | | | | | Add ref_count field to UBI volumes and remove weired "vol->removed" field. This way things are better understandable and we do not have to do whold show_attr operation under spinlock. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* UBI: simplify error handlingArtem Bityutskiy2007-12-261-40/+12Star
| | | | | | | | | If we fail halfway through sysfs file creation, we may just call sysfs remove function and it will delete all the files we created. For non-existing files it will also be OK - the remove functions just return -ENOENT. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* UBI: fix and cleanup volume opening functionsArtem Bityutskiy2007-12-261-36/+25Star
| | | | | | | | This patch fixes error codes of the functions - if the device number is out of range, -EINVAL should be returned. It also removes unneeded try_module_get call from the open by name function. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* UBI: fix error pathArtem Bityutskiy2007-12-261-25/+20Star
| | | | | | | | Error path in volume creation is bogus. First of, it ovverrides the 'err' variable and returns zero to the caller. Second, ubi_assert() in the release function is wrong. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* UBI: get device when opening volumeArtem Bityutskiy2007-12-263-8/+8
| | | | | | | | When a volume is opened, get its kref via get_device() call. And put the reference when closing the volume. With this, we may have a bit saner volume delete. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* UBI: add some more commentsArtem Bityutskiy2007-12-261-1/+7
| | | | Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* UBI: tweak volumes lockingArtem Bityutskiy2007-12-266-23/+34
| | | | | | | Transform vtbl_mutex to volumes_mutex - this just makes code easier to understand. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* UBI: improve internal interfacesArtem Bityutskiy2007-12-2610-72/+68Star
| | | | | | | | Pass volume description object to the EBA function which makes more sense, and EBA function do not have to find the volume description object by volume ID. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* UBI: bugfix: dont oops with NULL module parameterArtem Bityutskiy2007-12-261-0/+3
| | | | | | E.g., it oopsed in case of: modprobe ubi mtd = 0 Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* UBI: remove ubi_devices_cntArtem Bityutskiy2007-12-263-21/+27
| | | | | | This global variablea is not really needed, remove it Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* UBI: create ubi_wl_entry slab on initializationArtem Bityutskiy2007-12-263-44/+44
| | | | | | | Similarly to ltree_entry_slab, it makes more sense to create and destroy ubi_wl_entry slab on module initialization/exit. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* UBI: create ltree_entry slab on initializationArtem Bityutskiy2007-12-263-67/+67
| | | | | | | | Since the ltree_entry slab cache is a global entity, which is used by all UBI devices, it is more logical to create it on module initialization time and destro on module exit time. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* UBI: improve error messagesArtem Bityutskiy2007-12-263-8/+19
| | | | | | | Always print error code with error messages, sometimes it is extremely helpful info. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* UBI: remove redundant fieldArtem Bityutskiy2007-12-265-16/+16
| | | | | | | Remove redundant ubi->major field - we have it in ubi->cdev.dev already. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* UBI: minor tidy-upsArtem Bityutskiy2007-12-261-3/+4
| | | | Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* UBI: silence a warningJesper Juhl2007-12-261-2/+3
| | | | | | | | | | | | | | | | | This patch silences the following warning : drivers/mtd/ubi/vmt.c:73: warning: 'ret' may be used uninitialized in this function gcc can't see that we always initialize ret in all situations where it is actually used. The one case where it's not initialized is when we BUG(), but gcc doesn't know that we won't then continue and use an uninitialized 'ret'. This patch results in code that does exactely the same as before, but it also makes gcc shut up, so we generate one less line of warning noise. Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* UBI: add ubi_leb_map interfaceArtem Bityutskiy2007-12-263-5/+54
| | | | | | | | | | | | | | The idea of this interface belongs to Adrian Hunter. The interface is extremely useful when one has to have a guarantee that an LEB will contain all 0xFFs even in case of an unclean reboot. UBI does have an 'ubi_leb_erase()' call which may do this, but it is stupid and ineffecient, because it flushes whole queue. I should be re-worked to just be a pair of unmap, map calls. The user of the interfaci is UBIFS at the moment. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* UBI: bugfix: allocate mandatory EBs firstArtem Bityutskiy2007-12-261-9/+9
| | | | | | | | | First allocate the necessary eraseblocks, then the optional ones. Otherwise it allocates all PEBs for bad EB handling, and fails on then following EBA LEB allocation. Reported-by: Adrian Hunter <ext-adrian.hunter@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* UBI: fix error code in ubi_io_read()Artem Bityutskiy2007-12-261-0/+10
| | | | | | | | | | | | | | | | | | | | When NAND detects an ECC error, it returns -EBADMSG. It does not stop reading requested data if one page has an ECC error, it keeps going and reads all the requested data. If it fails to read all the data, it does not return -EBADMSG, but returns the error code which reflects the reason of the failure. But some drivers may have bugs (e.g., OneNAND had) and stop reading after the first ECC error, so it returns -EBADMSG. In turn, UBI propagates this up to the caller. The caller will treat this as "all the requested data was read, but there was an ECC error". So we change the error code to -EIO if it is -EBADMSG and the read length is less then the requested length. We also add an assertion, so if UBI debugging is enabled, UBI will bug. Pointed-to-by: Adrian Hunter <ext-adrian.hunter@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* [MTD] mtdoops cleanupPeter Korsgaard2007-12-031-5/+2Star
| | | | | | | Use memcpy instead of open coding a copy loop. Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
* [MTD] mtdoops: Document usage in KconfigPeter Korsgaard2007-12-031-0/+3
| | | | | | | Add usage instructions to Kconfig for mtdoops driver. Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
* [MTD] [NAND] Marvell Orion device bus NAND controllerTzachi Perelstein2007-12-033-0/+181
| | | | | | | | | | Driver for the device bus NAND controller in the Marvell Orion family of ARM SoCs. Signed-off-by: Tzachi Perelstein <tzachi@marvell.com> Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Acked-by: Jörn Engel <joern@logfs.org> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
* [MTD] [NOR] Attempt to clean up the JEDEC unlock address confusionDavid Woodhouse2007-12-031-61/+24Star
| | | | | | | | | Use a single unlock address, adjust it for the device type in the knowledge that it'll be adjusted back again. This has the desirable effect of masking out the least significant bit of the address for x16 devices. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
* [MTD] [NOR] Fix overflow check in jedec_probeDavid Woodhouse2007-12-031-1/+1
| | | | | | | | | Having laid the code out so that it's easier to read instead of sticking to the 80-column guideline even when it doesn't make sense, a bug is immediately spotted... we were only checking _one_ of the unlock addresses to see if it runs off the end of the map. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
* [MTD] [NOR] Clean up jedec_probe, remove unlock address arraysDavid Woodhouse2007-12-031-777/+624Star
| | | | | | | | This should have no functional effects -- we've been ignoring all but the first address in the array for a long time, and using it only to indicate which device types are supported. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
* [MTD] Always initialise mutex in new mtd_blktrans_dev.David Woodhouse2007-12-031-1/+1
| | | | | | | | | | | | We were only initialising the mutex in the case where the new device was automatically allocated the highest minor number. If the caller specified a minor number, or if it filled in a free slot which was made by a previous device deregistering, the mutex wouldn't get initialised when we jumped out of the loop. Reported by Monte Copeland <catboat@texas.net> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
* [MTD] [NAND] pasemi_nand driverEgor Martovetsky2007-11-293-0/+250
| | | | | | | | | Plumbing for NAND connected via localbus on PA Semi PWRficient-based boards. From: Egor Martovetsky <egor@pasemi.com> Signed-off-by: Olof Johansson <olof@lixom.net> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
* [MTD] [NAND] S3C2410 correctly set nFCE over resumeBen Dooks2007-11-281-0/+20
| | | | | | | | | | | | Ensure the nFCE line is de-asserted over suspend and then re-initialised when the system resumes. This is to ensure that the NAND is kept in lowest power mode over suspend (power settings are only specified for nFCE inactive) as well as fixing the Simtec Osiris which relies on nFCE being inactive. Signed-off-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: David Woodhouse <dwmw2@infradead.org>