• Mark Brown's avatar
    spi: Split bus and I/O locking · ef4d96ec
    Mark Brown authored
    The current SPI code attempts to use bus_lock_mutex for two purposes. One
    is to implement spi_bus_lock() which grants exclusive access to the bus.
    The other is to serialize access to the physical hardware. This duplicate
    purpose causes confusion which leads to cases where access is not locked
    when a caller holds the bus lock mutex. Fix this by splitting out the I/O
    functionality into a new io_mutex.
    
    This means taking both mutexes in the DMA path, replacing the existing
    mutex with the new I/O one in the message pump (the mutex now always
    being taken in the message pump) and taking the bus lock mutex in
    spi_sync(), allowing __spi_sync() to have no mutex handling.
    
    While we're at it hoist the mutex further up the message pump before we
    power up the device so that all power up/down of the block is covered by
    it and there are no races with in-line pumping of messages.
    Reported-by: 's avatarRich Felker <dalias@libc.org>
    Tested-by: 's avatarRich Felker <dalias@libc.org>
    Signed-off-by: 's avatarMark Brown <broonie@kernel.org>
    ef4d96ec
Name
Last commit
Last update
..
ad7877.h Loading commit data...
adi_spi3.h Loading commit data...
ads7846.h Loading commit data...
at73c213.h Loading commit data...
at86rf230.h Loading commit data...
cc2520.h Loading commit data...
corgi_lcd.h Loading commit data...
ds1305.h Loading commit data...
eeprom.h Loading commit data...
flash.h Loading commit data...
ifx_modem.h Loading commit data...
l4f00242t03.h Loading commit data...
libertas_spi.h Loading commit data...
lms283gf05.h Loading commit data...
max7301.h Loading commit data...
mc33880.h Loading commit data...
mcp23s08.h Loading commit data...
mmc_spi.h Loading commit data...
mxs-spi.h Loading commit data...
pxa2xx_spi.h Loading commit data...
rspi.h Loading commit data...
s3c24xx.h Loading commit data...
sh_hspi.h Loading commit data...
sh_msiof.h Loading commit data...
spi.h Loading commit data...
spi_bitbang.h Loading commit data...
spi_gpio.h Loading commit data...
spi_oc_tiny.h Loading commit data...
tdo24m.h Loading commit data...
tle62x0.h Loading commit data...
tsc2005.h Loading commit data...
xilinx_spi.h Loading commit data...