mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v13 02/10] drivers: core: Use fw_devlink_set_device()
       [not found] <20261012142826.159178-1-herve.codina@bootlin.com>
@ 2026-10-12 14:28 ` Herve Codina
  2026-10-12 14:28 ` [PATCH v13 03/10] pinctrl: cs42l43: " Herve Codina
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: Herve Codina @ 2026-10-12 14:28 UTC (permalink / raw)
  To: Richard Cheng, Andrew Lunn, Rob Herring, Saravana Kannan,
	Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich,
	Bjorn Helgaas, Charles Keepax, Richard Fitzgerald, David Rhodes,
	Linus Walleij, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Bartosz Golaszewski, Len Brown, Davidlohr Bueso,
	Jonathan Cameron, Dave Jiang, Alison Schofield, Vishal Verma,
	Dan Williams, Ira Weiny, Li Ming, Herve Codina, Lizhi Hou
  Cc: driver-core, linux-kernel, linux-pci, linux-sound, patches,
	linux-gpio, linux-acpi, linux-cxl, Allan Nielsen, Horatiu Vultur,
	Daniel Machon, Steen Hegelund, Luca Ceresoli, Thomas Petazzoni,
	Ulf Hansson, Bartosz Golaszewski

The code set directly fwnode->dev field.

Use the dedicated fw_devlink_set_device() helper to perform this
operation.

Signed-off-by: Herve Codina <herve.codina@bootlin.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Reviewed-by: Richard Cheng <icheng@nvidia.com>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
 drivers/base/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/base/core.c b/drivers/base/core.c
index 4c0c373998a1..3268e9350c86 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -3754,7 +3754,7 @@ int device_add(struct device *dev)
 	 * device and the driver sync_state callback is called for this device.
 	 */
 	if (dev->fwnode && !dev->fwnode->dev) {
-		dev->fwnode->dev = dev;
+		fw_devlink_set_device(dev->fwnode, dev);
 		fw_devlink_link_device(dev);
 	}
 
@@ -3929,7 +3929,7 @@ void device_del(struct device *dev)
 	device_unlock(dev);
 
 	if (dev->fwnode && dev->fwnode->dev == dev)
