Message ID | 20240415140925.3518990-3-ckeepax@opensource.cirrus.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | Add bridged amplifiers to cs42l43 | expand |
On Mon, Apr 15, 2024 at 5:09 PM Charles Keepax <ckeepax@opensource.cirrus.com> wrote: > > Use is_acpi_device_node() rather than checking ACPI_COMPANION(), such > that when checking for other types of firmware node the code can a firmware node > consistently do checks against the fwnode. Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
On Mon, Apr 15, 2024 at 07:06:56PM +0300, Andy Shevchenko wrote: > On Mon, Apr 15, 2024 at 5:09 PM Charles Keepax > <ckeepax@opensource.cirrus.com> wrote: > > > > Use is_acpi_device_node() rather than checking ACPI_COMPANION(), such > > that when checking for other types of firmware node the code can > > a firmware node > Pretty sure this parses better without the 'a'. Thanks, Charles
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index a2f01116ba09..d1f82a35f2d0 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -597,10 +597,11 @@ EXPORT_SYMBOL_GPL(spi_alloc_device); static void spi_dev_set_name(struct spi_device *spi) { - struct acpi_device *adev = ACPI_COMPANION(&spi->dev); + struct device *dev = &spi->dev; + struct fwnode_handle *fwnode = dev_fwnode(dev); - if (adev) { - dev_set_name(&spi->dev, "spi-%s", acpi_dev_name(adev)); + if (is_acpi_device_node(fwnode)) { + dev_set_name(dev, "spi-%s", acpi_dev_name(to_acpi_device_node(fwnode))); return; }
Use is_acpi_device_node() rather than checking ACPI_COMPANION(), such that when checking for other types of firmware node the code can consistently do checks against the fwnode. Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> --- Series changes since v5: - Remove includes of fwnode.h - Update commit message Thanks, Charles drivers/spi/spi.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)