lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZDgnGuycE5S6rlZk@smile.fi.intel.com>
Date:   Thu, 13 Apr 2023 19:00:26 +0300
From:   Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:     Bjorn Helgaas <helgaas@...nel.org>
Cc:     Pali Rohár <pali@...nel.org>,
        linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org,
        Bjorn Helgaas <bhelgaas@...gle.com>
Subject: Re: [PATCH v1 1/1] PCI: of: Propagate firmware node

On Wed, Apr 12, 2023 at 11:02:53AM -0500, Bjorn Helgaas wrote:
> On Wed, Apr 12, 2023 at 04:15:20PM +0300, Andy Shevchenko wrote:
> > Propagate firmware node by using a specific API call, i.e. device_set_node().
> 
> Can you add a line or two about *why* we should do this, e.g., is this
> headed toward some goal?

Because dereferencing the fwnode in struct device is preventing us from
modifications of how fwnode looks like in the future.

> Is it a simplification that's 100%
> equivalent (doesn't seem so, see below)?

To me it's an equivalent, I'll explain below.

> Seems like there's an underlying long-term effort to unify things from
> OF and ACPI, which seems like a good thing, but at the moment it's a
> little confusing to follow.  For instance pci_set_of_node() seems like
> it ought to be sort of analogous to pci_set_acpi_fwnode(), but they
> look nothing alike.

Unification to some extent, but here is not a point of this change.

...

> > +	struct device_node *node;
> > +
> >  	if (!dev->bus->dev.of_node)
> >  		return;
> > -	dev->dev.of_node = of_pci_find_child_device(dev->bus->dev.of_node,
> > -						    dev->devfn);
> > -	if (dev->dev.of_node)
> > -		dev->dev.fwnode = &dev->dev.of_node->fwnode;
> > +	node = of_pci_find_child_device(dev->bus->dev.of_node, dev->devfn);
> > +	device_set_node(&dev->dev, of_fwnode_handle(node));
> 
> This doesn't seem 100% equivalent.  If of_pci_find_child_device()
> returns NULL, the previous code doesn't set dev->dev.fwnode, but the
> new code does.

Yes and this is not a problem. We create device with pci_alloc_dev() in both
callers of the pci_setup_device() and the field is NULL anyway. So, the last
condition there is a simple micro-optimisation.


-- 
With Best Regards,
Andy Shevchenko


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