Richard Purdie [Tue, 29 Jan 2008 10:21:56 +0000 (10:21 +0000)]
[MTD] mtdoops: Ensure sequential write to the buffer
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>
Richard Purdie [Tue, 29 Jan 2008 11:27:11 +0000 (11:27 +0000)]
[MTD] mtdoops: Perform write operations in a workqueue
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>
Richard Purdie [Tue, 29 Jan 2008 11:27:09 +0000 (11:27 +0000)]
[MTD] mtdoops: Add further error return code checking
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>
Roel Kluin [Mon, 28 Jan 2008 10:48:09 +0000 (11:48 +0100)]
[MTD] [NOR] Test devtype, not definition in flash_probe(), drivers/mtd/devices/lart.c
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>
akpm@linux-foundation.org [Wed, 16 Jan 2008 10:48:49 +0000 (02:48 -0800)]
[UBI] drivers/mtd/ubi/scan.c: fix uninitialized var warning
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>
akpm@linux-foundation.org [Wed, 16 Jan 2008 10:47:01 +0000 (02:47 -0800)]
[UBI] drivers/mtd/ubi/wl.c: fix uninitialized var warning
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>
akpm@linux-foundation.org [Wed, 16 Jan 2008 09:24:27 +0000 (01:24 -0800)]
[UBI] drivers/mtd/ubi/cdev.c: unused var
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Scott Wood [Tue, 15 Jan 2008 23:54:43 +0000 (17:54 -0600)]
[MTD] Factor out OF partition support from the NOR driver.
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Ilpo Järvinen [Mon, 7 Jan 2008 16:00:58 +0000 (18:00 +0200)]
[MTD] jedec probe: drop unnecessary forward declarations
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Ilpo Järvinen [Mon, 7 Jan 2008 16:00:17 +0000 (18:00 +0200)]
[MTD] JEDEC probe: kill some inline bloat
$ 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>
Matt Reimer [Fri, 19 Oct 2007 01:02:43 +0000 (18:02 -0700)]
[MTD] [NAND] fix s3c2410 error correction
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>
Matt Reimer [Fri, 19 Oct 2007 01:02:44 +0000 (18:02 -0700)]
[MTD] [NAND] make s3c2410 indicate an error for multi-bit read errors
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>
Bartlomiej Sieka [Mon, 26 Nov 2007 17:55:18 +0000 (18:55 +0100)]
[MTD] [NOR] Fix incorrect interface code for x16/x32 chips
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>
Scott Wood [Thu, 13 Dec 2007 17:15:28 +0000 (11:15 -0600)]
[MTD] [NAND] Don't panic if a controller driver does ecc its own way.
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>
Julia Lawall [Sun, 6 Jan 2008 16:50:34 +0000 (17:50 +0100)]
[JFFS2] Add missing call to posix_acl_release
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>
David Woodhouse [Mon, 31 Dec 2007 17:52:29 +0000 (17:52 +0000)]
[MTD] [MAPS] Remove Photron PNC-2000 map driver
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>
David Scidmore [Tue, 11 Dec 2007 23:44:30 +0000 (17:44 -0600)]
[MTD] mtdchar.c: ioctl always returns 0 as size written for ppc64
"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>
Artem Bityutskiy [Wed, 26 Dec 2007 13:59:39 +0000 (15:59 +0200)]
UBI: bugfix: do not forget to increment vol_count
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>
Artem Bityutskiy [Wed, 26 Dec 2007 12:25:58 +0000 (14:25 +0200)]
UBI: do not support kiB
Be strict and accept only KiB, MiB and GiB, not Kib, not kib, etc.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Wed, 26 Dec 2007 11:46:46 +0000 (13:46 +0200)]
UBI: add mtd_num sysfs attribute
Expose number or the underlying MTD device in sysfs.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Tue, 25 Dec 2007 17:17:00 +0000 (19:17 +0200)]
UBI: fix mtd device string parsing
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>
Artem Bityutskiy [Tue, 25 Dec 2007 16:13:33 +0000 (18:13 +0200)]
UBI: use separate mutex for volumes checking
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>
Artem Bityutskiy [Tue, 18 Dec 2007 16:23:39 +0000 (18:23 +0200)]
UBI: handle attach ioctl
Actually implement the MTD device attach/detach handlers.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Tue, 18 Dec 2007 16:22:16 +0000 (18:22 +0200)]
UBI: introduce attach ioctls
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Wed, 19 Dec 2007 19:43:32 +0000 (21:43 +0200)]
UBI: remove data_offset
'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>
Artem Bityutskiy [Mon, 17 Dec 2007 18:33:20 +0000 (20:33 +0200)]
UBI: prepare attach and detach functions
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>
Artem Bityutskiy [Mon, 17 Dec 2007 15:37:26 +0000 (17:37 +0200)]
UBI: add UBI devices reference counting
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>
Artem Bityutskiy [Sun, 16 Dec 2007 14:59:31 +0000 (16:59 +0200)]
UBI: add UBI control device
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>
Artem Bityutskiy [Wed, 19 Dec 2007 14:03:17 +0000 (16:03 +0200)]
UBI: fix comment
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Tue, 18 Dec 2007 13:54:35 +0000 (15:54 +0200)]
UBI: fix ubi_wl_flush
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>
Artem Bityutskiy [Wed, 19 Dec 2007 15:03:42 +0000 (17:03 +0200)]
UBI: fix printk
Add proper log level to printk's.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Tue, 18 Dec 2007 13:06:55 +0000 (15:06 +0200)]
UBI: bugfix: protect from volume removal
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>
Artem Bityutskiy [Tue, 18 Dec 2007 11:17:24 +0000 (13:17 +0200)]
UBI: improve comment
Explain better the purpose of thie 'move_to_put' stuff.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Tue, 18 Dec 2007 10:57:52 +0000 (12:57 +0200)]
UBI: add PID to debugging prints
Also, use single dbg_msg() macro for all prints.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Mon, 17 Dec 2007 15:08:55 +0000 (17:08 +0200)]
UBI: tweak volumes locking some more
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>
Artem Bityutskiy [Mon, 17 Dec 2007 13:42:57 +0000 (15:42 +0200)]
UBI: introduce volume refcounting
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>
Artem Bityutskiy [Mon, 17 Dec 2007 13:48:49 +0000 (15:48 +0200)]
UBI: simplify error handling
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>
Artem Bityutskiy [Mon, 17 Dec 2007 12:22:55 +0000 (14:22 +0200)]
UBI: fix and cleanup volume opening functions
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>
Artem Bityutskiy [Mon, 17 Dec 2007 12:02:09 +0000 (14:02 +0200)]
UBI: fix error path
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>
Artem Bityutskiy [Mon, 17 Dec 2007 11:09:09 +0000 (13:09 +0200)]
UBI: get device when opening volume
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>
Artem Bityutskiy [Mon, 17 Dec 2007 11:21:07 +0000 (13:21 +0200)]
UBI: add some more comments
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Mon, 17 Dec 2007 10:46:48 +0000 (12:46 +0200)]
UBI: tweak volumes locking
Transform vtbl_mutex to volumes_mutex - this just makes code
easier to understand.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Sun, 16 Dec 2007 18:00:38 +0000 (20:00 +0200)]
UBI: improve internal interfaces
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>
Artem Bityutskiy [Sun, 16 Dec 2007 14:46:57 +0000 (16:46 +0200)]
UBI: bugfix: dont oops with NULL module parameter
E.g., it oopsed in case of: modprobe ubi mtd = 0
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Sun, 16 Dec 2007 11:01:03 +0000 (13:01 +0200)]
UBI: remove ubi_devices_cnt
This global variablea is not really needed, remove it
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Sun, 16 Dec 2007 10:49:01 +0000 (12:49 +0200)]
UBI: create ubi_wl_entry slab on initialization
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>
Artem Bityutskiy [Sun, 16 Dec 2007 10:32:51 +0000 (12:32 +0200)]
UBI: create ltree_entry slab on initialization
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>
Artem Bityutskiy [Sat, 15 Dec 2007 17:56:51 +0000 (19:56 +0200)]
UBI: improve error messages
Always print error code with error messages, sometimes it is
extremely helpful info.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Sat, 15 Dec 2007 16:13:56 +0000 (18:13 +0200)]
UBI: remove redundant field
Remove redundant ubi->major field - we have it in ubi->cdev.dev
already.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Sat, 15 Dec 2007 13:09:07 +0000 (15:09 +0200)]
UBI: minor tidy-ups
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Jesper Juhl [Thu, 13 Dec 2007 22:53:08 +0000 (23:53 +0100)]
UBI: silence a warning
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>
Artem Bityutskiy [Thu, 6 Dec 2007 16:47:30 +0000 (18:47 +0200)]
UBI: add ubi_leb_map interface
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>
Artem Bityutskiy [Tue, 4 Dec 2007 19:36:12 +0000 (21:36 +0200)]
UBI: bugfix: allocate mandatory EBs first
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>
Artem Bityutskiy [Thu, 18 Oct 2007 17:09:41 +0000 (20:09 +0300)]
UBI: fix error code in ubi_io_read()
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>
Peter Korsgaard [Tue, 6 Nov 2007 10:56:02 +0000 (11:56 +0100)]
[MTD] mtdoops cleanup
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>
Peter Korsgaard [Tue, 6 Nov 2007 10:55:00 +0000 (11:55 +0100)]
[MTD] mtdoops: Document usage in Kconfig
Add usage instructions to Kconfig for mtdoops driver.
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Tzachi Perelstein [Tue, 16 Oct 2007 23:10:40 +0000 (01:10 +0200)]
[MTD] [NAND] Marvell Orion device bus NAND controller
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>
David Woodhouse [Mon, 3 Dec 2007 13:01:21 +0000 (13:01 +0000)]
[MTD] [NOR] Attempt to clean up the JEDEC unlock address confusion
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>
David Woodhouse [Fri, 30 Nov 2007 16:24:52 +0000 (16:24 +0000)]
[MTD] [NOR] Fix overflow check in jedec_probe
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>
David Woodhouse [Mon, 3 Dec 2007 12:48:57 +0000 (12:48 +0000)]
[MTD] [NOR] Clean up jedec_probe, remove unlock address arrays
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>
David Woodhouse [Mon, 3 Dec 2007 12:46:12 +0000 (12:46 +0000)]
[MTD] Always initialise mutex in new mtd_blktrans_dev.
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>
Egor Martovetsky [Thu, 29 Nov 2007 00:37:31 +0000 (18:37 -0600)]
[MTD] [NAND] pasemi_nand driver
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>
Ben Dooks [Mon, 19 Nov 2007 23:28:07 +0000 (23:28 +0000)]
[MTD] [NAND] S3C2410 correctly set nFCE over resume
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>
Stanislav Brabec [Mon, 19 Nov 2007 21:33:02 +0000 (22:33 +0100)]
[MTD] fix CONFIG_MTD_SHARP_SL if CONFIG_MTD=m
Sharp Zaurus SL-C3200 with CONFIG_MTD=m and CONFIG_MTD_SHARP_SL=y (as it
is bool) lost support for the ROM flash. With CONFIG_MTD=y it has no
problems.
It is caused by losing of compiled code of
drivers/mtd/maps/sharpsl-flash.o.
It was linked to drivers/mtd/maps/built-in.o and drivers/mtd/built-in.o,
but lost and not linked to drivers/built-in.o (because CONFIG_MTD!=y).
Patch below fixes this problem by creating sharpsl-flash.ko (and the
code works correctly as a module).
Signed-off-by: Stanislav Brabec <utx@penguin.cz>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Andrew Victor [Mon, 19 Nov 2007 13:37:23 +0000 (15:37 +0200)]
[MTD] mtd_dataflash: Incorrect compare-after-write check
After writing to a Dataflash page, the built-in compare operation is
used to check that the page was successfully written. A logic bug in
checking the results of the comparison currently causes the compare to
never fail.
This bug was originally in the legacy at91_dataflash.c driver.
Signed-off-by: Andrew Victor <andrew@sanpeople.com>
Acked-by: David Brownell <david-b@pacbell.net>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Alexey Korolev [Tue, 27 Nov 2007 11:25:10 +0000 (11:25 +0000)]
[JFFS2] Fix return value check for mtd->point() in check_node_data()
If we ask it to map 'len' bytes of the device, don't compare against
some other number and whine that it's different. That's a little silly.
Signed-off-by: Alexey Korolev <akorolev@infradead.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Alexander Belyakov [Wed, 7 Nov 2007 08:58:07 +0000 (11:58 +0300)]
[MTD] [NOR] Prevent erase command invocation on suspended chip
while running stress tests we have met cfi_cmdset_0001.c driver issue.
Working on multipartitional devices with erase suspend on write
feature enabled it is possible to get erase operation invoked on chip
with suspended erase. get_chip() looses information about earlier
suspended erase and new erase operation gets issued. New erase
operations report successful completion, but blocks remain dirty
causing, for example, JFFS2 error messages like:
...
Newly-erased block contained word 0x20031985 at offset 0x00200000
Newly-erased block contained word 0x20031985 at offset 0x00280000
Newly-erased block contained word 0x20031985 at offset 0x00240000
...
The patch below fixes that issue.
Signed-off-by: Alexander Belyakov <alexander.belyakov@intel.com>
Acked-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Adrian Hunter [Tue, 6 Nov 2007 07:17:25 +0000 (09:17 +0200)]
[MTD] [OneNAND] Do not stop reading for ECC errors
When an ECC error occurs, the read should be completed
anyway before returning -EBADMSG. Returning -EBADMSG
straight away is incorrect.
Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Alexey Korolev [Fri, 23 Nov 2007 09:31:56 +0000 (09:31 +0000)]
[MTD] [NOR] Support Intel P3x flash support with CFI version 1.5
Signed-off-by: Alexey Korolev <akorolev@infradead.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
David Woodhouse [Wed, 21 Nov 2007 17:08:16 +0000 (12:08 -0500)]
[JFFS2] Fix data CRC checking on NOR flash.
We were failing to check the data CRC on data nodes on non-writebuffered
flash, which led to "interesting" behaviour on unclean shutdowns.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
David Howells [Fri, 9 Nov 2007 15:34:42 +0000 (15:34 +0000)]
[MTD] [NOR] Add support for the SST 39VF1601 flash chip
Add support for the SST 39VF1601 flash chip.
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Jesper Nilsson [Tue, 6 Nov 2007 08:40:24 +0000 (08:40 +0000)]
[MTD] Provide mtdram.h with mtdram_init_device() prototype
This is used by axisflashmap.c to boot from ram.
Signed-off-by: Jesper Nilsson <jesper.nilsson@axis.com>
Acked-by: Mikael Starvik <starvik@axis.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Adrian Bunk [Tue, 6 Nov 2007 08:36:49 +0000 (08:36 +0000)]
[JFFS2] make jffs2_get_acl() static
jffs2_get_acl() can now become static again.
Signed-off-by: Adrian Bunk <bunk@kernel.org>
Acked-by: KaiGai Kohei <kaigai@ak.jp.nec.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
David Woodhouse [Tue, 6 Nov 2007 08:29:59 +0000 (08:29 +0000)]
[JFFS2] Fix misapplied patch causing compile breakage
Somehow, the patch in commit
15953580e79b58caefb107e77f218e009b9992e6
was misapplied and part of the old list-traversal remained. Remove it.
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
David Woodhouse [Thu, 1 Nov 2007 20:27:38 +0000 (16:27 -0400)]
[JFFS2] Don't strip sgid bit from inode permissions
<viro> dwmw2: anyway, removing sgid from directories or from
files without S_IXGRP is a plain and simple bug
<viro> these days you don't need that logics at all - simply remove it
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
David Woodhouse [Thu, 1 Nov 2007 20:25:56 +0000 (16:25 -0400)]
[JFFS2] Improve getdents vs. f_pos handling on NOR flash.
Commit
a491486a2087ac3dfc00efb4f838c8d684afaf54 started obliterating
dirents directly on the medium, when jffs2_can_mark_obsolete(). Removing
them immediately from the f->dents list, however, screws up handling of
f_pos within a directory -- because the offset is equivalent to the
number of entries through the list we are, and the existence of
deletion dirents served to provide 'placeholders' for unlinked
entries. Now, 'rm -r' doesn't even manage to unlink everything in the
directory.
Revert to keeping 'deletion' dirents in the list, at least in memory
even though we no longer write anything to the medium.
Spotted, debugged and mostly fixed by Joakim Tjernlund
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Hans-Christian Egtvedt [Tue, 30 Oct 2007 15:33:07 +0000 (16:33 +0100)]
[MTD] [NOR] More CFI fixups for Atmel chips
Convert CFI tables from Atmel cmdset_0001 chips to Intel format and set
BufWrite timeouts to 0 for Atmel cmdset_0001 and cmdset_0002 chips.
Some chips may indicate support for buffered writes even though they
only support dual-word writes.
The CFI fixup must run before fixup_use_write_buffers for this to work.
Signed-off-by: Håvard Skinnemoen <hskinnemoen@atmel.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Valentine Barshak [Mon, 29 Oct 2007 20:29:02 +0000 (23:29 +0300)]
MTD: small physmap_of partition parsing fixes
Use of_get_next_child for proper ref counting as suggested by Stephen Rothwell
and remove add_mtd_partitions from parse_partitions to avoid duplicate
mtd device registration for RedBoot partitions.
Signed-off-by: Valentine Barshak <vbarshak@ru.mvista.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Heckled-for-on-IRC-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Michael Hennerich [Tue, 30 Oct 2007 09:08:29 +0000 (17:08 +0800)]
[MTD] [NAND] Add Blackfin BF52x support in bf5xx_nand driver
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Bryan Wu <bryan.wu@analog.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
David Woodhouse [Mon, 29 Oct 2007 01:57:02 +0000 (21:57 -0400)]
[MTD] Skip bad blocks when checking for RedBoot partition table
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
David Woodhouse [Mon, 29 Oct 2007 01:56:39 +0000 (21:56 -0400)]
[MTD] [NAND] Check for RedBoot partitions on CAFÉ NAND
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Linus Torvalds [Sun, 28 Oct 2007 19:03:14 +0000 (12:03 -0700)]
Merge git://git./linux/kernel/git/bart/ide-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6:
ide: add SH-S202J to ivb_list[]
drivers/ide/pci/sc1200.c: fix suspend/resume buglets and warnings
drivers/ide/pci/generic: fix build for CONFIG_HOTPLUG=n
hpt366: fix build for CONFIG_HOTPLUG=n
cy82c693: fix build for CONFIG_HOTPLUG=n
Al Viro [Sat, 27 Oct 2007 20:20:02 +0000 (21:20 +0100)]
duplicate initializer in sound/pci/hda/patch_realtek.c
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Al Viro [Sat, 27 Oct 2007 20:02:32 +0000 (21:02 +0100)]
fix breakage in pegasos_eth
Fix fallout from commit
b45d9147f1582333e180e1023624c003874b7312
("mv643xx_eth: Remove unused register defines")
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Linus Torvalds [Sun, 28 Oct 2007 05:18:55 +0000 (22:18 -0700)]
Merge git://git./linux/kernel/git/x86/linux-2.6-x86
* git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-x86:
x86: Dump filtering supports x86_64 sparsemem
x86: fix compiler warnings in arch/x86/kernel/early-quirks.c
x86: fix !SMP compiler warning in arch/x86/kernel/acpi/processor.c
x86: Fix boot protocol KEEP_SEGMENTS check.
x86: voyager: fix bogus conversion to per_cpu for boot_cpu_info
x86: export smp_ops to allow modular build of KVM
Revert "i386: export i386 smp_call_function_mask() to modules"
Al Viro [Sat, 27 Oct 2007 18:46:58 +0000 (19:46 +0100)]
cirrusfb nonsense
(pointer > 0) is deeply weird; (pointer >= 0) is even dumber...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Al Viro [Sat, 27 Oct 2007 18:40:46 +0000 (19:40 +0100)]
scatterlist fallout: mmc
#include <scatterlist/scatterlist.h>
is an odd thing to do...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Al Viro [Sat, 27 Oct 2007 18:39:23 +0000 (19:39 +0100)]
ide/arm/icside: fallout from commit
86f3a492bb09eee5745b93af35f2212179c251fd
struct device doesn't have ->dma; it's in struct expansion_card where
that struct device is embedded into.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Acked-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Al Viro [Sat, 27 Oct 2007 18:23:30 +0000 (19:23 +0100)]
scatterlist fallout: frv
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Ken'ichi Ohmichi [Fri, 26 Oct 2007 05:19:26 +0000 (14:19 +0900)]
x86: Dump filtering supports x86_64 sparsemem
This patch adds the symbol "init_level4_pgt" to the vmcoreinfo data so
that makedumpfile (dump filtering command) supports x86_64 sparsemem
kernel of linux-2.6.24.
makedumpfile creates a small dumpfile by excluding unnecessary pages for
the analysis. It checks attributes in page structures and distinguishes
necessary pages and unnecessary ones. To check them, makedumpfile gets
the vmcoreinfo data which has the minimum debugging information only for
dump filtering.
For older x86_64 kernel (linux-2.6.23 or before), makedumpfile translates
the virtual address of page structure into physical address by subtracting
PAGE_OFFSET from virtual address, but this translation isn't effective for
linux-2.6.24 sparsemem kernel, because its page structures are in virtual
memmap area. makedumpfile should translate their virtual address by 4-levels
paging and it needs the symbol "init_level4_pgt".
Signed-off-by: Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Jeff Garzik [Sat, 27 Oct 2007 18:57:43 +0000 (20:57 +0200)]
x86: fix compiler warnings in arch/x86/kernel/early-quirks.c
fix this warning:
arch/x86/kernel/early-quirks.c:40: warning: nvidia_hpet_check defined but not used
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Jeff Garzik [Sat, 27 Oct 2007 18:57:43 +0000 (20:57 +0200)]
x86: fix !SMP compiler warning in arch/x86/kernel/acpi/processor.c
Fix !CONFIG_SMP warning:
arch/x86/kernel/acpi/processor.c: In function arch_acpi_processor_init_pdc:
arch/x86/kernel/acpi/processor.c:65: warning: unused variable cpu
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Eric W. Biederman [Fri, 26 Oct 2007 17:29:04 +0000 (11:29 -0600)]
x86: Fix boot protocol KEEP_SEGMENTS check.
The kernel only ever supports 1 version of the boot protocol
so there is no need to check the boot protocol revision to
see if a feature is supported.
Both x86 and x86_64 support the same boot protocol so we need
to implement the KEEP_SEGMENTS on x86_64 as well. It isn't
just paravirt bootloaders that could use this functionality.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Cc: Jeremy Fitzhardinge <jeremy@xensource.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Vivek Goyal <vgoyal@in.ibm.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Zachary Amsden <zach@vmware.com>
Cc: Andi Kleen <ak@suse.de>
Acked-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
James Bottomley [Fri, 26 Oct 2007 17:17:19 +0000 (12:17 -0500)]
x86: voyager: fix bogus conversion to per_cpu for boot_cpu_info
There were two problems. Firstly, someone forgot the struct keyword in
front of cpuinfo_x86, so I take it this wasn't even compile checked.
Secondly, the actual definition has this as a SHARED_ALIGNED, so the
definitions mismatch.
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Thomas Gleixner [Sat, 27 Oct 2007 18:57:43 +0000 (20:57 +0200)]
x86: export smp_ops to allow modular build of KVM
KVM uses smp_call_function_mask and therefor need smp_ops to be exported.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Thomas Gleixner [Fri, 26 Oct 2007 15:22:17 +0000 (17:22 +0200)]
Revert "i386: export i386 smp_call_function_mask() to modules"
This reverts commit
6442eea937ef797d4b66733f49c82e2fdc2aca6f.
The patch breaks smp_ops and needs to be reverted. The solution to
allow modular build of KVM is to export smp_ops instead.
Pointed-out-by: James Bottomley
<jejb> tglx, so write out 100 times "voyager is a useful architecture" ...
<tglx> yes, Sir
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Linus Torvalds [Sat, 27 Oct 2007 17:14:04 +0000 (10:14 -0700)]
Merge git://git.infradead.org/mtd-2.6
* git://git.infradead.org/mtd-2.6:
[JFFS2] Update MAINTAINERS entry -- the jffs-dev list is dead
[JFFS2] Prevent return of initialised variable in jffs2_init_acl_post()
Linus Torvalds [Sat, 27 Oct 2007 17:12:39 +0000 (10:12 -0700)]
Merge branch 'for-linus' of git://git./linux/kernel/git/drzeus/mmc
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/drzeus/mmc:
mmc_spi: Fix mmc-over-spi regression
mmc: use common byte swap macros
mmc: fix cid and csd byte order
at91_mci: Fix bad reference
Linus Torvalds [Sat, 27 Oct 2007 17:11:12 +0000 (10:11 -0700)]
Merge branch 'master' of /linux/kernel/git/davem/sparc-2.6
* 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6:
[SPARC32]: Fix build-warning in io-unit.c
[SPARC64]: Fix BACKOFF_SPIN on non-SMP.
[SPARC32]: __inline__ --> inline
[SPARC64]: __inline__ --> inline
Linus Torvalds [Sat, 27 Oct 2007 17:10:40 +0000 (10:10 -0700)]
Merge branch 'master' of /linux/kernel/git/davem/net-2.6
* 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6:
[CRYPTO] users: Fix up scatterlist conversion errors
[CRYPTO] tcrypt: Move sg_init_table out of timing loops
[NETNS]: Fix get_net_ns_by_pid
[NET]: Marking struct pernet_operations __net_initdata was inappropriate
[INET] ESP: Must #include <linux/scatterlist.h>
[TCP] IPV6: fix softnet build breakage