aboutsummaryrefslogtreecommitdiff
path: root/drivers/mtd
AgeCommit message (Collapse)Author
2007-09-20[POWERPC] Cleanups for physmap_of.c (v2)David Gibson
This patch includes a whole batch of smallish cleanups for drivers/mtd/physmap_of.c. - A bunch of uneeded #includes are removed - We switch to the modern linux/of.h etc. in place of asm/prom.h - Use some helper macros to avoid some ugly inline #ifdefs - A few lines of unreachable code are removed - A number of indentation / line-wrapping fixes - More consistent use of kernel idioms such as if (!p) instead of if (p == NULL) - Clarify some printk()s and other informative strings. - parse_obsolete_partitions() now returns 0 if no partition information is found, instead of returning -ENOENT which the caller had to handle specially. - (the big one) Despite the name, this driver really has nothing to do with drivers/mtd/physmap.c. The fact that the flash chips must be physically direct mapped is a constrant, but doesn't really say anything about the actual purpose of this driver, which is to instantiate MTD devices based on information from the device tree. Therefore the physmap name is replaced everywhere within the file with "of_flash". The file itself and the Kconfig option is not renamed for now (so that the diff is actually a diff). That can come later. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
2007-09-19[POWERPC] Make partitions optional in physmap_ofJosh Boyer
The latest physmap_of driver has a small error where it will fail the probe with: physmap-flash: probe of fff00000.small-flas failed with error -2 if there are no partition subnodes in the device tree and the old style binding is not used. Since partition definitions are optional, the probe should still succeed. Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com> Acked-by: David Gibson <david@gibson.dropbear.id.au>
2007-09-20Merge branch 'linux-2.6'Paul Mackerras
2007-09-19pci: fix unterminated pci_device_id listsKees Cook
Fix a couple drivers that do not correctly terminate their pci_device_id lists. This results in garbage being spewed into modules.pcimap when the module happens to not have 28 NULL bytes following the table, and/or the last PCI ID is actually truncated from the table when calculating the modules.alias PCI aliases, cause those unfortunate device IDs to not auto-load. Signed-off-by: Kees Cook <kees@ubuntu.com> Acked-by: Corey Minyard <minyard@acm.org> Cc: David Woodhouse <dwmw2@infradead.org> Acked-by: Jeff Garzik <jeff@garzik.org> Cc: Greg KH <greg@kroah.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-09-14[POWERPC] Document and implement an improved flash device binding for powerpcDavid Gibson
This replaces the binding for flash chips in booting-without-of.txt with an clarified and improved version. It also makes drivers/mtd/maps/physmap_of.c recognize this new binding. Finally it revises the Ebony device tree source to use the new binding as an example. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Acked-by: Segher Boessenkool <segher@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-09-14Merge branch 'linux-2.6' into for-2.6.24Paul Mackerras
2007-09-02[MTD] Initialise s_flags in get_sb_mtd_aux()David Howells
Initialise s_flags in get_sb_mtd_aux() from the flags parameter. Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-08-23[ARM] 4554/1: replace consistent_sync() with flush_ioremap_region()Jared Hulbert
This fixes a regression from around 2.6.18, consistent_sync() will now BUG() under these circumstances. The use of consistent_sync() was a hack, replacing it's usage here with a new function, flush_ioremap_region(). Signed-off-by: Jared Hulbert <jaredeh@gmail.com> Acked-by: Pavel Pisa <pisa@cmp.felk.cvut.cz> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2007-08-17[POWERPC] Fixes to allow use of Ebony's flash chips through physmap_ofDavid Gibson
This patch contains a handful of small fixes to allow the Ebony's flash to be exposed as MTD devices via the physmap_of driver. Specifically it: - Makes a small addition to the device tree and zImage wrapper to record the correct address for the flash in the device tree based on the board switches as reported via an FPGA register. - Prohibits building the old hard-coded "Ebony" flash map on arch/powerpc kernels, in favour of using physmap_of's device tree based approach. - Enables MTD and physmap_of in the Ebony defconfig. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-08-11mtdchar build fixAndrew Morton
sh: drivers/mtd/mtdchar.c: In function `mtd_mmap': drivers/mtd/mtdchar.c:817: error: dereferencing pointer to incomplete type drivers/mtd/mtdchar.c:817: error: `VM_SHARED' undeclared (first use in this function) drivers/mtd/mtdchar.c:817: error: (Each undeclared identifier is reported only once Cc: David Woodhouse <dwmw2@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-08-03[MTD] Makefile fix for mtdsuperSatyam Sharma
We want drivers/mtd/{mtdcore, mtdsuper, mtdpart}.c to be built and linked into the same mtd.ko module. Fix the Makefile to ensure this, and remove duplicate MODULE_ declarations in mtdpart.c, as mtdcore.c already has them. Signed-off-by: Satyam Sharma <satyam@infradead.org> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-08-02[MTD] [NAND] nand_base.c: fix type of eccpos pointerBen Dooks
The nand_base.c driver implicitly casts the uint32_t eccpos array to 'int *', which is not only not guaranteed to be the same sign as the source, but is not guaranteed to be the same size. Fix by changing nand_base.c to use uint32_t referencing the eccpos fields. Signed-off-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-08-02[MTD] [NAND] at91_nand rdy_pin fixIvan Kuten
The patch below fixes nand driver for AT91 boards which do not have NAND R/B signal connected to gpio (rdy_pin is not connected). Signed-off-by: Ivan Kuten <ivan.kuten@promwad.com> Acked-by: Andrew Victor <andrew@sanpeople.com> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-08-02[MTD] [NAND] fix race in nand_base.cArtem Bityutskiy
When we mark block bad we have to get chip because this involves writing to the page's OOB. We hit this bug in UBI - we observed random obscure crashes when it marks block bad from the background thread and there is some parallel task which utilizes flash. This patch also adds a TODO note about BBT table protection which it seems does not exist. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-08-02[MTD] [NAND] Fix refactoring of EDB7312 hwcontrol function.Roland Stigge
The patch ensures that the current code (kernel 2.6.22) uses the bits like the code prior to the refactoring. The variable "bits" is employed in a useful way now. Signed-off-by: Roland Stigge <stigge@antcom.de> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-08-02[MTD] Fix potential leak in rfd_ftl_add_mtdFlorin Malita
This fixes a leak in the !mtd->erasesize error path (Coverity 1765). Signed-off-by: Florin Malita <fmalita@gmail.com> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-07-31[MIPS] Remove Momentum Ocelot support.Ralf Baechle
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2007-07-26sun userflash is PCI-dependentAl Viro
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-07-20mm: Remove slab destructors from kmem_cache_create().Paul Mundt
Slab destructors were no longer supported after Christoph's c59def9f222d44bb7e2f0a559f2906191a0862d7 change. They've been BUGs for both slab and slub, and slob never supported them either. This rips out support for the dtor pointer from kmem_cache_create() completely and fixes up every single callsite in the kernel (there were about 224, not including the slab allocator definitions themselves, or the documentation references). Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2007-07-18UBI: fix compile warningPaul Mundt
cdev.c whines in current git: drivers/mtd/ubi/cdev.c: In function `major_to_device': drivers/mtd/ubi/cdev.c:67: warning: control reaches end of non-void function Shut it up. Signed-off-by: Paul Mundt <lethal@linux-sh.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-07-18UBI: fix error handling in erase workerArtem Bityutskiy
Do not switch to read-only mode in case of -EINTR and some other obvious cases. Switch to RO mode only when we do not know what is the error. Reported-by: Vinit Agnihotri <vinit.agnihotri@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-07-18UBI: fix commentsArtem Bityutskiy
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-07-18UBI: remove unneeded error checksArtem Bityutskiy
Pointed to by viro. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-07-18UBI: cleanup usage of try_module_getFernando Luis Vázquez Cao
The use of try_module_get(THIS_MODULE) in ubi_get_device_info does not offer real protection against unexpected driver unloads, since we could be preempted before try_modules_get gets executed. It is the caller who should manipulate the refcounts. Besides, ubi_get_device_info is an exported symbol which guarantees protection when accessed through symbol_get. Signed-off-by: Fernando Luis Vazquez Cao <fernando@oss.ntt.co.jp> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-07-18UBI: fix overflow bugVinit Agnihotri
I was experiencing overflows in multiplications for volume->used_bytes in vmt.c & vtbl.c, while creating & resizing large volumes. vol->used_bytes is long long however its 2 operands vol->used_ebs & vol->usable_leb_size are int. So their multiplication for larger values causes integer overflows. Typecasting them solves the problem. My machine & flash details: 64Bit dual-core AMD opteron, 1 GB RAM, linux 2.6.18.3. mtd size = 6GB, volume size= 5GB, peb_size = 4MB. heres patch which does the fix. Signed-off-by: Vinit Agnihotri <vinit.agnihotri@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-07-18UBI: bugfix in max_sqnum calculationArtem Bityutskiy
Do not zero max_sqnum after a new volume has been found. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-07-18UBI: bugfix in sqnum calculationBrijesh Singh
Hi,I came across problem of having two leb with same sequence no.This happens when we continuously write one block again and again and reboot machine before background thread erases those blocks. The problem here was,when we find two blocks with same sequence no,we take the higher one,but we were not updating max seq no,so next block may have the same seqnum. This patch solves this problem. Signed-off-by: Brijesh Singh <brijesh.s.singh@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-07-18UBI: fix signed-unsigned multiplicationBrijesh Singh
There is signed multiplication assigned to unsigned ei.addr in io.c. This causes wrong addresses for big multiplication.This patch solves the problem. Signed-off-by: Brijesh Singh <brijesh.s.singh@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-07-18UBI: fix bug in atomic_leb_change()Artem Bityutskiy
atomic_leb_change() is only allowed for dynamic volumes, so set the volume type correctly. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-07-18UBI: fix messageVinit Agnihotri
Increase UBI devices couter after the message, not before. Signed-off-by: Vinit Agnihotri <vinit.agnihotri@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-07-18UBI: fix debugging stuffArtem Bityutskiy
Do not check volumes which are currently in use because thay may be in inconsistent state. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-07-18UBI: bugfix in error pathArtem Bityutskiy
When volume creation fails, we have to set ubi->volumes[vol_id] back to NULL. This patch also tweaks some debugging stuff. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-07-18UBI: use is_power_of_2()Vignesh Babu
Replacing (n & (n-1)) in the context of power of 2 checks with is_power_of_2 Signed-off-by: Vignesh Babu <vignesh.babu@wipro.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-07-18UBI: fix freeing ubi->vtbl while unloadingVinit Agnihotri
ubi->vtbl is allocated using vmalloc() in vtbl.c empty_create_lvol(), but it is freed in build.c with kfree() Signed-off-by: Vinit Agnihotri <vinit.agnihotri@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-07-18UBI: bugfix in ubi_leb_change()Artem Bityutskiy
Do not call 'ubi_wl_put_peb()' if the LEB was unmapped. Reported-by: Gabor Loki <loki@inf.u-szeged.hu> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-07-18UBI: kill homegrown endian macrosChristoph Hellwig
Kill UBI's homegrown endianess handling and replace it with the standard kernel endianess handling. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-07-18UBI: cleanup ioctl handlingChristoph Hellwig
- don't do access_ok + get/put user but use the proper macro - remove useless checks Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-07-18UBI: error path bugfixArtem Bityutskiy
No need to unlock the lock, this will be done at out_unlock. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-07-18UBI: minor comma fixArtem Bityutskiy
Use coma at the the last elements of structure initializer. Daniel Stone's explanation: Because it turns: - .attr = foo + .attr = foo, + .bar = baz into: + .bar = baz, i.e., far less likely to screw up a merge. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-07-18UBI: use vmalloc for large buffersArtem Bityutskiy
UBI allocates temporary buffers of PEB size, which may be 256KiB. Use vmalloc instead of kmalloc for such big temporary buffers. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-07-18UBI: add few more commentsArtem Bityutskiy
Add few comments above ubi_scan_add_used() to explain why it is so complex. Requested by Satyam Sharma <satyam.sharma@gmail.com>. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-07-18UBI: set correct gluebi device sizeArtem Bityutskiy
In case of static volumes, make emulated MTD device size to be equivalent to data size, rather then volume size. Reported-by: John Smith <john@arrows.demon.co.uk> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-07-18UBI: do not let to read too muchArtem Bityutskiy
In case of static volumes it is prohibited to read more data then available. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-07-18UBI: fix error path in create_vtbl()Artem Bityutskiy
There were several bugs in volume table creation error path. Thanks to Satyam Sharma <satyam.sharma@gmail.com> and Florin Malita <fmalita@gmail.com> for finding and analysing them: http://lkml.org/lkml/2007/5/3/274 This patch makes ubi_scan_add_to_list() static and renames it to add_to_list(), just because it is not needed outside scan.c anymore. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-07-18UBI: fix dereference after kfreeFlorin Malita
Coverity (CID 1614) spotted new_seb being dereferenced after kfree() in create_vtbl's write_error path. Signed-off-by: Florin Malita <fmalita@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-07-18UBI: fix memory leak in checking codeArtem Bityutskiy
Reported-by: Eric Sesterhenn / Snakebyte <snakebyte@gmx.de> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-07-17drivers/*: mark variables with uninitialized_var()Jeff Garzik
Mark variables in drivers/* with uninitialized_var() if such a warning appears, and analysis proves that the var is initialized properly on all paths it is used. Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-07-17drivers/mtd/ubi/eba: minor cleanup: tighten scope of a local varJeff Garzik
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-07-17Freezer: make kernel threads nonfreezable by defaultRafael J. Wysocki
Currently, the freezer treats all tasks as freezable, except for the kernel threads that explicitly set the PF_NOFREEZE flag for themselves. This approach is problematic, since it requires every kernel thread to either set PF_NOFREEZE explicitly, or call try_to_freeze(), even if it doesn't care for the freezing of tasks at all. It seems better to only require the kernel threads that want to or need to be frozen to use some freezer-related code and to remove any freezer-related code from the other (nonfreezable) kernel threads, which is done in this patch. The patch causes all kernel threads to be nonfreezable by default (ie. to have PF_NOFREEZE set by default) and introduces the set_freezable() function that should be called by the freezable kernel threads in order to unset PF_NOFREEZE. It also makes all of the currently freezable kernel threads call set_freezable(), so it shouldn't cause any (intentional) change of behaviour to appear. Additionally, it updates documentation to describe the freezing of tasks more accurately. [akpm@linux-foundation.org: build fixes] Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: Nigel Cunningham <nigel@nigel.suspend2.net> Cc: Pavel Machek <pavel@ucw.cz> Cc: Oleg Nesterov <oleg@tv-sign.ru> Cc: Gautham R Shenoy <ego@in.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-07-10[MIPS] remove LASAT Networks platforms supportYoichi Yuasa
Signed-off-by: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>