[PATCH v2 2/3] driver core: Add dev_has_sync_state()

From: Saravana Kannan
Date: Fri Feb 21 2020 - 03:05:29 EST


Add an API to check if a device has sync_state support in its driver or
bus.

Signed-off-by: Saravana Kannan <saravanak@xxxxxxxxxx>
---
include/linux/device.h | 11 +++++++++++
1 file changed, 11 insertions(+)

diff --git a/include/linux/device.h b/include/linux/device.h
index 0cd7c647c16c..fa04dfd22bbc 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -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
*/
--
2.25.0.265.gbab2e86ba0-goog