mirror of
https://github.com/torvalds/linux.git
synced 2026-05-23 22:52:19 +02:00
driver core: Add dev_set_drv_sync_state()
This can be used by frameworks to set the sync_state() helper functions for drivers that don't already have them set. Signed-off-by: Saravana Kannan <saravanak@google.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Abel Vesa <abel.vesa@linaro.org> Tested-by: Hiago De Franco <hiago.franco@toradex.com> # Colibri iMX8X Tested-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> # TI AM62A,Xilinx ZynqMP ZCU106 Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Link: https://lore.kernel.org/r/20250701114733.636510-20-ulf.hansson@linaro.org
This commit is contained in:
parent
3b7b8acacf
commit
2b5630e988
|
|
@ -917,6 +917,18 @@ static inline bool dev_has_sync_state(struct device *dev)
|
|||
return false;
|
||||
}
|
||||
|
||||
static inline int dev_set_drv_sync_state(struct device *dev,
|
||||
void (*fn)(struct device *dev))
|
||||
{
|
||||
if (!dev || !dev->driver)
|
||||
return 0;
|
||||
if (dev->driver->sync_state && dev->driver->sync_state != fn)
|
||||
return -EBUSY;
|
||||
if (!dev->driver->sync_state)
|
||||
dev->driver->sync_state = fn;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void dev_set_removable(struct device *dev,
|
||||
enum device_removable removable)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user