public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Michael Auchter <michael.auchter@ni.com>
To: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: saravanak@google.com, robh+dt@kernel.org, frowand.list@gmail.com,
	gregkh@linuxfoundation.org, rafael@kernel.org,
	Michael Auchter <michael.auchter@ni.com>
Subject: [RFC PATCH 2/3] driver core: add device_links_barrier
Date: Wed, 14 Oct 2020 14:36:14 -0500	[thread overview]
Message-ID: <20201014193615.1045792-3-michael.auchter@ni.com> (raw)
In-Reply-To: <20201014193615.1045792-1-michael.auchter@ni.com>

Add a barrier to wait for all device_links SRCU sections to complete.

Signed-off-by: Michael Auchter <michael.auchter@ni.com>
---
 drivers/base/core.c    | 10 ++++++++++
 include/linux/device.h |  1 +
 2 files changed, 11 insertions(+)

diff --git a/drivers/base/core.c b/drivers/base/core.c
index bb5806a2bd4c..ef4429c4b1f2 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -82,6 +82,11 @@ int device_links_read_lock_held(void)
 {
 	return srcu_read_lock_held(&device_links_srcu);
 }
+
+void device_links_barrier(void)
+{
+	srcu_barrier(&device_links_srcu);
+}
 #else /* !CONFIG_SRCU */
 static DECLARE_RWSEM(device_links_lock);
 
@@ -112,6 +117,11 @@ int device_links_read_lock_held(void)
 	return lockdep_is_held(&device_links_lock);
 }
 #endif
+
+void device_links_barrier(void)
+{
+}
 #endif /* !CONFIG_SRCU */
 
 /**
diff --git a/include/linux/device.h b/include/linux/device.h
index 9e6ea8931a52..8c47e0beb308 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -977,6 +977,7 @@ void device_link_del(struct device_link *link);
 void device_link_remove(void *consumer, struct device *supplier);
 void device_links_supplier_sync_state_pause(void);
 void device_links_supplier_sync_state_resume(void);
+void device_links_barrier(void);
 
 extern __printf(3, 4)
 int dev_err_probe(const struct device *dev, int err, const char *fmt, ...);
-- 
2.25.4


  parent reply	other threads:[~2020-10-14 19:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-14 19:36 [RFC PATCH 0/3] Fix errors on DT overlay removal with devlinks Michael Auchter
2020-10-14 19:36 ` [RFC PATCH 1/3] of: unittest: add test of overlay " Michael Auchter
2020-10-14 19:36 ` Michael Auchter [this message]
2020-10-14 19:36 ` [RFC PATCH 3/3] of: dynamic: add device links barrier before detach Michael Auchter
2020-10-15 21:34 ` [RFC PATCH 0/3] Fix errors on DT overlay removal with devlinks Frank Rowand
2020-10-21 21:02 ` Frank Rowand
2020-10-26 19:10   ` Saravana Kannan
2020-10-28 16:25     ` Michael Auchter
2020-10-28 18:03       ` Saravana Kannan
2020-10-29 20:54       ` Frank Rowand
2020-10-29 21:13         ` Michael Auchter

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=20201014193615.1045792-3-michael.auchter@ni.com \
    --to=michael.auchter@ni.com \
    --cc=devicetree@vger.kernel.org \
    --cc=frowand.list@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=saravanak@google.com \
    /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