diff mbox series

[v2,09/26] cxl/test: Use device_set_node()

Message ID 20250507071315.394857-10-herve.codina@bootlin.com
State New
Headers show
Series lan966x pci device: Add support for SFPs | expand

Commit Message

Herve Codina May 7, 2025, 7:12 a.m. UTC
The code set directly dev->fwnode.

Use the dedicated helper to perform this operation.

Signed-off-by: Herve Codina <herve.codina@bootlin.com>
---
 tools/testing/cxl/test/cxl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jonathan Cameron May 8, 2025, 11:47 a.m. UTC | #1
On Wed, 7 May 2025 18:10:40 +0300
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> On Wed, May 07, 2025 at 09:12:51AM +0200, Herve Codina wrote:
> > The code set directly dev->fwnode.
> > 
> > Use the dedicated helper to perform this operation.  
> 
> ...
> 
> > @@ -1046,7 +1046,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;
> >  }  
> 
> This code is questionable to begin with. Can the original author explain what
> is the motivation behind this as the only callers of fwnode_init() are deep
> core pieces _and_ this only module. Why?!
> 

More likely to happen if CXL folk are +CC.  Added.

Dan, maybe one for you?
diff mbox series

Patch

diff --git a/tools/testing/cxl/test/cxl.c b/tools/testing/cxl/test/cxl.c
index 1c3336095923..80b950b084a6 100644
--- a/tools/testing/cxl/test/cxl.c
+++ b/tools/testing/cxl/test/cxl.c
@@ -1046,7 +1046,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;
 }