diff options
author | Vasily Khoruzhick <anarsoul@gmail.com> | 2011-04-06 17:49:15 +0300 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2011-04-07 11:17:45 -0700 |
commit | 850a28ecd8044ef36b2c7699d2e3736a410b4d0a (patch) | |
tree | 42a67f4ca8a624df752ad790fe0614fa584817d6 /drivers/spi/pxa2xx_spi.c | |
parent | 454abcc57f1d48a976291bc4af73b5f087e21d70 (diff) | |
download | kernel_samsung_smdk4412-850a28ecd8044ef36b2c7699d2e3736a410b4d0a.zip kernel_samsung_smdk4412-850a28ecd8044ef36b2c7699d2e3736a410b4d0a.tar.gz kernel_samsung_smdk4412-850a28ecd8044ef36b2c7699d2e3736a410b4d0a.tar.bz2 |
spi: Fix race condition in stop_queue()
There's a race condition in stop_queue() in some drivers -
if drv_data->queue is empty, but drv_data->busy is still set
(or opposite situation) stop_queue will return -EBUSY.
So fix loop condition to check that both drv_data->queue is empty
and drv_data->busy is not set.
This patch affects following drivers:
pxa2xx_spi
spi_bfin5xx
amba-pl022
dw_spi
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Acked-by: Eric Miao <eric.y.miao@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'drivers/spi/pxa2xx_spi.c')
-rw-r--r-- | drivers/spi/pxa2xx_spi.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/spi/pxa2xx_spi.c b/drivers/spi/pxa2xx_spi.c index a429b01..3aa7820 100644 --- a/drivers/spi/pxa2xx_spi.c +++ b/drivers/spi/pxa2xx_spi.c @@ -1493,7 +1493,7 @@ static int stop_queue(struct driver_data *drv_data) * execution path (pump_messages) would be required to call wake_up or * friends on every SPI message. Do this instead */ drv_data->run = QUEUE_STOPPED; - while (!list_empty(&drv_data->queue) && drv_data->busy && limit--) { + while ((!list_empty(&drv_data->queue) || drv_data->busy) && limit--) { spin_unlock_irqrestore(&drv_data->lock, flags); msleep(10); spin_lock_irqsave(&drv_data->lock, flags); |