[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201121020232.908850-10-saravanak@google.com>
Date: Fri, 20 Nov 2020 18:02:24 -0800
From: Saravana Kannan <saravanak@...gle.com>
To: "Rafael J. Wysocki" <rjw@...ysocki.net>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Len Brown <lenb@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Ard Biesheuvel <ardb@...nel.org>,
Rob Herring <robh+dt@...nel.org>,
Frank Rowand <frowand.list@...il.com>,
Marc Zyngier <maz@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>
Cc: Saravana Kannan <saravanak@...gle.com>,
Tomi Valkeinen <tomi.valkeinen@...com>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>,
Grygorii Strashko <grygorii.strashko@...com>,
kernel-team@...roid.com, linux-acpi@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-efi@...r.kernel.org,
devicetree@...r.kernel.org
Subject: [PATCH v2 09/17] driver core: Allow only unprobed consumers for
SYNC_STATE_ONLY device links
SYNC_STATE_ONLY device links only affect the behavior of sync_state()
callbacks. Specifically, they prevent sync_state() only callbacks from
being called on a device if one or more of its consumers haven't probed.
So, creating a SYNC_STATE_ONLY device link from an already probed
consumer is useless. So, don't allow creating such device links.
Signed-off-by: Saravana Kannan <saravanak@...gle.com>
---
drivers/base/core.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/base/core.c b/drivers/base/core.c
index e2b246a44d1a..215ce9e72790 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -649,6 +649,17 @@ struct device_link *device_link_add(struct device *consumer,
goto out;
}
+ /*
+ * SYNC_STATE_ONLY links are useless once a consumer device has probed.
+ * So, only create it if the consumer hasn't probed yet.
+ */
+ if (flags & DL_FLAG_SYNC_STATE_ONLY &&
+ consumer->links.status != DL_DEV_NO_DRIVER &&
+ consumer->links.status != DL_DEV_PROBING) {
+ link = NULL;
+ goto out;
+ }
+
/*
* DL_FLAG_AUTOREMOVE_SUPPLIER indicates that the link will be needed
* longer than for DL_FLAG_AUTOREMOVE_CONSUMER and setting them both
--
2.29.2.454.gaff20da3a2-goog
Powered by blists - more mailing lists