[PATCH] SPI: spi bounce buffer has a minimum length
authorDavid Brownell <david-b@pacbell.net>
Sun, 2 Apr 2006 18:37:40 +0000 (10:37 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 16 May 2006 21:33:57 +0000 (14:33 -0700)
Make sure that spi_write_then_read() can always handle at least 32 bytes
of transfer (total, both directions), minimizing one portability issue.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/spi/spi.c

index 94f5e8ed83a7a8427105201aaa81f14ff5c710c7..1168ef015887ebddcb6a36852ab39913e05b5394 100644 (file)
@@ -522,7 +522,8 @@ int spi_sync(struct spi_device *spi, struct spi_message *message)
 }
 EXPORT_SYMBOL_GPL(spi_sync);
 
-#define        SPI_BUFSIZ      (SMP_CACHE_BYTES)
+/* portable code must never pass more than 32 bytes */
+#define        SPI_BUFSIZ      max(32,SMP_CACHE_BYTES)
 
 static u8      *buf;