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, 4 Mar 2020 12:46:03 +0000 (13:46 +0100)
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
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/linux/device.h

index 0cd7c64..fa04dfd 100644 (file)
@@ -798,6 +798,17 @@ static inline struct device_node *dev_of_node(struct device *dev)
        return dev->of_node;
 }
 
+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
  */