From: Atsushi Nemoto <anemo@mba.ocn.ne.jp> To: Mark Brown <broonie@kernel.org> Cc: iivanov@mm-sol.com, gsi@denx.de, linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] spi: core: make zero length transfer valid again Date: Fri, 28 Feb 2014 23:03:16 +0900 [thread overview] Message-ID: <1393596196-8652-1-git-send-email-anemo@mba.ocn.ne.jp> (raw) 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@mba.ocn.ne.jp> --- 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
WARNING: multiple messages have this Message-ID (diff)
From: Atsushi Nemoto <anemo-7JcRY8pycbNHfZP73Gtkiw@public.gmane.org> To: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> Cc: iivanov-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org, gsi-ynQEQJNshbs@public.gmane.org, linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Subject: [PATCH] spi: core: make zero length transfer valid again Date: Fri, 28 Feb 2014 23:03:16 +0900 [thread overview] Message-ID: <1393596196-8652-1-git-send-email-anemo@mba.ocn.ne.jp> (raw) 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
next reply other threads:[~2014-02-28 14:03 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-02-28 14:03 Atsushi Nemoto [this message] 2014-02-28 14:03 ` [PATCH] spi: core: make zero length transfer valid again Atsushi Nemoto 2014-03-01 4:13 ` Mark Brown 2014-03-01 4:13 ` Mark Brown 2014-03-01 11:40 ` Martin Sperl 2014-03-01 11:40 ` Martin Sperl 2014-03-03 1:05 ` Mark Brown 2014-03-03 1:05 ` Mark Brown 2014-03-03 8:26 ` Thierry Reding
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=1393596196-8652-1-git-send-email-anemo@mba.ocn.ne.jp \ --to=anemo@mba.ocn.ne.jp \ --cc=broonie@kernel.org \ --cc=gsi@denx.de \ --cc=iivanov@mm-sol.com \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-spi@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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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.