public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Michael Heimpold <michael@heimpold.de>
To: hskinnemoen@atmel.com
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] atmel_spi: Fix handling of chipselect after SPI transfer
Date: Sat, 31 Jan 2009 00:14:41 +0100	[thread overview]
Message-ID: <200901310014.41327.michael@heimpold.de> (raw)

According to include/linux/spi/spi.h chipselect should stay active after a SPI
transfer or after a SPI message unless modified by
spi_transfer.cs_change != 0.

The current atmel driver passes this field to atmel_spi_msg_done as a
parameter with oppositional meaning: "cs_change" -> "stay" (see
atmel_spi_interrupt).

This patch fixes this behavoir by adapting the called function and its
callers. IMHO this solution is better than an one line fix of inverting the
function's argument as the meaning of the field remains throughout
the hole stack.

Signed-off-by: Michael Heimpold <mhei@heimpold.de>

---
 drivers/spi/atmel_spi.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c
index 8abae4a..6b8c020 100644
--- a/drivers/spi/atmel_spi.c
+++ b/drivers/spi/atmel_spi.c
@@ -351,9 +351,9 @@ static void atmel_spi_dma_unmap_xfer(struct spi_master *master,
 
 static void
 atmel_spi_msg_done(struct spi_master *master, struct atmel_spi *as,
-		struct spi_message *msg, int status, int stay)
+		struct spi_message *msg, int status, int cs_change)
 {
-	if (!stay || status < 0)
+	if (cs_change || status < 0)
 		cs_deactivate(as, msg->spi);
 	else
 		as->stay = msg->spi;
@@ -448,7 +448,7 @@ atmel_spi_interrupt(int irq, void *dev_id)
 		/* Clear any overrun happening while cleaning up */
 		spi_readl(as, SR);
 
-		atmel_spi_msg_done(master, as, msg, -EIO, 0);
+		atmel_spi_msg_done(master, as, msg, -EIO, 1);
 	} else if (pending & (SPI_BIT(RXBUFF) | SPI_BIT(ENDRX))) {
 		ret = IRQ_HANDLED;
 
-- 
1.5.4.3


                 reply	other threads:[~2009-01-30 23:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200901310014.41327.michael@heimpold.de \
    --to=michael@heimpold.de \
    --cc=hskinnemoen@atmel.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox