Re: [PATCH v1 2/2] spi: Populate fwnode in of_register_spi_device()
From: Saravana Kannan <hidden>
Date: 2020-11-05 19:27:24
Also in:
linux-mediatek, linux-spi, lkml
On Thu, Nov 5, 2020 at 9:12 AM Mark Brown [off-list ref] wrote:
On Wed, Nov 04, 2020 at 12:54:31PM -0800, Saravana Kannan wrote:quoted
From: Daniel Mentz <redacted> This allows the fw_devlink feature to work for spi devices too. This avoids unnecessary probe deferrals related to spi devices and improves suspend/resume ordering for spi devices when fw_devlink=on.quoted
of_node_get(nc); spi->dev.of_node = nc; + spi->dev.fwnode = of_fwnode_handle(nc);Why is this a manual step in an individual subsystem rather than something done in the driver core
It can't be done in driver core because "fwnode" is the abstraction driver core uses. It shouldn't care or know if the firmware is DT, ACPI or something else -- that's the whole point of fwnode.
- when would we not want to have the fwnode correspond to the of_node,
Never.
and wouldn't that just be a case of checking to see if there is a fwnode already set and only initializing if not anyway?
Honestly, we should be deleting device.of_node and always use device.fwnode. But that's a long way away (lots of clean up). The "common" place to do this is where a struct device is created from a firmware (device_node, acpi_device, etc). I don't see a "common place" for when a device is created out of a device_node, so I think this patch is a reasonable middle ground. -Saravana _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel