]> git.karo-electronics.de Git - linux-beck.git/commitdiff
spi: core: make zero length transfer valid again
authorAtsushi Nemoto <anemo@mba.ocn.ne.jp>
Fri, 28 Feb 2014 14:03:16 +0000 (23:03 +0900)
committerMark Brown <broonie@linaro.org>
Tue, 4 Mar 2014 03:22:09 +0000 (11:22 +0800)
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>
drivers/spi/spi.c

index d5ee965fb285944bcb9f33cbd55484e4f7794e17..9d1405440223a9c85325034c72acfe80d1fddcbf 100644 (file)
@@ -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 &&