[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200716042053.1927676-2-saravanak@google.com>
Date: Wed, 15 Jul 2020 21:20:50 -0700
From: Saravana Kannan <saravanak@...gle.com>
To: Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Saravana Kannan <saravanak@...gle.com>,
Marek Szyprowski <m.szyprowski@...sung.com>,
John Stultz <john.stultz@...aro.org>,
linux-kernel@...r.kernel.org, kernel-team@...roid.com
Subject: [PATCH v3 1/4] driver core: Add dev_set_drv_sync_state()
This can be used by frameworks to set the sync_state() helper functions
for drivers that don't already have them set.
Signed-off-by: Saravana Kannan <saravanak@...gle.com>
---
include/linux/device.h | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/include/linux/device.h b/include/linux/device.h
index 15460a5ac024..2f56afdd9107 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -806,6 +806,18 @@ static inline bool dev_has_sync_state(struct device *dev)
return false;
}
+static inline int dev_set_drv_sync_state(struct device *dev,
+ void (*fn)(struct device *dev))
+{
+ if (!dev || !dev->driver)
+ return 0;
+ if (dev->driver->sync_state && dev->driver->sync_state != fn)
+ return -EBUSY;
+ if (!dev->driver->sync_state)
+ dev->driver->sync_state = fn;
+ return 0;
+}
+
/*
* High level routines for use by the bus drivers
*/
--
2.28.0.rc0.105.gf9edc3c819-goog
Powered by blists - more mailing lists