diff options
author | David Brownell <dbrownell@users.sourceforge.net> | 2008-08-15 00:40:44 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-08-15 08:35:44 -0700 |
commit | e48880e02e7e7ead9daa47fe3a20486f550668d3 (patch) | |
tree | e46cb1788109caf59fcb77453dffd43fec6e305e /fs/nls/nls_base.c | |
parent | 7d455e0030eeab820773e7786605be4d9e56a04b (diff) |
spi: bugfix spi_add_device() with duplicate chipselects
When reviewing a recent patch I noticed a potential trouble spot in the
registration of new SPI devices. The SPI master driver is told to set
the device up before adding it to the driver model, so that it's always
properly set up when probe() is called. (This is important, because in
the case of inverted chipselects, this device can make the bus misbehave
until it's properly deselected. It's got to be set up even if no driver
binds to the device.)
The trouble spot is that it doesn't first verify that no other device
has been added using that chipselect. If such a device has been added,
its configuration gets trashed. (Fortunately this has not been a common
error!)
The fix here adds an explicit check, and a mutex to protect the relevant
critical region.
[akpm@linux-foundation.org: make the lock local to spi_add_device()]
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/nls/nls_base.c')
0 files changed, 0 insertions, 0 deletions