[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231110075549.702374-1-herve.codina@bootlin.com>
Date: Fri, 10 Nov 2023 08:55:49 +0100
From: Herve Codina <herve.codina@...tlin.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Saravana Kannan <saravanak@...gle.com>
Cc: linux-kernel@...r.kernel.org,
Allan Nielsen <allan.nielsen@...rochip.com>,
Horatiu Vultur <horatiu.vultur@...rochip.com>,
Steen Hegelund <steen.hegelund@...rochip.com>,
Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
Herve Codina <herve.codina@...tlin.com>, stable@...r.kernel.org
Subject: [PATCH 1/1] driver core: Keep the supplier fwnode consistent with the device
The commit 3a2dbc510c43 ("driver core: fw_devlink: Don't purge child
fwnode's consumer links") introduces the possibility to use the
supplier's parent device instead of the supplier itself.
In that case the supplier fwnode used is not updated and is no more
consistent with the supplier device used.
Update the fwnode used to be consistent with the supplier device used.
Fixes: 3a2dbc510c43 ("driver core: fw_devlink: Don't purge child fwnode's consumer links")
Cc: stable@...r.kernel.org
Signed-off-by: Herve Codina <herve.codina@...tlin.com>
---
drivers/base/core.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 4d8b315c48a1..17f2568e0a79 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -2076,6 +2076,18 @@ static int fw_devlink_create_devlink(struct device *con,
sup_dev = get_dev_from_fwnode(sup_handle);
if (sup_dev) {
+ /*
+ * The supplier device may have changed and so, the supplier
+ * fwnode maybe inconsistent.
+ * Update the supplier fwnode
+ */
+ sup_handle = sup_dev->fwnode;
+ if (!sup_handle) {
+ dev_dbg(con, "Not linking %s - fwnode NULL\n",
+ dev_name(sup_dev));
+ goto out;
+ }
+
/*
* If it's one of those drivers that don't actually bind to
* their device using driver core, then don't wait on this
--
2.41.0
Powered by blists - more mailing lists