From: Saravana Kannan <saravanak@google.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>
Cc: Saravana Kannan <saravanak@google.com>,
kernel-team@android.com, linux-clk@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH v1 1/2] driver core: Add dev_set_drv_sync_state()
Date: Tue, 6 Apr 2021 20:44:54 -0700 [thread overview]
Message-ID: <20210407034456.516204-2-saravanak@google.com> (raw)
In-Reply-To: <20210407034456.516204-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>
---
include/linux/device.h | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/include/linux/device.h b/include/linux/device.h
index ba660731bd25..35e8833ca16b 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -778,6 +778,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.31.1.295.g9ea45b61b8-goog
next prev parent reply other threads:[~2021-04-07 3:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-07 3:44 [PATCH v1 0/2] Add sync_state() support to clock framework Saravana Kannan
2021-04-07 3:44 ` Saravana Kannan [this message]
2021-04-08 6:41 ` [PATCH v1 1/2] driver core: Add dev_set_drv_sync_state() Greg Kroah-Hartman
2021-04-07 3:44 ` [PATCH v1 2/2] clk: Add support for sync_state() Saravana Kannan
2021-04-14 17:45 ` Saravana Kannan
2021-06-25 22:37 ` Stephen Boyd
2023-05-09 7:16 ` Abel Vesa
2021-04-08 0:29 ` [PATCH v1 0/2] Add sync_state() support to clock framework Stephen Boyd
2021-04-08 6:41 ` Greg Kroah-Hartman
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=20210407034456.516204-2-saravanak@google.com \
--to=saravanak@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=kernel-team@android.com \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=sboyd@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).