diff options
author | Saravana Kannan <saravanak@google.com> | 2020-02-21 00:05:09 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-03-25 16:10:18 +0100 |
commit | 6d88283a49425eb469aa60ffebe76539e73c933e (patch) | |
tree | 130c7da87a263716be058d58cc71aae20f74b35d | |
parent | 7a5ab69495d1a1cd7489abccc7eb6855dba792a4 (diff) |
driver core: Add dev_has_sync_state()
commit ac338acf514e7b578fa9e3742ec2c292323b4c1a upstream.
Add an API to check if a device has sync_state support in its driver or
bus.
Signed-off-by: Saravana Kannan <saravanak@google.com>
Link: https://lore.kernel.org/r/20200221080510.197337-3-saravanak@google.com
Cc: Davide Caratti <dcaratti@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | include/linux/device.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/device.h b/include/linux/device.h index 96ff76731e93..50d97767d8d6 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -1522,6 +1522,17 @@ static inline struct device_node *dev_of_node(struct device *dev) void driver_init(void); +static inline bool dev_has_sync_state(struct device *dev) +{ + if (!dev) + return false; + if (dev->driver && dev->driver->sync_state) + return true; + if (dev->bus && dev->bus->sync_state) + return true; + return false; +} + /* * High level routines for use by the bus drivers */ |