diff options
author | Atsushi Nemoto <anemo@mba.ocn.ne.jp> | 2014-02-28 14:03:16 (GMT) |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-03-04 03:22:09 (GMT) |
commit | 6ea312936d68b557766dafa9a3c4617e14ffa076 (patch) | |
tree | 465f4ba66d9591188ce7dae1c6a92de195b44062 /drivers/spi/spi.c | |
parent | f97b26b05b1dcd307b2f79d1f9e9d99551987dbb (diff) | |
download | linux-6ea312936d68b557766dafa9a3c4617e14ffa076.tar.xz |
spi: core: make zero length transfer valid again
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>
Tested-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers/spi/spi.c')
-rw-r--r-- | drivers/spi/spi.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index d5ee965..9d14054 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -1617,7 +1617,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; @@ -1680,9 +1680,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 && |