diff mbox

[1/2] spi: img-spfi: check for timeout error before proceeding

Message ID 1437999076-693-1-git-send-email-sifan.naeem@imgtec.com (mailing list archive)
State Accepted
Commit 011710e2ab659c7ad6e5e554806414bd7a9508be
Headers show

Commit Message

Sifan Naeem July 27, 2015, 12:11 p.m. UTC
Calling spfi_wait_all_done is not required if the transfer has timed
out before all data is transferred.

spfi_wait_all_done polls for Alldone interrupt which is triggered to
mark the transfer as complete and to indicate it is now safe to issue
a new transfer.

Fixes: 8c2c8c0 ("spi: img-spfi: Control CS lines with GPIO")
Signed-off-by: Sifan Naeem <sifan.naeem@imgtec.com>
Cc: Stable kernel (v4.1) <stable@vger.kernel.org>
---
 drivers/spi/spi-img-spfi.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Andrew Bresticker July 27, 2015, 4:30 p.m. UTC | #1
Hi Sifan,

On Mon, Jul 27, 2015 at 5:11 AM, Sifan Naeem <sifan.naeem@imgtec.com> wrote:
> Calling spfi_wait_all_done is not required if the transfer has timed
> out before all data is transferred.
>
> spfi_wait_all_done polls for Alldone interrupt which is triggered to
> mark the transfer as complete and to indicate it is now safe to issue
> a new transfer.
>
> Fixes: 8c2c8c0 ("spi: img-spfi: Control CS lines with GPIO")
> Signed-off-by: Sifan Naeem <sifan.naeem@imgtec.com>
> Cc: Stable kernel (v4.1) <stable@vger.kernel.org>

Reviewed-by: Andrew Bresticker <abrestic@chromium.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Mark Brown July 29, 2015, 1:53 p.m. UTC | #2
On Mon, Jul 27, 2015 at 01:11:15PM +0100, Sifan Naeem wrote:

> Fixes: 8c2c8c0 ("spi: img-spfi: Control CS lines with GPIO")

Please use at least 12 characters of the hash, six is likely to generate
collisions on large repositories like Linux.
Sifan Naeem July 29, 2015, 2:07 p.m. UTC | #3
Hi Mark,

> -----Original Message-----
> From: Mark Brown [mailto:broonie@kernel.org]
> Sent: 29 July 2015 14:53
> To: Sifan Naeem
> Cc: linux-spi@vger.kernel.org; abrestic@chromium.org; Stable kernel (v4.1)
> Subject: Re: [PATCH 1/2] spi: img-spfi: check for timeout error before
> proceeding
> 
> On Mon, Jul 27, 2015 at 01:11:15PM +0100, Sifan Naeem wrote:
> 
> > Fixes: 8c2c8c0 ("spi: img-spfi: Control CS lines with GPIO")
> 
> Please use at least 12 characters of the hash, six is likely to generate collisions
> on large repositories like Linux.

v2 posted with 12 digit hash.

Thanks,
Sifan
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/spi/spi-img-spfi.c b/drivers/spi/spi-img-spfi.c
index 00f1ac3..f27d9d5 100644
--- a/drivers/spi/spi-img-spfi.c
+++ b/drivers/spi/spi-img-spfi.c
@@ -267,15 +267,15 @@  static int img_spfi_start_pio(struct spi_master *master,
 		cpu_relax();
 	}
 
-	ret = spfi_wait_all_done(spfi);
-	if (ret < 0)
-		return ret;
-
 	if (rx_bytes > 0 || tx_bytes > 0) {
 		dev_err(spfi->dev, "PIO transfer timed out\n");
 		return -ETIMEDOUT;
 	}
 
+	ret = spfi_wait_all_done(spfi);
+	if (ret < 0)
+		return ret;
+
 	return 0;
 }