ixp4xx: remove linux 3.10 support
[openwrt/svn-archive/archive.git] / target / linux / brcm2708 / patches-3.10 / 0168-spidev-fix-hang-when-transfer_one_message-fails.patch
1 From d02bc1f83cf08d59c159eb2e1263a3b4a2addc90 Mon Sep 17 00:00:00 2001
2 From: Daniel Santos <daniel.santos@pobox.com>
3 Date: Sun, 5 Jan 2014 17:39:26 -0600
4 Subject: [PATCH 168/196] spidev: fix hang when transfer_one_message fails
5
6 commit e120cc0dcf2880a4c5c0a6cb27b655600a1cfa1d upstream.
7
8 This corrects a problem in spi_pump_messages() that leads to an spi
9 message hanging forever when a call to transfer_one_message() fails.
10 This failure occurs in my MCP2210 driver when the cs_change bit is set
11 on the last transfer in a message, an operation which the hardware does
12 not support.
13
14 Rationale
15 Since the transfer_one_message() returns an int, we must presume that it
16 may fail. If transfer_one_message() should never fail, it should return
17 void. Thus, calls to transfer_one_message() should properly manage a
18 failure.
19
20 Fixes: ffbbdd21329f3 (spi: create a message queueing infrastructure)
21 Signed-off-by: Daniel Santos <daniel.santos@pobox.com>
22 Signed-off-by: Mark Brown <broonie@linaro.org>
23 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
24 ---
25 drivers/spi/spi.c | 4 +++-
26 1 file changed, 3 insertions(+), 1 deletion(-)
27
28 diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
29 index 32b7bb1..ca99ac9 100644
30 --- a/drivers/spi/spi.c
31 +++ b/drivers/spi/spi.c
32 @@ -584,7 +584,9 @@ static void spi_pump_messages(struct kthread_work *work)
33 ret = master->transfer_one_message(master, master->cur_msg);
34 if (ret) {
35 dev_err(&master->dev,
36 - "failed to transfer one message from queue\n");
37 + "failed to transfer one message from queue: %d\n", ret);
38 + master->cur_msg->status = ret;
39 + spi_finalize_current_message(master);
40 return;
41 }
42 }
43 --
44 1.9.1
45