From 96b3eace39d2ecfdb07003856ddd8f6973dfe7bb Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 22 Aug 2013 23:41:34 +0800 Subject: spi: Remove a redundant test for master->running in spi_queued_transfer We have tested master->running immediately after grab the master->queue_lock. The status of master->running won't be changed until we release the lock. Thus remove a redundant test for master->running. Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- drivers/spi/spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/spi') diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 978dda2c523..b1db83f1b4a 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -774,7 +774,7 @@ static int spi_queued_transfer(struct spi_device *spi, struct spi_message *msg) msg->status = -EINPROGRESS; list_add_tail(&msg->queue, &master->queue); - if (master->running && !master->busy) + if (!master->busy) queue_kthread_work(&master->kworker, &master->pump_messages); spin_unlock_irqrestore(&master->queue_lock, flags); -- cgit v1.2.3-18-g5258 From e93b07244d6e1d6105df78b6117b00c940006b45 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Sat, 31 Aug 2013 20:25:52 +0800 Subject: spi: core: Fix spi_register_master error handling In the case spi_master_initialize_queue() fails, current code calls device_unregister() before return error from spi_register_master(). However, all the drivers call spi_master_put() in the error path if spi_register_master() fails. Thus we should call device_del() rather than device_unregister() before return error from spi_register_master(). This also makes all the spi_register_master() error handling consistent, because all other error paths of spi_register_master() expect drivers to call spi_master_put() if spi_register_master() fails. Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- drivers/spi/spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/spi') diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index b1db83f1b4a..f56017ea55e 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -1169,7 +1169,7 @@ int spi_register_master(struct spi_master *master) else { status = spi_master_initialize_queue(master); if (status) { - device_unregister(&master->dev); + device_del(&master->dev); goto done; } } -- cgit v1.2.3-18-g5258