summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2023-03-07 16:14:19 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2023-03-10 10:28:37 +0100
commitfb887db2bdeaf42630436a28d62deba5572f7217 (patch)
treed8e5f80f36cfb215dae1f37a79e6fb4b65b135cc /include
parent3610ec11f72b464c900bddd8bfdf12b58c70ea03 (diff)
downloadbarebox-fb887db2bdeaf42630436a28d62deba5572f7217.tar.gz
driver: Add rescan hook to struct device
When devices are enabled with a device tree overlay the newly enabled devices can be probed by doing a of_probe(). This works fine for the regular platform devices, but doesn't work for devices which are not probed by the core, but by the subsystem. Prominent examples are I2C or SPI devices. This patch adds a struct device::rescan hook that subsystems can implement to trigger rescanning the device nodes. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include')
-rw-r--r--include/driver.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/driver.h b/include/driver.h
index f53668711b..2cf0190699 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -91,6 +91,7 @@ struct device {
* when the driver should actually detect client devices
*/
int (*detect) (struct device *);
+ void (*rescan) (struct device *);
/*
* if a driver probe is deferred, this stores the last error
@@ -158,6 +159,11 @@ static inline void put_device(struct device *dev) {}
void free_device_res(struct device *dev);
void free_device(struct device *dev);
+static inline void device_rescan(struct device *dev)
+{
+ if (dev->rescan)
+ dev->rescan(dev);
+}
/* Iterate over a devices children
*/