Root/target/linux/generic/patches-3.3/048-spi-Dont-call-prepare-unprepare-transfer-if-not-popu.patch

1From 7dfd2bd70228d1f8d468d58cb3d12ecd618479ed Mon Sep 17 00:00:00 2001
2From: Shubhrajyoti D <shubhrajyoti@ti.com>
3Date: Thu, 10 May 2012 19:20:41 +0530
4Subject: [PATCH] spi: Dont call prepare/unprepare transfer if not populated
5
6Currently the prepare/unprepare transfer are called unconditionally.
7The assumption is that every driver using the spi core queue infrastructure
8has to populate the prepare and unprepare functions. This encourages
9drivers to populate empty functions to prevent crashing.
10This patch prevents the call to prepare/unprepare if not populated.
11
12Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
13Acked-by: Linus Walleij <linus.walleij@linaro.org>
14[grant.likely: fix whitespace defect]
15Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
16---
17 drivers/spi/spi.c | 4 ++--
18 1 files changed, 2 insertions(+), 2 deletions(-)
19
20--- a/drivers/spi/spi.c
21+++ b/drivers/spi/spi.c
22@@ -530,7 +530,7 @@ static void spi_pump_messages(struct kth
23     /* Lock queue and check for queue work */
24     spin_lock_irqsave(&master->queue_lock, flags);
25     if (list_empty(&master->queue) || !master->running) {
26- if (master->busy) {
27+ if (master->busy && master->unprepare_transfer_hardware) {
28             ret = master->unprepare_transfer_hardware(master);
29             if (ret) {
30                 dev_err(&master->dev,
31@@ -559,7 +559,7 @@ static void spi_pump_messages(struct kth
32         master->busy = true;
33     spin_unlock_irqrestore(&master->queue_lock, flags);
34 
35- if (!was_busy) {
36+ if (!was_busy && master->prepare_transfer_hardware) {
37         ret = master->prepare_transfer_hardware(master);
38         if (ret) {
39             dev_err(&master->dev,
40

Archive Download this file



interactive