All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] spi: core: make zero length transfer valid again
@ 2014-02-28 14:03 ` Atsushi Nemoto
  0 siblings, 0 replies; 9+ messages in thread
From: Atsushi Nemoto @ 2014-02-28 14:03 UTC (permalink / raw)
  To: Mark Brown
  Cc: iivanov-NEYub+7Iv8PQT0dZR+AlfA, gsi-ynQEQJNshbs,
	linux-spi-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

Zero length transfer becomes invalid since
"spi: core: Validate length of the transfers in message" commit,
but it should be valid to support an odd device, for example, which
requires long delay between chipselect and the first transfer, etc.

Signed-off-by: Atsushi Nemoto <anemo-7JcRY8pycbNHfZP73Gtkiw@public.gmane.org>
---
 drivers/spi/spi.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index c2605aa..454a523 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -1808,7 +1808,7 @@ static int __spi_validate(struct spi_device *spi, struct spi_message *message)
 {
 	struct spi_master *master = spi->master;
 	struct spi_transfer *xfer;
-	int w_size, n_words;
+	int w_size;
 
 	if (list_empty(&message->transfers))
 		return -EINVAL;
@@ -1871,9 +1871,8 @@ static int __spi_validate(struct spi_device *spi, struct spi_message *message)
 		else
 			w_size = 4;
 
-		n_words = xfer->len / w_size;
 		/* No partial transfers accepted */
-		if (!n_words || xfer->len % w_size)
+		if (xfer->len % w_size)
 			return -EINVAL;
 
 		if (xfer->speed_hz && master->min_speed_hz &&
-- 
1.7.9.5

--
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] 9+ messages in thread

end of thread, other threads:[~2014-03-03  8:26 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-28 14:03 [PATCH] spi: core: make zero length transfer valid again Atsushi Nemoto
2014-02-28 14:03 ` Atsushi Nemoto
     [not found] ` <1393596196-8652-1-git-send-email-anemo-7JcRY8pycbNHfZP73Gtkiw@public.gmane.org>
2014-03-01  4:13   ` Mark Brown
2014-03-01  4:13     ` Mark Brown
     [not found]     ` <20140301041330.GO29849-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2014-03-01 11:40       ` Martin Sperl
2014-03-01 11:40         ` Martin Sperl
     [not found]         ` <4D0588EB-C20C-4B24-B656-6175C2309352-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org>
2014-03-03  1:05           ` Mark Brown
2014-03-03  1:05             ` Mark Brown
2014-03-03  8:26 ` Thierry Reding

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.