-		dev->fwnode->dev = NULL;
+		fw_devlink_set_device(dev->fwnode, NULL);
 
 	/* Notify clients of device removal.  This call must come
 	 * before dpm_sysfs_remove().
-- 
2.55.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v13 03/10] pinctrl: cs42l43: Use fw_devlink_set_device()
       [not found] <20261012142826.159178-1-herve.codina@bootlin.com>
  2026-10-12 14:28 ` [PATCH v13 02/10] drivers: core: Use fw_devlink_set_device() Herve Codina
@ 2026-10-12 14:28 ` Herve Codina
  2026-10-12 14:28 ` [PATCH v13 04/10] cxl/test: Use device_set_node() Herve Codina
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: Herve Codina @ 2026-10-12 14:28 UTC (permalink / raw)
  To: Richard Cheng, Andrew Lunn, Rob Herring, Saravana Kannan,
	Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich,
	Bjorn Helgaas, Charles Keepax, Richard Fitzgerald, David Rhodes,
	Linus Walleij, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Bartosz Golaszewski, Len Brown, Davidlohr Bueso,
	Jonathan Cameron, Dave Jiang, Alison Schofield, Vishal Verma,
	Dan Williams, Ira Weiny, Li Ming, Herve Codina, Lizhi Hou
  Cc: driver-core, linux-kernel, linux-pci, linux-sound, patches,
	linux-gpio, linux-acpi, linux-cxl, Allan Nielsen, Horatiu Vultur,
	Daniel Machon, Steen Hegelund, Luca Ceresoli, Thomas Petazzoni,
	Bartosz Golaszewski

The code set directly fwnode->dev field.

Use the dedicated fw_devlink_set_device() helper to perform this
operation.

Signed-off-by: Herve Codina <herve.codina@bootlin.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Acked-by: Linus Walleij <linusw@kernel.org>
Reviewed-by: Richard Cheng <icheng@nvidia.com>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
 drivers/pinctrl/cirrus/pinctrl-cs42l43.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pinctrl/cirrus/pinctrl-cs42l43.c b/drivers/pinctrl/cirrus/pinctrl-cs42l43.c
index 8990fab0446c..563070aba3d8 100644
--- a/drivers/pinctrl/cirrus/pinctrl-cs42l43.c
+++ b/drivers/pinctrl/cirrus/pinctrl-cs42l43.c
@@ -576,7 +576,7 @@ static int cs42l43_pin_probe(struct platform_device *pdev)
 				return ret;
 
 			if (!child->dev)
-				child->dev = priv->dev;
+				fw_devlink_set_device(child, priv->dev);
 			fwnode = child;
 		}
 	}
-- 
2.55.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v13 04/10] cxl/test: Use device_set_node()
       [not found] <20261012142826.159178-1-herve.codina@bootlin.com>
  2026-10-12 14:28 ` [PATCH v13 02/10] drivers: core: Use fw_devlink_set_device() Herve Codina
  2026-10-12 14:28 ` [PATCH v13 03/10] pinctrl: cs42l43: " Herve Codina
@ 2026-10-12 14:28 ` Herve Codina
  2026-10-12 14:28 ` [PATCH v13 05/10] cxl/test: Use fw_devlink_set_device() Herve Codina
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: Herve Codina @ 2026-10-12 14:28 UTC (permalink / raw)
  To: Richard Cheng, Andrew Lunn, Rob Herring, Saravana Kannan,
	Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich,
	Bjorn Helgaas, Charles Keepax, Richard Fitzgerald, David Rhodes,
	Linus Walleij, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Bartosz Golaszewski, Len Brown, Davidlohr Bueso,
	Jonathan Cameron, Dave Jiang, Alison Schofield, Vishal Verma,
	Dan Williams, Ira Weiny, Li Ming, Herve Codina, Lizhi Hou
  Cc: driver-core, linux-kernel, linux-pci, linux-sound, patches,
	linux-gpio, linux-acpi, linux-cxl, Allan Nielsen, Horatiu Vultur,
	Daniel Machon, Steen Hegelund, Luca Ceresoli, Thomas Petazzoni,
	Jonathan Cameron, Bartosz Golaszewski

The code set directly dev->fwnode.

Use the dedicated helper to perform this operation.

Signed-off-by: Herve Codina <herve.codina@bootlin.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Richard Cheng <icheng@nvidia.com>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
 tools/testing/cxl/test/cxl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/cxl/test/cxl.c b/tools/testing/cxl/test/cxl.c
index 62bd92b3be45..547ebc97bf59 100644
--- a/tools/testing/cxl/test/cxl.c
+++ b/tools/testing/cxl/test/cxl.c
@@ -1677,7 +1677,7 @@ static void mock_companion(struct acpi_device *adev, struct device *dev)
 {
 	device_initialize(&adev->dev);
 	fwnode_init(&adev->fwnode, NULL);
-	dev->fwnode = &adev->fwnode;
+	device_set_node(dev, &adev->fwnode);
 	adev->fwnode.dev = dev;
 }
 
-- 
2.55.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v13 05/10] cxl/test: Use fw_devlink_set_device()
       [not found] <20261012142826.159178-1-herve.codina@bootlin.com>
                   ` (2 preceding siblings ...)
  2026-10-12 14:28 ` [PATCH v13 04/10] cxl/test: Use device_set_node() Herve Codina
@ 2026-10-12 14:28 ` Herve Codina
  2026-10-12 14:28 ` [PATCH v13 06/10] PCI: of: " Herve Codina
  2026-10-12 14:28 ` [PATCH v13 09/10] PCI: of: Remove fwnode_dev_initialized() call for a PCI root bridge node Herve Codina
  5 siblings, 0 replies; 6+ messages in thread
From: Herve Codina @ 2026-10-12 14:28 UTC (permalink / raw)
  To: Richard Cheng, Andrew Lunn, Rob Herring, Saravana Kannan,
	Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich,
	Bjorn Helgaas, Charles Keepax, Richard Fitzgerald, David Rhodes,
	Linus Walleij, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Bartosz Golaszewski, Len Brown, Davidlohr Bueso,
	Jonathan Cameron, Dave Jiang, Alison Schofield, Vishal Verma,
	Dan Williams, Ira Weiny, Li Ming, Herve Codina, Lizhi Hou
  Cc: driver-core, linux-kernel, linux-pci, linux-sound, patches,
	linux-gpio, linux-acpi, linux-cxl, Allan Nielsen, Horatiu Vultur,
	Daniel Machon, Steen Hegelund, Luca Ceresoli, Thomas Petazzoni,
	Jonathan Cameron, Bartosz Golaszewski

The code set directly fwnode.dev field.

Use the dedicated fw_devlink_set_device() helper to perform this
operation.

Signed-off-by: Herve Codina <herve.codina@bootlin.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Richard Cheng <icheng@nvidia.com>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
 tools/testing/cxl/test/cxl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/cxl/test/cxl.c b/tools/testing/cxl/test/cxl.c
index 547ebc97bf59..e21e45fe1572 100644
--- a/tools/testing/cxl/test/cxl.c
+++ b/tools/testing/cxl/test/cxl.c
@@ -1678,7 +1678,7 @@ static void mock_companion(struct acpi_device *adev, struct device *dev)
 	device_initialize(&adev->dev);
 	fwnode_init(&adev->fwnode, NULL);
 	device_set_node(dev, &adev->fwnode);
-	adev->fwnode.dev = dev;
+	fw_devlink_set_device(&adev->fwnode, dev);
 }
 
 #ifndef SZ_64G
-- 
2.55.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v13 06/10] PCI: of: Use fw_devlink_set_device()
       [not found] <20261012142826.159178-1-herve.codina@bootlin.com>
                   ` (3 preceding siblings ...)
  2026-10-12 14:28 ` [PATCH v13 05/10] cxl/test: Use fw_devlink_set_device() Herve Codina
@ 2026-10-12 14:28 ` Herve Codina
  2026-10-12 14:28 ` [PATCH v13 09/10] PCI: of: Remove fwnode_dev_initialized() call for a PCI root bridge node Herve Codina
  5 siblings, 0 replies; 6+ messages in thread
From: Herve Codina @ 2026-10-12 14:28 UTC (permalink / raw)
  To: Richard Cheng, Andrew Lunn, Rob Herring, Saravana Kannan,
	Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich,
	Bjorn Helgaas, Charles Keepax, Richard Fitzgerald, David Rhodes,
	Linus Walleij, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Bartosz Golaszewski, Len Brown, Davidlohr Bueso,
	Jonathan Cameron, Dave Jiang, Alison Schofield, Vishal Verma,
	Dan Williams, Ira Weiny, Li Ming, Herve Codina, Lizhi Hou
  Cc: driver-core, linux-kernel, linux-pci, linux-sound, patches,
	linux-gpio, linux-acpi, linux-cxl, Allan Nielsen, Horatiu Vultur,
	Daniel Machon, Steen Hegelund, Luca Ceresoli, Thomas Petazzoni,
	stable, Manivannan Sadhasivam, Bartosz Golaszewski

The code set directly fwnode.dev field.

Use the dedicated fw_devlink_set_device() helper to perform this
operation.

Cc: stable@vger.kernel.org
Signed-off-by: Herve Codina <herve.codina@bootlin.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Richard Cheng <icheng@nvidia.com>
Acked-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
Cc stable because used by other patches with Fixes + Cc stable
---
 drivers/pci/of.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/of.c b/drivers/pci/of.c
index a51dff91b196..0f45c5b72458 100644
--- a/drivers/pci/of.c
+++ b/drivers/pci/of.c
@@ -882,7 +882,7 @@ void of_pci_make_host_bridge_node(struct pci_host_bridge *bridge)
 	 * bus. Avoid any new device creation.
 	 */
 	of_node_set_flag(np, OF_POPULATED);
