Skip to content

Commit

Permalink
spi_bitbang: always grab lock with irqs blocked
Browse files Browse the repository at this point in the history
Fix a glitch reported by lockdep in the spi_bitbang code: it needs to
consistently block IRQs when holding that spinlock.

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>
  • Loading branch information
David Brownell authored and Linus Torvalds committed Jan 9, 2008
1 parent a2b484a commit d52df2e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/spi/spi_bitbang.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ int spi_bitbang_setup(struct spi_device *spi)
struct spi_bitbang_cs *cs = spi->controller_state;
struct spi_bitbang *bitbang;
int retval;
unsigned long flags;

bitbang = spi_master_get_devdata(spi->master);

Expand Down Expand Up @@ -222,12 +223,12 @@ int spi_bitbang_setup(struct spi_device *spi)
*/

/* deselect chip (low or high) */
spin_lock(&bitbang->lock);
spin_lock_irqsave(&bitbang->lock, flags);
if (!bitbang->busy) {
bitbang->chipselect(spi, BITBANG_CS_INACTIVE);
ndelay(cs->nsecs);
}
spin_unlock(&bitbang->lock);
spin_unlock_irqrestore(&bitbang->lock, flags);

return 0;
}
Expand Down

0 comments on commit d52df2e

Please sign in to comment.