Port the helper to get the spi_device from the device_d from Linux.
This macro makes SPI device drivers look a bit nicer.

Signed-off-by: Michael Tretter <m.tret...@pengutronix.de>
---
Changelog:

v2:

- new patch
---
 include/spi/spi.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/spi/spi.h b/include/spi/spi.h
index bca996d8d8f9..c5ad6bd39ff9 100644
--- a/include/spi/spi.h
+++ b/include/spi/spi.h
@@ -108,6 +108,11 @@ struct spi_device {
         */
 };
 
+static inline struct spi_device *to_spi_device(struct device_d *dev)
+{
+        return dev ? container_of(dev, struct spi_device, dev) : NULL;
+}
+
 struct spi_message;
 
 /**
-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

Reply via email to