From 6d88283a49425eb469aa60ffebe76539e73c933e Mon Sep 17 00:00:00 2001 From: Saravana Kannan Date: Fri, 21 Feb 2020 00:05:09 -0800 Subject: [PATCH] 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 Link: https://lore.kernel.org/r/20200221080510.197337-3-saravanak@google.com Cc: Davide Caratti Signed-off-by: Greg Kroah-Hartman --- include/linux/device.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/linux/device.h b/include/linux/device.h index 96ff76731e93d..50d97767d8d69 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 */