-	np->fwnode.dev = &bridge->dev;
+	fw_devlink_set_device(&np->fwnode, &bridge->dev);
 	fwnode_dev_initialized(&np->fwnode, true);
 
 	ret = of_changeset_apply(cset);
-- 
2.55.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v13 09/10] PCI: of: Remove fwnode_dev_initialized() call for a PCI root bridge node
       [not found] <20261012142826.159178-1-herve.codina@bootlin.com>
                   ` (4 preceding siblings ...)
  2026-10-12 14:28 ` [PATCH v13 06/10] PCI: of: " Herve Codina
@ 2026-10-12 14:28 ` Herve Codina
  5 siblings, 0 replies; 6+ messages in thread
From: Herve Codina @ 2026-10-12 14:28 UTC (permalink / raw)
  To: Richard Cheng, Andrew Lunn, Rob Herring, Saravana Kannan,
	Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich,
	Bjorn Helgaas, Charles Keepax, Richard Fitzgerald, David Rhodes,
	Linus Walleij, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Bartosz Golaszewski, Len Brown, Davidlohr Bueso,
	Jonathan Cameron, Dave Jiang, Alison Schofield, Vishal Verma,
	Dan Williams, Ira Weiny, Li Ming, Herve Codina, Lizhi Hou
  Cc: driver-core, linux-kernel, linux-pci, linux-sound, patches,
	linux-gpio, linux-acpi, linux-cxl, Allan Nielsen, Horatiu Vultur,
	Daniel Machon, Steen Hegelund, Luca Ceresoli, Thomas Petazzoni,
	stable

During the instantiation of devices described by a device-tree overlay
applied on a PCI device, devlink displays the following kind of debug
messages instead of creating the expected links:
   'Not linking xxxx - might never become dev'

Without those expected links, the device removal order cannot be
correct.

Those debug traces are printed by fw_devlink_create_devlink(). In our
use case, they are all printed because the supplier of the link has at
least one of its ancestor with its fwnode flag FWNODE_FLAG_INITIALIZED
set.

The culprit ancestor is the PCI root bridge.

The fwnode related to the PCI root bridge is created dynamically by the
of_pci_make_host_bridge_node() function. During this creation
fwnode_dev_initialized() is called which set the FWNODE_FLAG_INITIALIZED
flag.

Calling fwnode_dev_initialized() tells devlink that the device related
to this node is handled out of the driver core. This is not correct in
our case. Indeed the device related to this firmware node is handled
using driver core mechanisms and is fully compliant devlink
expectations.

Simply remove the fwnode_dev_initialized() call. With that done, the
devlink debug messages are no more displayed and links that were missing
are correctly created.

Fixes: 1f340724419e ("PCI: of: Create device tree PCI host bridge node")
Cc: stable@vger.kernel.org
Signed-off-by: Herve Codina <herve.codina@bootlin.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Richard Cheng <icheng@nvidia.com>
---
 drivers/pci/of.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/pci/of.c b/drivers/pci/of.c
index 8914bfa25dc1..0a5797652e18 100644
--- a/drivers/pci/of.c
+++ b/drivers/pci/of.c
@@ -894,7 +894,6 @@ void of_pci_make_host_bridge_node(struct pci_host_bridge *bridge)
 	 */
 	of_node_set_flag(np, OF_POPULATED);
 	fw_devlink_set_device(&np->fwnode, &bridge->dev);
-	fwnode_dev_initialized(&np->fwnode, true);
 
 	ret = of_changeset_apply(cset);
 	if (ret)
-- 
2.55.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-10-12 14:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20261012142826.159178-1-herve.codina@bootlin.com>
2026-10-12 14:28 ` [PATCH v13 02/10] drivers: core: Use fw_devlink_set_device() Herve Codina
2026-10-12 14:28 ` [PATCH v13 03/10] pinctrl: cs42l43: " Herve Codina
2026-10-12 14:28 ` [PATCH v13 04/10] cxl/test: Use device_set_node() Herve Codina
2026-10-12 14:28 ` [PATCH v13 05/10] cxl/test: Use fw_devlink_set_device() Herve Codina
2026-10-12 14:28 ` [PATCH v13 06/10] PCI: of: " Herve Codina
2026-10-12 14:28 ` [PATCH v13 09/10] PCI: of: Remove fwnode_dev_initialized() call for a PCI root bridge node Herve Codina

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®