diff mbox series

[v6,2/4] spi: Switch to using is_acpi_device_node() in spi_dev_set_name()

Message ID 20240415140925.3518990-3-ckeepax@opensource.cirrus.com
State Accepted
Commit 8a101146bcf014060530d71eba8edc52eca257f7
Headers show
Series Add bridged amplifiers to cs42l43 | expand

Commit Message

Charles Keepax April 15, 2024, 2:09 p.m. UTC
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(-)

Comments

Charles Keepax April 16, 2024, 9:53 a.m. UTC | #1
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 mbox series

Patch

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;
 	}