All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] spi: pxa2xx: Fix cs_change management
@ 2016-03-20 18:30 Christophe Ricard
       [not found] ` <1458498617-11566-1-git-send-email-christophe-h.ricard-qxv4g6HH51o@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Christophe Ricard @ 2016-03-20 18:30 UTC (permalink / raw)
  To: broonie-DgEjT+Ai2ygdnm+yROfE0A
  Cc: mika.westerberg-VuQAYsv1563Yd54FQh9/CA,
	linux-spi-u79uwXL29TY76Z2rM5mHXA,
	christophe.ricard-Re5JQEeQqe8AvxtiuMwx3w,
	christophe-h.ricard-qxv4g6HH51o, benoit.houyere-qxv4g6HH51o,
	jean-luc.blanc-qxv4g6HH51o

Fix cs_change management so that it is in line with other spi drivers.

In the spi core api helpers such as spi_bus_lock/unlock and spi_sync_locked
or cs_change field in spi_transfer help to manage chip select from the
device driver.

The driver was setting the chip select to idle if the message queue was
empty despite cs_change or other status field set by spi_bus_lock/unlock
or spi_sync_locked.

Signed-off-by: Christophe Ricard <christophe-h.ricard-qxv4g6HH51o@public.gmane.org>
---
 drivers/spi/spi-pxa2xx.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c
index ab9914a..ed034ed 100644
--- a/drivers/spi/spi-pxa2xx.c
+++ b/drivers/spi/spi-pxa2xx.c
@@ -532,9 +532,8 @@ static void giveback(struct driver_data *drv_data)
 		/* see if the next and current messages point
 		 * to the same chip
 		 */
-		if (next_msg && next_msg->spi != msg->spi)
-			next_msg = NULL;
-		if (!next_msg || msg->state == ERROR_STATE)
+		if ((next_msg && next_msg->spi != msg->spi) ||
+		    msg->state == ERROR_STATE)
 			cs_deassert(drv_data);
 	}
 
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-03-29  7:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-20 18:30 [PATCH] spi: pxa2xx: Fix cs_change management Christophe Ricard
     [not found] ` <1458498617-11566-1-git-send-email-christophe-h.ricard-qxv4g6HH51o@public.gmane.org>
2016-03-20 19:42   ` Andy Shevchenko
     [not found]     ` <CAHp75VdJ3Rgvrh5=7tCUs8it_7G=POhNiKWLcK=55=i3HRtCgA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-03-21 22:12       ` Christophe Ricard
2016-03-29  7:42   ` Applied "spi: pxa2xx: Fix cs_change management" to the spi tree Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.