diff options
author | Shubhrajyoti D <shubhrajyoti@ti.com> | 2012-05-10 19:20:41 +0530 |
---|---|---|
committer | Harry Hong <hhong@nvidia.com> | 2013-11-21 22:44:49 -0800 |
commit | 19e1f4236d840c6f044d61b9450a135566d35d20 (patch) | |
tree | a8e3f37be9ca31f2476e9e04fb489187b8188683 | |
parent | 2744fd16736f0742bc92eb64ec7ca2c8992d41fe (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.
Bug 1297342
Bug 1394476
Change-Id: I90ea3f18818eea7169d9d365ef26c61519debafb
Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Shardar Shariff Md <smohammed@nvidia.com>
Reviewed-on: http://git-master/r/240007
(cherry picked commit from mainline 7dfd2bd70228d1f8d468d58cb3d12ecd618479ed)
(cherry picked from commit c01241fe4c38dbc168c302c4ecde8703959b2890)
Reviewed-on: http://git-master/r/333032
Reviewed-by: Harry Hong <hhong@nvidia.com>
Tested-by: Harry Hong <hhong@nvidia.com>
-rw-r--r-- | drivers/spi/spi.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 3d8f662e4fe9..1d3de4283762 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -2,6 +2,7 @@ * SPI init/core code * * Copyright (C) 2005 David Brownell + * Copyright (C) 2012-2013, NVIDIA Corporation. All Rights Reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -530,7 +531,7 @@ static void spi_pump_messages(struct kthread_work *work) /* Lock queue and check for queue work */ spin_lock_irqsave(&master->queue_lock, flags); if (list_empty(&master->queue) || !master->running) { - if (master->busy) { + if (master->busy && master->unprepare_transfer_hardware) { ret = master->unprepare_transfer_hardware(master); if (ret) { spin_unlock_irqrestore(&master->queue_lock, flags); @@ -560,7 +561,7 @@ static void spi_pump_messages(struct kthread_work *work) master->busy = true; spin_unlock_irqrestore(&master->queue_lock, flags); - if (!was_busy) { + if (!was_busy && master->prepare_transfer_hardware) { ret = master->prepare_transfer_hardware(master); if (ret) { dev_err(&master->dev, |