* [PATCH v2 1/1] driver core: Keep the supplier fwnode consistent with the device
@ 2023-11-13 13:30 Herve Codina
2023-11-13 20:09 ` Saravana Kannan
0 siblings, 1 reply; 3+ messages in thread
From: Herve Codina @ 2023-11-13 13:30 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rafael J. Wysocki, Saravana Kannan
Cc: linux-kernel, Allan Nielsen, Horatiu Vultur, Steen Hegelund,
Thomas Petazzoni, Herve Codina, stable
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@vger.kernel.org
Signed-off-by: Herve Codina <herve.codina@bootlin.com>
---
Changes v1 -> v2:
Remove sup_handle check and related pr_debug() call as sup_handle cannot be
invalid if sup_dev is valid.
drivers/base/core.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 4d8b315c48a1..2f6a21b908ec 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -2076,6 +2076,13 @@ 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 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
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v2 1/1] driver core: Keep the supplier fwnode consistent with the device
2023-11-13 13:30 [PATCH v2 1/1] driver core: Keep the supplier fwnode consistent with the device Herve Codina
@ 2023-11-13 20:09 ` Saravana Kannan
2023-11-14 7:20 ` Herve Codina
0 siblings, 1 reply; 3+ messages in thread
From: Saravana Kannan @ 2023-11-13 20:09 UTC (permalink / raw)
To: Herve Codina
Cc: Greg Kroah-Hartman, Rafael J. Wysocki, linux-kernel,
Allan Nielsen, Horatiu Vultur, Steen Hegelund, Thomas Petazzoni,
stable
On Mon, Nov 13, 2023 at 5:30 AM Herve Codina <herve.codina@bootlin.com> wrote:
>
> 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.
Looks like you missed this comment from my previous reply.
Nack. It's easier to debug when you know what supplier you were
pointing to in DT that triggered the creation of the device link.
It can get confusing real quick otherwise.
-Saravana
>
> 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@vger.kernel.org
> Signed-off-by: Herve Codina <herve.codina@bootlin.com>
> ---
> Changes v1 -> v2:
> Remove sup_handle check and related pr_debug() call as sup_handle cannot be
> invalid if sup_dev is valid.
>
> drivers/base/core.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/base/core.c b/drivers/base/core.c
> index 4d8b315c48a1..2f6a21b908ec 100644
> --- a/drivers/base/core.c
> +++ b/drivers/base/core.c
> @@ -2076,6 +2076,13 @@ 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 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
>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH v2 1/1] driver core: Keep the supplier fwnode consistent with the device
2023-11-13 20:09 ` Saravana Kannan
@ 2023-11-14 7:20 ` Herve Codina
0 siblings, 0 replies; 3+ messages in thread
From: Herve Codina @ 2023-11-14 7:20 UTC (permalink / raw)
To: Saravana Kannan
Cc: Greg Kroah-Hartman, Rafael J. Wysocki, linux-kernel,
Allan Nielsen, Horatiu Vultur, Steen Hegelund, Thomas Petazzoni,
stable
Hi Saravana,
On Mon, 13 Nov 2023 12:09:43 -0800
Saravana Kannan <saravanak@google.com> wrote:
> On Mon, Nov 13, 2023 at 5:30 AM Herve Codina <herve.codina@bootlin.com> wrote:
> >
> > 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.
>
> Looks like you missed this comment from my previous reply.
>
> Nack. It's easier to debug when you know what supplier you were
> pointing to in DT that triggered the creation of the device link.
>
> It can get confusing real quick otherwise.
Sorry,
In the next iteration, I will keep the original supplier handle for
debug prints.
Regards,
Hervé
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-11-14 7:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-13 13:30 [PATCH v2 1/1] driver core: Keep the supplier fwnode consistent with the device Herve Codina
2023-11-13 20:09 ` Saravana Kannan
2023-11-14 7:20 ` Herve Codina
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.