aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi
diff options
context:
space:
mode:
authorDavid Brownell <david-b@pacbell.net>2006-12-29 19:48:39 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-30 13:56:42 -0500
commit4b1badf5d9ddfc46ad075ca5bfc465972c85cc7c (patch)
tree36c44e9fce920d0da6f076901b3ed8bcc5305d8c /drivers/spi
parentd6e88e671ac12888df2d533dd4ddef705431a32a (diff)
[PATCH] SPI: define null tx_buf to mean "shift out zeroes"
Some issues were recently turned up with the current specification of what it means for spi_transfer.tx_buf to be null, as part of transfers which are (from the SPI protocol driver perspective) pure reads. Specifically, that it seems better to change the TX behaviour there from "undefined" to "will shift zeroes". This lets protocol drivers (like the ads7846 driver) depend on that behavior. It's what most controller drivers in the tree are already doing (with one exception and one case of driver wanting-to-oops), it's what Microwire hardware will necessarily be doing, and it removes an issue whereby certain security audits would need to define such a value anyway as part of removing covert channels. This patch changes the specification to require shifting zeroes, and updates all currently merged SPI controller drivers to do so. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Kumar Gala <galak@kernel.crashing.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/spi_mpc83xx.c2
-rw-r--r--drivers/spi/spi_s3c24xx.c2
2 files changed, 3 insertions, 1 deletions
diff --git a/drivers/spi/spi_mpc83xx.c b/drivers/spi/spi_mpc83xx.c
index ff0b04895db0..e9798bf7b8c6 100644
--- a/drivers/spi/spi_mpc83xx.c
+++ b/drivers/spi/spi_mpc83xx.c
@@ -112,6 +112,8 @@ u32 mpc83xx_spi_tx_buf_##type(struct mpc83xx_spi *mpc83xx_spi) \
112{ \ 112{ \
113 u32 data; \ 113 u32 data; \
114 const type * tx = mpc83xx_spi->tx; \ 114 const type * tx = mpc83xx_spi->tx; \
115 if (!tx) \
116 return 0; \
115 data = *tx++; \ 117 data = *tx++; \
116 mpc83xx_spi->tx = tx; \ 118 mpc83xx_spi->tx = tx; \
117 return data; \ 119 return data; \
diff --git a/drivers/spi/spi_s3c24xx.c b/drivers/spi/spi_s3c24xx.c
index 2ebe1fc4c398..8ca08713528e 100644
--- a/drivers/spi/spi_s3c24xx.c
+++ b/drivers/spi/spi_s3c24xx.c
@@ -174,7 +174,7 @@ static int s3c24xx_spi_setup(struct spi_device *spi)
174 174
175static inline unsigned int hw_txbyte(struct s3c24xx_spi *hw, int count) 175static inline unsigned int hw_txbyte(struct s3c24xx_spi *hw, int count)
176{ 176{
177 return hw->tx ? hw->tx[count] : 0xff; 177 return hw->tx ? hw->tx[count] : 0;
178} 178}
179 179
180static int s3c24xx_spi_txrx(struct spi_device *spi, struct spi_transfer *t) 180static int s3c24xx_spi_txrx(struct spi_device *spi, struct spi_transfer *t)