summaryrefslogtreecommitdiffstats
path: root/drivers/base/base.h
diff options
context:
space:
mode:
authorSaravana Kannan <saravanak@google.com>2023-03-04 01:53:54 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-03-10 09:06:22 +0100
commitf8fb576658a3e19796e2e1a12a5ec8f44dac02b6 (patch)
tree754eb365da8989ddeebdd90206ee61ef7f799246 /drivers/base/base.h
parentdriver core: Add fw_devlink.sync_state command line param (diff)
downloadlinux-f8fb576658a3e19796e2e1a12a5ec8f44dac02b6.tar.xz
linux-f8fb576658a3e19796e2e1a12a5ec8f44dac02b6.zip
driver core: Make state_synced device attribute writeable
If the file is written to and sync_state() hasn't been called for the device yet, then call sync_state() for the device independent of the state of its consumers. This is useful for supplier devices that have one or more consumers that don't have a driver but the consumers are in a state that don't use the resources supplied by the supplier device. This gives finer grained control than using the fw_devlink.sync_state=timeout kernel commandline parameter. Signed-off-by: Saravana Kannan <saravanak@google.com> Link: https://lore.kernel.org/r/20230304005355.746421-3-saravanak@google.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base/base.h')
-rw-r--r--drivers/base/base.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/base/base.h b/drivers/base/base.h
index 6fcd71803d35..b055eba1ec30 100644
--- a/drivers/base/base.h
+++ b/drivers/base/base.h
@@ -164,6 +164,14 @@ static inline int driver_match_device(struct device_driver *drv,
return drv->bus->match ? drv->bus->match(dev, drv) : 1;
}
+static inline void dev_sync_state(struct device *dev)
+{
+ if (dev->bus->sync_state)
+ dev->bus->sync_state(dev);
+ else if (dev->driver && dev->driver->sync_state)
+ dev->driver->sync_state(dev);
+}
+
extern int driver_add_groups(struct device_driver *drv,
const struct attribute_group **groups);
extern void driver_remove_groups(struct device_driver *drv,