Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1423584

[PATCH] spi: add spi_sync_single_transfer wrapper for single spi_transfer

From Andi Shyti <andi.shyti@samsung.com>
Newsgroups linux.kernel
Subject [PATCH] spi: add spi_sync_single_transfer wrapper for single spi_transfer
Date 2016-06-16 01:50 +0200
Message-ID <rKsJj-HV-1@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


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@samsung.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

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] spi: add spi_sync_single_transfer wrapper for single  spi_transfer Andi Shyti <andi.shyti@samsung.com> - 2016-06-16 01:50 +0200
  Re: [PATCH] spi: add spi_sync_single_transfer wrapper for single  spi_transfer Lars-Peter Clausen <lars@metafoo.de> - 2016-06-16 18:20 +0200
    Re: [PATCH] spi: add spi_sync_single_transfer wrapper for single  spi_transfer Andi Shyti <andi.shyti@samsung.com> - 2016-06-17 02:50 +0200
      Re: [PATCH] spi: add spi_sync_single_transfer wrapper for single  spi_transfer Mark Brown <broonie@kernel.org> - 2016-06-17 13:40 +0200
        Re: [PATCH] spi: add spi_sync_single_transfer wrapper for single  spi_transfer Andi Shyti <andi@etezian.org> - 2016-06-17 13:50 +0200

csiph-web