diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2024-06-28 21:08:44 +0300 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2024-07-09 16:21:15 +0300 |
commit | 6eabaf9d6e2a9ec8e995ab404c7d46eb297b4430 (patch) | |
tree | 18014608dfb8cbd40e37e02a7e27ef5380db4ff5 /arch/arm/mach-pxa | |
parent | f1d6588af93b7115ed31d531dd8572556a43081f (diff) | |
download | linux-6eabaf9d6e2a9ec8e995ab404c7d46eb297b4430.tar.xz |
ARM: spitz: Simplify instantiating SPI controller
platform_device_register_full() to instantiate SPI controller in one go
instead of allocating it, creating a software node, and registering the
platform device as separate steps.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20240628180852.1738922-5-dmitry.torokhov@gmail.com
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'arch/arm/mach-pxa')
-rw-r--r-- | arch/arm/mach-pxa/spitz.c | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index 10ab16dcd827..b14eb2a54f80 100644 --- a/arch/arm/mach-pxa/spitz.c +++ b/arch/arm/mach-pxa/spitz.c @@ -580,14 +580,16 @@ static const struct property_entry spitz_spi_properties[] = { { } }; -static const struct software_node spitz_spi_node = { +static const struct platform_device_info spitz_spi_device_info = { + .name = "pxa2xx-spi", + /* pxa2xx-spi platform-device ID equals respective SSP platform-device ID + 1 */ + .id = 2, .properties = spitz_spi_properties, }; static void __init spitz_spi_init(void) { struct platform_device *pd; - int id = 2; int err; if (machine_is_akita()) @@ -598,19 +600,11 @@ static void __init spitz_spi_init(void) gpiod_add_lookup_table(&spitz_ads7846_gpio_table); gpiod_add_lookup_table(&spitz_spi_gpio_table); - /* pxa2xx-spi platform-device ID equals respective SSP platform-device ID + 1 */ - pd = platform_device_alloc("pxa2xx-spi", id); - if (pd == NULL) { - pr_err("pxa2xx-spi: failed to allocate device id %d\n", id); - } else { - err = device_add_software_node(&pd->dev, &spitz_spi_node); - if (err) { - platform_device_put(pd); - pr_err("pxa2xx-spi: failed to add software node\n"); - } else { - platform_device_add(pd); - } - } + pd = platform_device_register_full(&spitz_spi_device_info); + err = PTR_ERR_OR_ZERO(pd); + if (err) + pr_err("pxa2xx-spi: failed to instantiate SPI controller: %d\n", + err); spi_register_board_info(ARRAY_AND_SIZE(spitz_spi_devices)); } |