From 4b1badf5d9ddfc46ad075ca5bfc465972c85cc7c Mon Sep 17 00:00:00 2001 From: David Brownell Date: Fri, 29 Dec 2006 16:48:39 -0800 Subject: [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 Signed-off-by: Kumar Gala Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/linux/spi/spi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/linux/spi') diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index c8bb68099eb9..176f6e36dbfa 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -289,7 +289,7 @@ extern struct spi_master *spi_busnum_to_master(u16 busnum); * the data being transferred; that may reduce overhead, when the * underlying driver uses dma. * - * If the transmit buffer is null, undefined data will be shifted out + * If the transmit buffer is null, zeroes will be shifted out * while filling rx_buf. If the receive buffer is null, the data * shifted in will be discarded. Only "len" bytes shift out (or in). * It's an error to try to shift out a partial word. (For example, by -- cgit v1.2.1 From 2943ecf2ed32632473c06f1975db47a7aa98c10f Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 22 Jan 2007 13:45:38 -0800 Subject: Driver core: convert SPI code to use struct device Converts from using struct "class_device" to "struct device" making everything show up properly in /sys/devices/ with symlinks from the /sys/class directory. Cc: Signed-off-by: Greg Kroah-Hartman --- include/linux/spi/spi.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'include/linux/spi') diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 176f6e36dbfa..8c2edd82a073 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -170,7 +170,7 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv) * message's completion function when the transaction completes. */ struct spi_master { - struct class_device cdev; + struct device dev; /* other than negative (== assign one dynamically), bus_num is fully * board-specific. usually that simplifies to being SOC-specific. @@ -216,17 +216,17 @@ struct spi_master { static inline void *spi_master_get_devdata(struct spi_master *master) { - return class_get_devdata(&master->cdev); + return dev_get_drvdata(&master->dev); } static inline void spi_master_set_devdata(struct spi_master *master, void *data) { - class_set_devdata(&master->cdev, data); + dev_set_drvdata(&master->dev, data); } static inline struct spi_master *spi_master_get(struct spi_master *master) { - if (!master || !class_device_get(&master->cdev)) + if (!master || !get_device(&master->dev)) return NULL; return master; } @@ -234,7 +234,7 @@ static inline struct spi_master *spi_master_get(struct spi_master *master) static inline void spi_master_put(struct spi_master *master) { if (master) - class_device_put(&master->cdev); + put_device(&master->dev); } -- cgit v1.2.1 From 07b2463046247ce580ff9b37e91394f2f6424768 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 7 Feb 2007 21:34:08 -0800 Subject: Revert "Driver core: convert SPI code to use struct device" This reverts commit 2943ecf2ed32632473c06f1975db47a7aa98c10f. This should go through the SPI maintainer, it was my fault that it did not. Especially as it conflicts with other patches he has pending. Signed-off-by: Greg Kroah-Hartman --- include/linux/spi/spi.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'include/linux/spi') diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 8c2edd82a073..176f6e36dbfa 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -170,7 +170,7 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv) * message's completion function when the transaction completes. */ struct spi_master { - struct device dev; + struct class_device cdev; /* other than negative (== assign one dynamically), bus_num is fully * board-specific. usually that simplifies to being SOC-specific. @@ -216,17 +216,17 @@ struct spi_master { static inline void *spi_master_get_devdata(struct spi_master *master) { - return dev_get_drvdata(&master->dev); + return class_get_devdata(&master->cdev); } static inline void spi_master_set_devdata(struct spi_master *master, void *data) { - dev_set_drvdata(&master->dev, data); + class_set_devdata(&master->cdev, data); } static inline struct spi_master *spi_master_get(struct spi_master *master) { - if (!master || !get_device(&master->dev)) + if (!master || !class_device_get(&master->cdev)) return NULL; return master; } @@ -234,7 +234,7 @@ static inline struct spi_master *spi_master_get(struct spi_master *master) static inline void spi_master_put(struct spi_master *master) { if (master) - put_device(&master->dev); + class_device_put(&master->cdev); } -- cgit v1.2.1