aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi
diff options
context:
space:
mode:
authorShubhrajyoti D <shubhrajyoti@ti.com>2012-05-10 09:50:41 -0400
committerGrant Likely <grant.likely@secretlab.ca>2012-05-10 23:23:58 -0400
commit7dfd2bd70228d1f8d468d58cb3d12ecd618479ed (patch)
tree5388c3c8ba4907ed86e7401da969e917a4f30586 /drivers/spi
parent6d6467ee58b4cddd34b01d642d282a353dd57ce9 (diff)
spi: Dont call prepare/unprepare transfer if not populated
Currently the prepare/unprepare transfer are called unconditionally. The assumption is that every driver using the spi core queue infrastructure has to populate the prepare and unprepare functions. This encourages drivers to populate empty functions to prevent crashing. This patch prevents the call to prepare/unprepare if not populated. Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> [grant.likely: fix whitespace defect] Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/spi.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 37c555ec59ab..2d65b1684cdc 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -532,7 +532,7 @@ static void spi_pump_messages(struct kthread_work *work)
532 /* Lock queue and check for queue work */ 532 /* Lock queue and check for queue work */
533 spin_lock_irqsave(&master->queue_lock, flags); 533 spin_lock_irqsave(&master->queue_lock, flags);
534 if (list_empty(&master->queue) || !master->running) { 534 if (list_empty(&master->queue) || !master->running) {
535 if (master->busy) { 535 if (master->busy && master->unprepare_transfer_hardware) {
536 ret = master->unprepare_transfer_hardware(master); 536 ret = master->unprepare_transfer_hardware(master);
537 if (ret) { 537 if (ret) {
538 spin_unlock_irqrestore(&master->queue_lock, flags); 538 spin_unlock_irqrestore(&master->queue_lock, flags);
@@ -562,7 +562,7 @@ static void spi_pump_messages(struct kthread_work *work)
562 master->busy = true; 562 master->busy = true;
563 spin_unlock_irqrestore(&master->queue_lock, flags); 563 spin_unlock_irqrestore(&master->queue_lock, flags);
564 564
565 if (!was_busy) { 565 if (!was_busy && master->prepare_transfer_hardware) {
566 ret = master->prepare_transfer_hardware(master); 566 ret = master->prepare_transfer_hardware(master);
567 if (ret) { 567 if (ret) {
568 dev_err(&master->dev, 568 dev_err(&master->dev,