From fb887db2bdeaf42630436a28d62deba5572f7217 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Tue, 7 Mar 2023 16:14:19 +0100 Subject: 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 --- include/driver.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include') 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 */ -- cgit v1.2.1