diff mbox

[v3,1/4] spi: core: Add spi_transfer_is_last() helper

Message ID 1416669702-7841-2-git-send-email-b.galvani@gmail.com (mailing list archive)
State Accepted
Commit b671358ad7916beb7ca9e5c304ae88afc7da4557
Headers show

Commit Message

Beniamino Galvani Nov. 22, 2014, 3:21 p.m. UTC
This adds the function spi_transfer_is_last() which can be used by
drivers to know whether a given transfer is the last one in the
current message.

Signed-off-by: Beniamino Galvani <b.galvani@gmail.com>
---
 include/linux/spi/spi.h | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Mark Brown Nov. 24, 2014, 6:53 p.m. UTC | #1
On Sat, Nov 22, 2014 at 04:21:39PM +0100, Beniamino Galvani wrote:
> This adds the function spi_transfer_is_last() which can be used by
> drivers to know whether a given transfer is the last one in the
> current message.

Applied, thanks.
diff mbox

Patch

diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 46d188a..a6ef2a8 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -1049,4 +1049,10 @@  spi_unregister_device(struct spi_device *spi)
 extern const struct spi_device_id *
 spi_get_device_id(const struct spi_device *sdev);
 
+static inline bool
+spi_transfer_is_last(struct spi_master *master, struct spi_transfer *xfer)
+{
+	return list_is_last(&xfer->transfer_list, &master->cur_msg->transfers);
+}
+
 #endif /* __LINUX_SPI_H */