aboutsummaryrefslogtreecommitdiff
path: root/drivers/base
diff options
context:
space:
mode:
authorMark Brown2018-08-10 17:31:24 +0100
committerMark Brown2018-08-10 17:31:24 +0100
commitd22d59362b7b2c749245f1269d447011c76ca41d (patch)
treeb3fc0673f62394dc5ed417eac6bad485a28baf25 /drivers/base
parenta8afa92ec0d9312b23fd291aa8db95da266f2d5f (diff)
parent46fc033eba42f5a4fb583b2ab53f0a9918468452 (diff)
Merge branch 'regulator-4.19' into regulator-next
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/core.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c
index df3e1a44707a..2ab316d85651 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -372,6 +372,36 @@ void device_link_del(struct device_link *link)
}
EXPORT_SYMBOL_GPL(device_link_del);
+/**
+ * device_link_remove - remove a link between two devices.
+ * @consumer: Consumer end of the link.
+ * @supplier: Supplier end of the link.
+ *
+ * The caller must ensure proper synchronization of this function with runtime
+ * PM.
+ */
+void device_link_remove(void *consumer, struct device *supplier)
+{
+ struct device_link *link;
+
+ if (WARN_ON(consumer == supplier))
+ return;
+
+ device_links_write_lock();
+ device_pm_lock();
+
+ list_for_each_entry(link, &supplier->links.consumers, s_node) {
+ if (link->consumer == consumer) {
+ kref_put(&link->kref, __device_link_del);
+ break;
+ }
+ }
+
+ device_pm_unlock();
+ device_links_write_unlock();
+}
+EXPORT_SYMBOL_GPL(device_link_remove);
+
static void device_links_missing_supplier(struct device *dev)
{
struct device_link *link;