summaryrefslogtreecommitdiff
path: root/drivers/spi/spi.c
diff options
context:
space:
mode:
authorHeikki Krogerus <heikki.krogerus@linux.intel.com>2021-03-03 18:28:11 +0300
committerMark Brown <broonie@kernel.org>2021-03-16 13:29:41 +0000
commit47afc77bbfeac163d81c7a675d608c18561aa680 (patch)
treecfe70057d7675f7ae9267817b8554921f1c4b079 /drivers/spi/spi.c
parenta38fd8748464831584a19438cbb3082b5a2dab15 (diff)
spi: Add support for software nodes
Making it possible for the drivers to assign complete software fwnodes to the devices instead of only the device properties in those nodes. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Link: https://lore.kernel.org/r/20210303152814.35070-2-heikki.krogerus@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi/spi.c')
-rw-r--r--drivers/spi/spi.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index b08efe88ccd6..9b46998ae2a4 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -686,6 +686,15 @@ struct spi_device *spi_new_device(struct spi_controller *ctlr,
}
}
+ if (chip->swnode) {
+ status = device_add_software_node(&proxy->dev, chip->swnode);
+ if (status) {
+ dev_err(&ctlr->dev, "failed to add softwade node to '%s': %d\n",
+ chip->modalias, status);
+ goto err_remove_props;
+ }
+ }
+
status = spi_add_device(proxy);
if (status < 0)
goto err_remove_props;
@@ -693,8 +702,7 @@ struct spi_device *spi_new_device(struct spi_controller *ctlr,
return proxy;
err_remove_props:
- if (chip->properties)
- device_remove_properties(&proxy->dev);
+ device_remove_software_node(&proxy->dev);
err_dev_put:
spi_dev_put(proxy);
return NULL;
@@ -719,6 +727,7 @@ void spi_unregister_device(struct spi_device *spi)
}
if (ACPI_COMPANION(&spi->dev))
acpi_device_clear_enumerated(ACPI_COMPANION(&spi->dev));
+ device_remove_software_node(&spi->dev);
device_unregister(&spi->dev);
}
EXPORT_SYMBOL_GPL(spi_unregister_device);