Skip to content

Commit

Permalink
driver core: Add dev_has_sync_state()
Browse files Browse the repository at this point in the history
commit ac338ac 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>
  • Loading branch information
Saravana Kannan authored and Greg Kroah-Hartman committed Mar 25, 2020
1 parent 7a5ab69 commit 6d88283
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions include/linux/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down

0 comments on commit 6d88283

Please sign in to comment.