summaryrefslogtreecommitdiff
path: root/drivers/spi/spi.c
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2021-03-16 17:55:41 +0000
committerMark Brown <broonie@kernel.org>2021-03-16 17:55:41 +0000
commit4152c4d0d939e6863f9814d7d346787b19f771f7 (patch)
treec7b0b19bc3316b29ec4666ea92500f00596787b4 /drivers/spi/spi.c
parentd11233e0dee693fa28cd5023a0e4a212f4c80ed4 (diff)
parentdf41a5dad586c8ead1bb7082b4b6fcb563e02199 (diff)
Merge series "spi: Adding support for software nodes" from Heikki Krogerus <heikki.krogerus@linux.intel.com>:
Hi, The older API used to supply additional device properties for the devices - so mainly the function device_add_properties() - is going to be removed. The reason why the API will be removed is because it gives false impression that the properties are assigned directly to the devices, which has actually never been the case - the properties have always been assigned to a software fwnode which was then just directly linked with the device when the old API was used. By only accepting device properties instead of complete software nodes, the subsystems remove any change of taking advantage of the other features the software nodes have. The change that is required from the spi subsystem and the drivers is trivial. Basically only the "properties" member in struct spi_board_info, which was a pointer to struct property_entry, is replaced with a pointer to a complete software node. thanks, Heikki Krogerus (4): spi: Add support for software nodes ARM: pxa: icontrol: Constify the software node ARM: pxa: zeus: Constify the software node spi: Remove support for dangling device properties arch/arm/mach-pxa/icontrol.c | 12 ++++++++---- arch/arm/mach-pxa/zeus.c | 6 +++++- drivers/spi/spi.c | 21 ++++++--------------- include/linux/spi/spi.h | 7 +++---- 4 files changed, 22 insertions(+), 24 deletions(-) -- 2.30.1 base-commit: a38fd8748464831584a19438cbb3082b5a2dab15
Diffstat (limited to 'drivers/spi/spi.c')
-rw-r--r--drivers/spi/spi.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 481427780162..0706832bffda 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -676,11 +676,10 @@ struct spi_device *spi_new_device(struct spi_controller *ctlr,
proxy->controller_data = chip->controller_data;
proxy->controller_state = NULL;
- if (chip->properties) {
- status = device_add_properties(&proxy->dev, chip->properties);
+ if (chip->swnode) {
+ status = device_add_software_node(&proxy->dev, chip->swnode);
if (status) {
- dev_err(&ctlr->dev,
- "failed to add properties to '%s': %d\n",
+ dev_err(&ctlr->dev, "failed to add softwade node to '%s': %d\n",
chip->modalias, status);
goto err_dev_put;
}
@@ -688,14 +687,12 @@ struct spi_device *spi_new_device(struct spi_controller *ctlr,
status = spi_add_device(proxy);
if (status < 0)
- goto err_remove_props;
+ goto err_dev_put;
return proxy;
-err_remove_props:
- if (chip->properties)
- device_remove_properties(&proxy->dev);
err_dev_put:
+ device_remove_software_node(&proxy->dev);
spi_dev_put(proxy);
return NULL;
}
@@ -719,6 +716,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);
@@ -755,7 +753,6 @@ static void spi_match_controller_to_boardinfo(struct spi_controller *ctlr,
*
* The board info passed can safely be __initdata ... but be careful of
* any embedded pointers (platform_data, etc), they're copied as-is.
- * Device properties are deep-copied though.
*
* Return: zero on success, else a negative error code.
*/
@@ -775,12 +772,6 @@ int spi_register_board_info(struct spi_board_info const *info, unsigned n)
struct spi_controller *ctlr;
memcpy(&bi->board_info, info, sizeof(*info));
- if (info->properties) {
- bi->board_info.properties =
- property_entries_dup(info->properties);
- if (IS_ERR(bi->board_info.properties))
- return PTR_ERR(bi->board_info.properties);
- }
mutex_lock(&board_lock);
list_add_tail(&bi->list, &board_list);