From: Saravana Kannan <saravanak@google.com>
To: Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Saravana Kannan <saravanak@google.com>,
John Stultz <john.stultz@linaro.org>,
linux-kernel@vger.kernel.org, kernel-team@android.com
Subject: [PATCH v2 1/2] driver core: Add dev_set_drv_sync_state()
Date: Thu, 28 May 2020 12:06:09 -0700 [thread overview]
Message-ID: <20200528190610.179984-2-saravanak@google.com> (raw)
In-Reply-To: <20200528190610.179984-1-saravanak@google.com>
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@google.com>
---
I'm hoping I can drop this patch based on discussions in patch 1/2.
include/linux/device.h | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/include/linux/device.h b/include/linux/device.h
index ac8e37cd716a..aac548beb154 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.27.0.rc0.183.gde8f92d652-goog
next prev parent reply other threads:[~2020-05-28 19:06 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-28 19:06 [PATCH v2 0/2] regulator_sync_state() support Saravana Kannan
2020-05-28 19:06 ` Saravana Kannan [this message]
2020-05-28 19:06 ` [PATCH v2 2/2] regulator: Add support for sync_state() callbacks Saravana Kannan
2020-05-29 13:00 ` Mark Brown
2020-05-30 2:39 ` Saravana Kannan
2020-06-01 17:23 ` Mark Brown
2020-06-09 3:16 ` Saravana Kannan
2020-06-09 10:51 ` Mark Brown
2020-06-15 10:27 ` Ulf Hansson
2020-06-15 11:49 ` Mark Brown
2020-06-15 15:37 ` Ulf Hansson
2020-05-29 13:09 ` [PATCH v2 0/2] regulator_sync_state() support Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200528190610.179984-2-saravanak@google.com \
--to=saravanak@google.com \
--cc=broonie@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=john.stultz@linaro.org \
--cc=kernel-team@android.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).