summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorBeniamino Galvani <b.galvani@gmail.com>2014-11-22 16:21:39 +0100
committerMark Brown <broonie@kernel.org>2014-11-24 19:53:42 +0100
commitb671358ad7916beb7ca9e5c304ae88afc7da4557 (patch)
treeee79ebf66aa09c33baac5530127674c8fc5b9ad3 /include
parentLinux 3.18-rc6 (diff)
downloadlinux-b671358ad7916beb7ca9e5c304ae88afc7da4557.tar.xz
linux-b671358ad7916beb7ca9e5c304ae88afc7da4557.zip
spi: core: Add spi_transfer_is_last() helper
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> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/spi/spi.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 46d188a9947c..a6ef2a8e6de4 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 */