[PATCH 03/12] spi: add spi_{set,get}_ctldata accessors
Marco Felsch
m.felsch at pengutronix.de
Fri Nov 15 11:57:38 PST 2024
We alreary support the controller_state priv data pointer, add the Linux
APIs to set/get the data.
Signed-off-by: Marco Felsch <m.felsch at pengutronix.de>
---
include/spi/spi.h | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/include/spi/spi.h b/include/spi/spi.h
index 622de732fa6d..9261d508befd 100644
--- a/include/spi/spi.h
+++ b/include/spi/spi.h
@@ -116,6 +116,17 @@ static inline struct spi_device *to_spi_device(struct device *dev)
return dev ? container_of(dev, struct spi_device, dev) : NULL;
}
+/* ctldata is for the bus_controller driver's runtime state */
+static inline void *spi_get_ctldata(const struct spi_device *spi)
+{
+ return spi->controller_state;
+}
+
+static inline void spi_set_ctldata(struct spi_device *spi, void *state)
+{
+ spi->controller_state = state;
+}
+
/**
* struct spi_controller - interface to SPI master or slave controller
* @dev: device interface to this driver
--
2.39.5
More information about the barebox
mailing list