Commit 0c4a1590 authored by Mark Brown's avatar Mark Brown Committed by Grant Likely

spi: Use void pointers for data in simple SPI I/O operations

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: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: default avatarGrant Likely <grant.likely@secretlab.ca>
parent 521999bd
...@@ -1047,8 +1047,8 @@ static u8 *buf; ...@@ -1047,8 +1047,8 @@ static u8 *buf;
* spi_{async,sync}() calls with dma-safe buffers. * spi_{async,sync}() calls with dma-safe buffers.
*/ */
int spi_write_then_read(struct spi_device *spi, int spi_write_then_read(struct spi_device *spi,
const u8 *txbuf, unsigned n_tx, const void *txbuf, unsigned n_tx,
u8 *rxbuf, unsigned n_rx) void *rxbuf, unsigned n_rx)
{ {
static DEFINE_MUTEX(lock); static DEFINE_MUTEX(lock);
......
...@@ -581,7 +581,7 @@ extern int spi_bus_unlock(struct spi_master *master); ...@@ -581,7 +581,7 @@ extern int spi_bus_unlock(struct spi_master *master);
* Callable only from contexts that can sleep. * Callable only from contexts that can sleep.
*/ */
static inline int 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 = { struct spi_transfer t = {
.tx_buf = buf, .tx_buf = buf,
...@@ -605,7 +605,7 @@ spi_write(struct spi_device *spi, const u8 *buf, size_t len) ...@@ -605,7 +605,7 @@ spi_write(struct spi_device *spi, const u8 *buf, size_t len)
* Callable only from contexts that can sleep. * Callable only from contexts that can sleep.
*/ */
static inline int 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 = { struct spi_transfer t = {
.rx_buf = buf, .rx_buf = buf,
...@@ -620,8 +620,8 @@ spi_read(struct spi_device *spi, u8 *buf, size_t len) ...@@ -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! */ /* this copies txbuf and rxbuf data; for small transfers only! */
extern int spi_write_then_read(struct spi_device *spi, extern int spi_write_then_read(struct spi_device *spi,
const u8 *txbuf, unsigned n_tx, const void *txbuf, unsigned n_tx,
u8 *rxbuf, unsigned n_rx); void *rxbuf, unsigned n_rx);
/** /**
* spi_w8r8 - SPI synchronous 8 bit write followed by 8 bit read * spi_w8r8 - SPI synchronous 8 bit write followed by 8 bit read
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment