[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-id: <1466034046-718-1-git-send-email-andi.shyti@samsung.com>
Date: Thu, 16 Jun 2016 08:40:46 +0900
From: Andi Shyti <andi.shyti@...sung.com>
To: Mark Brown <broonie@...nel.org>
Cc: linux-spi@...r.kernel.org, linux-kernel@...r.kernel.org,
Andi Shyti <andi.shyti@...sung.com>,
Andi Shyti <andi@...zian.org>
Subject: [PATCH] spi: add spi_sync_single_transfer wrapper for single
spi_transfer
The spi_sync_single_transfer function calls spi_sync_transfer
with a single spi_transfer element, instead of an array.
Signed-off-by: Andi Shyti <andi.shyti@...sung.com>
---
include/linux/spi/spi.h | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 1f03483..660f6a1 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -1051,6 +1051,24 @@ spi_sync_transfer(struct spi_device *spi, struct spi_transfer *xfers,
return spi_sync(spi, &msg);
}
+/**
+ * spi_sync_single_transfer - synchronous SPI data transfer of one spi_transfer
+ * @spi: device with which data will be exchanged
+ * @xfers: One spi_transfer struct
+ * Context: can sleep
+ *
+ * Does a synchronous SPI data transfer of a given spi_transfer.
+ *
+ * For more specific semantics see spi_sync_transfer().
+ *
+ * It returns zero on success, else a negative error code.
+ */
+static inline int
+spi_sync_single_transfer(struct spi_device *spi, struct spi_transfer *xfers)
+{
+ return spi_sync_transfer(spi, xfers, 1);
+}
+
/* this copies txbuf and rxbuf data; for small transfers only! */
extern int spi_write_then_read(struct spi_device *spi,
const void *txbuf, unsigned n_tx,
--
2.8.1
Powered by blists - more mailing lists