aboutsummaryrefslogtreecommitdiffstats
path: root/include/mtd/ubi-user.h (unfollow)
AgeCommit message (Collapse)AuthorFilesLines
2008-02-03[MTD] [NAND] at91_nand: Make mtdparts option can override board infoAtsushi Nemoto1-6/+6
Call parse_mtd_partitions before checking board's partition_info, so that "mtdparts=" option can override board's default setting. Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-02-03[MTD] mtdoops: Various minor cleanupsRichard Purdie1-7/+9
Various minor cleaups to mtdoops: * Don't support the mtd->erasesize < OOPS_PAGE_SIZE case * Tweak printks and make the device mtdoops connects to more visible * CON_PRINTBUFFER flag is uneeded Signed-off-by: Richard Purdie <rpurdie@rpsys.net> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-02-03[MTD] mtdoops: Ensure sequential write to the bufferRichard Purdie1-0/+28
Add a spinlock to ensure writes to the mtdoops buffer memory are sequential and don't race. Signed-off-by: Richard Purdie <rpurdie@rpsys.net> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-02-03[MTD] mtdoops: Perform write operations in a workqueueRichard Purdie1-40/+42
Writing to the flash needs to be done in a workqueue. The console write functions may be called in any context which can lead to lockups otherwise. Signed-off-by: Richard Purdie <rpurdie@rpsys.net> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-02-03[MTD] mtdoops: Add further error return code checkingRichard Purdie1-12/+29
Add further error return code checks to the mtdoops driver. Signed-off-by: Richard Purdie <rpurdie@rpsys.net> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-02-03[MTD] [NOR] Test devtype, not definition in flash_probe(), drivers/mtd/devices/lart.cRoel Kluin1-1/+1
drivers/mtd/devices/lart.c:119:#define FLASH_DEVICE_16mbit_BOTTOM 0x88f488f4 As was, unless "manufacturer != FLASH_MANUFACTURER" this returned true Signed-off-by: Roel Kluin <12o3l@tiscali.nl> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-02-03[UBI] drivers/mtd/ubi/scan.c: fix uninitialized var warningakpm@linux-foundation.org1-1/+1
drivers/mtd/ubi/scan.c: In function 'ubi_scan': drivers/mtd/ubi/scan.c:772: warning: 'ec' may be used uninitialized in this function Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-02-03[UBI] drivers/mtd/ubi/wl.c: fix uninitialized var warningakpm@linux-foundation.org1-1/+1
drivers/mtd/ubi/wl.c:746: warning: 'pe' may be used uninitialized in this function Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-02-03[UBI] drivers/mtd/ubi/cdev.c: unused varakpm@linux-foundation.org1-1/+1
Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-02-03[MTD] Factor out OF partition support from the NOR driver.Scott Wood5-63/+118
Signed-off-by: Scott Wood <scottwood@freescale.com> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-02-03[MTD] jedec probe: drop unnecessary forward declarationsIlpo Järvinen1-8/+0
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-02-03[MTD] JEDEC probe: kill some inline bloatIlpo Järvinen1-2/+1
$ codiff $OBJ.old $OBJ drivers/mtd/chips/jedec_probe.c: cfi_jedec_setup | -320 jedec_probe_chip | -7073 2 functions changed, 7393 bytes removed, diff: -7393 drivers/mtd/chips/jedec_probe.c: jedec_reset | +1151 1 function changed, 1151 bytes added, diff: +1151 drivers/mtd/chips/jedec_probe.o: 3 functions changed, 1151 bytes added, 7393 bytes removed, diff: -6242 Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-01-26[MTD] [NAND] fix s3c2410 error correctionMatt Reimer1-14/+12
The single-bit error correction was, well, incorrect. For determing which bit to correct it was using P1' P2' P4' P8' instead of P1 P2 P4 P8, and it was using P16' P32' P64' P128' P256' P512' P1024' P2048' instead of P16 P32 P64 P128 P256 P512 P1024 P2048. Signed-off-by: Matt Reimer <mreimer@vpop.net> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-01-12[MTD] [NAND] make s3c2410 indicate an error for multi-bit read errorsMatt Reimer1-1/+1
If there were multiple bit errors in the data s3c2410_nand_correct_data() was returning 0 (no error) instead of -1, so the upper layers (like JFFS2) would not know the data is corrupt. Signed-off-by: Matt Reimer <mreimer@vpop.net> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-01-10[MTD] [NOR] Fix incorrect interface code for x16/x32 chipsBartlomiej Sieka4-9/+23
According to "Common Flash Memory Interface Publication 100" dated December 1, 2001, the interface code for x16/x32 chips is 0x0005, and not 0x0004 used so far. Signed-off-by: Bartlomiej Sieka <tur@semihalf.com> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-01-08[MTD] [NAND] Don't panic if a controller driver does ecc its own way.Scott Wood1-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>
2008-01-08[JFFS2] Add missing call to posix_acl_releaseJulia Lawall1-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>
2008-01-08[MTD] [MAPS] Remove Photron PNC-2000 map driverDavid Woodhouse3-101/+0
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>
2008-01-08[MTD] mtdchar.c: ioctl always returns 0 as size written for ppc64David Scidmore1-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>
2007-12-26UBI: bugfix: do not forget to increment vol_countArtem Bityutskiy2-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>
2007-12-26UBI: do not support kiBArtem Bityutskiy1-3/+1
Be strict and accept only KiB, MiB and GiB, not Kib, not kib, etc. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-12-26UBI: add mtd_num sysfs attributeArtem Bityutskiy1-1/+9
Expose number or the underlying MTD device in sysfs. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-12-26UBI: fix mtd device string parsingArtem Bityutskiy1-24/+12
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>
2007-12-26UBI: use separate mutex for volumes checkingArtem Bityutskiy3-8/+5
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>
2007-12-26UBI: handle attach ioctlArtem Bityutskiy3-42/+135
Actually implement the MTD device attach/detach handlers. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-12-26UBI: introduce attach ioctlsArtem Bityutskiy1-8/+72
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-12-26UBI: remove data_offsetArtem Bityutskiy2-29/+16
'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>
2007-12-26UBI: prepare attach and detach functionsArtem Bityutskiy3-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>
2007-12-26UBI: add UBI devices reference countingArtem Bityutskiy7-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>
2007-12-26UBI: add UBI control deviceArtem Bityutskiy3-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>
2007-12-26UBI: fix commentArtem Bityutskiy2-9/+5
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-12-26UBI: fix ubi_wl_flushArtem Bityutskiy2-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>
2007-12-26UBI: fix printkArtem Bityutskiy1-9/+13
Add proper log level to printk's. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-12-26UBI: bugfix: protect from volume removalArtem Bityutskiy3-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>
2007-12-26UBI: improve commentArtem Bityutskiy1-3/+6
Explain better the purpose of thie 'move_to_put' stuff. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-12-26UBI: add PID to debugging printsArtem Bityutskiy1-14/+7
Also, use single dbg_msg() macro for all prints. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-12-26UBI: tweak volumes locking some moreArtem Bityutskiy2-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>
2007-12-26UBI: introduce volume refcountingArtem Bityutskiy5-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>
2007-12-26UBI: simplify error handlingArtem Bityutskiy1-40/+12
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>
2007-12-26UBI: fix and cleanup volume opening functionsArtem Bityutskiy1-36/+25
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>
2007-12-26UBI: fix error pathArtem Bityutskiy1-25/+20
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>
2007-12-26UBI: get device when opening volumeArtem Bityutskiy3-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>
2007-12-26UBI: add some more commentsArtem Bityutskiy1-1/+7
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-12-26UBI: tweak volumes lockingArtem Bityutskiy6-23/+34
Transform vtbl_mutex to volumes_mutex - this just makes code easier to understand. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-12-26UBI: improve internal interfacesArtem Bityutskiy10-72/+68
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>
2007-12-26UBI: bugfix: dont oops with NULL module parameterArtem Bityutskiy1-0/+3
E.g., it oopsed in case of: modprobe ubi mtd = 0 Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-12-26UBI: remove ubi_devices_cntArtem Bityutskiy3-21/+27
This global variablea is not really needed, remove it Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-12-26UBI: create ubi_wl_entry slab on initializationArtem Bityutskiy3-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>
2007-12-26UBI: create ltree_entry slab on initializationArtem Bityutskiy3-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>
2007-12-26UBI: improve error messagesArtem Bityutskiy3-8/+19
Always print error code with error messages, sometimes it is extremely helpful info. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>