All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] spi: Use void pointers for data in simple SPI I/O operations
@ 2011-05-10 22:09 Mark Brown
  2011-05-19 19:00 ` Grant Likely
  0 siblings, 1 reply; 2+ messages in thread
From: Mark Brown @ 2011-05-10 22:09 UTC (permalink / raw)
  To: Grant Likely; +Cc: spi-devel-general, linux-kernel, patches, Mark Brown

Currently the simple SPI I/O operations all take pointers to u8 * buffers
to operate on. This creates needless type compatibility issues and the
underlying spi_transfer structure uses void pointers anyway so convert the
API over to take void pointers too.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 drivers/spi/spi.c       |    4 ++--
 include/linux/spi/spi.h |    8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 82b9a42..2e13a14 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -1047,8 +1047,8 @@ static u8	*buf;
  * spi_{async,sync}() calls with dma-safe buffers.
  */
 int spi_write_then_read(struct spi_device *spi,
-		const u8 *txbuf, unsigned n_tx,
-		u8 *rxbuf, unsigned n_rx)
+		const void *txbuf, unsigned n_tx,
+		void *rxbuf, unsigned n_rx)
 {
 	static DEFINE_MUTEX(lock);
 
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index b4d7710..bb4f5fb 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -581,7 +581,7 @@ extern int spi_bus_unlock(struct spi_master *master);
  * Callable only from contexts that can sleep.
  */
 static inline int
-spi_write(struct spi_device *spi, const u8 *buf, size_t len)
+spi_write(struct spi_device *spi, const void *buf, size_t len)
 {
 	struct spi_transfer	t = {
 			.tx_buf		= buf,
@@ -605,7 +605,7 @@ spi_write(struct spi_device *spi, const u8 *buf, size_t len)
  * Callable only from contexts that can sleep.
  */
 static inline int
-spi_read(struct spi_device *spi, u8 *buf, size_t len)
+spi_read(struct spi_device *spi, void *buf, size_t len)
 {
 	struct spi_transfer	t = {
 			.rx_buf		= buf,
@@ -620,8 +620,8 @@ spi_read(struct spi_device *spi, u8 *buf, size_t len)
 
 /* this copies txbuf and rxbuf data; for small transfers only! */
 extern int spi_write_then_read(struct spi_device *spi,
-		const u8 *txbuf, unsigned n_tx,
-		u8 *rxbuf, unsigned n_rx);
+		const void *txbuf, unsigned n_tx,
+		void *rxbuf, unsigned n_rx);
 
 /**
  * spi_w8r8 - SPI synchronous 8 bit write followed by 8 bit read
-- 
1.7.5.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] spi: Use void pointers for data in simple SPI I/O operations
  2011-05-10 22:09 [PATCH] spi: Use void pointers for data in simple SPI I/O operations Mark Brown
@ 2011-05-19 19:00 ` Grant Likely
  0 siblings, 0 replies; 2+ messages in thread
From: Grant Likely @ 2011-05-19 19:00 UTC (permalink / raw)
  To: Mark Brown; +Cc: spi-devel-general, linux-kernel, patches

On Wed, May 11, 2011 at 12:09:30AM +0200, Mark Brown wrote:
> Currently the simple SPI I/O operations all take pointers to u8 * buffers
> to operate on. This creates needless type compatibility issues and the
> underlying spi_transfer structure uses void pointers anyway so convert the
> API over to take void pointers too.
> 
> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

Merged, thanks.

g.

> ---
>  drivers/spi/spi.c       |    4 ++--
>  include/linux/spi/spi.h |    8 ++++----
>  2 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
> index 82b9a42..2e13a14 100644
> --- a/drivers/spi/spi.c
> +++ b/drivers/spi/spi.c
> @@ -1047,8 +1047,8 @@ static u8	*buf;
>   * spi_{async,sync}() calls with dma-safe buffers.
>   */
>  int spi_write_then_read(struct spi_device *spi,
> -		const u8 *txbuf, unsigned n_tx,
> -		u8 *rxbuf, unsigned n_rx)
> +		const void *txbuf, unsigned n_tx,
> +		void *rxbuf, unsigned n_rx)
>  {
>  	static DEFINE_MUTEX(lock);
>  
> diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
> index b4d7710..bb4f5fb 100644
> --- a/include/linux/spi/spi.h
> +++ b/include/linux/spi/spi.h
> @@ -581,7 +581,7 @@ extern int spi_bus_unlock(struct spi_master *master);
>   * Callable only from contexts that can sleep.
>   */
>  static inline int
> -spi_write(struct spi_device *spi, const u8 *buf, size_t len)
> +spi_write(struct spi_device *spi, const void *buf, size_t len)
>  {
>  	struct spi_transfer	t = {
>  			.tx_buf		= buf,
> @@ -605,7 +605,7 @@ spi_write(struct spi_device *spi, const u8 *buf, size_t len)
>   * Callable only from contexts that can sleep.
>   */
>  static inline int
> -spi_read(struct spi_device *spi, u8 *buf, size_t len)
> +spi_read(struct spi_device *spi, void *buf, size_t len)
>  {
>  	struct spi_transfer	t = {
>  			.rx_buf		= buf,
> @@ -620,8 +620,8 @@ spi_read(struct spi_device *spi, u8 *buf, size_t len)
>  
>  /* this copies txbuf and rxbuf data; for small transfers only! */
>  extern int spi_write_then_read(struct spi_device *spi,
> -		const u8 *txbuf, unsigned n_tx,
> -		u8 *rxbuf, unsigned n_rx);
> +		const void *txbuf, unsigned n_tx,
> +		void *rxbuf, unsigned n_rx);
>  
>  /**
>   * spi_w8r8 - SPI synchronous 8 bit write followed by 8 bit read
> -- 
> 1.7.5.1
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-05-19 19:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-10 22:09 [PATCH] spi: Use void pointers for data in simple SPI I/O operations Mark Brown
2011-05-19 19:00 ` Grant Likely

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.