aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/linux
diff options
context:
space:
mode:
authorSaravana Kannan <saravanak@google.com>2020-02-21 00:05:09 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-03-04 13:46:03 +0100
commitac338acf514e7b578fa9e3742ec2c292323b4c1a (patch)
treefcfb2d4b490a901bf76163edfb98ebb6efe73a00 /include/linux
parentdriver core: Call sync_state() even if supplier has no consumers (diff)
downloadwireguard-linux-ac338acf514e7b578fa9e3742ec2c292323b4c1a.tar.xz
wireguard-linux-ac338acf514e7b578fa9e3742ec2c292323b4c1a.zip
driver core: Add dev_has_sync_state()
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>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/device.h11
1 files changed, 11 insertions, 0 deletions
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
*/