]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
driver core: Add dev_has_sync_state()
authorSaravana Kannan <saravanak@google.com>
Fri, 21 Feb 2020 08:05:09 +0000 (00:05 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 25 Mar 2020 15:10:18 +0000 (16:10 +0100)
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>
include/linux/device.h

index 96ff76731e93df766d09394f8936254849e5b9b8..50d97767d8d6930803790e6bff7c12e908c87168 100644 (file)
@@ -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
  */