]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ARM: omap1: use platform_device_register_full() for GPIO devices on OMAP 16xx
authorBartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Thu, 30 Apr 2026 07:30:56 +0000 (09:30 +0200)
committerBartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Wed, 27 May 2026 08:00:50 +0000 (10:00 +0200)
Ahead of changes attaching GPIO controller's software nodes referenced
from the Nokia 770 board files to their target devices, switch the
method for registering the platform devices to the
platform_device_register_full() variant. This is done to leverage the
new swnode field of struct platform_device_info which automate the
software node's registration and assignment.

Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Link: https://patch.msgid.link/20260430-nokia770-gpio-swnodes-v7-2-c88f74c90dd6@oss.qualcomm.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
arch/arm/mach-omap1/gpio16xx.c

index e8dbe173bd33fae72c7c884f930a530f78096839..9cca29f860544ddbec3734cec9b3246ce468543c 100644 (file)
@@ -55,14 +55,13 @@ static struct omap_gpio_platform_data omap16xx_mpu_gpio_config = {
        .regs                   = &omap16xx_mpuio_regs,
 };
 
-static struct platform_device omap16xx_mpu_gpio = {
+static const struct platform_device_info omap16xx_mpu_gpio = {
        .name           = "omap_gpio",
        .id             = 0,
-       .dev            = {
-               .platform_data = &omap16xx_mpu_gpio_config,
-       },
-       .num_resources = ARRAY_SIZE(omap16xx_mpu_gpio_resources),
-       .resource = omap16xx_mpu_gpio_resources,
+       .data           = &omap16xx_mpu_gpio_config,
+       .size_data      = sizeof(omap16xx_mpu_gpio_config),
+       .num_res        = ARRAY_SIZE(omap16xx_mpu_gpio_resources),
+       .res            = omap16xx_mpu_gpio_resources,
 };
 
 /* gpio1 */
@@ -99,14 +98,13 @@ static struct omap_gpio_platform_data omap16xx_gpio1_config = {
        .regs                   = &omap16xx_gpio_regs,
 };
 
-static struct platform_device omap16xx_gpio1 = {
+static const struct platform_device_info omap16xx_gpio1 = {
        .name           = "omap_gpio",
        .id             = 1,
-       .dev            = {
-               .platform_data = &omap16xx_gpio1_config,
-       },
-       .num_resources = ARRAY_SIZE(omap16xx_gpio1_resources),
-       .resource = omap16xx_gpio1_resources,
+       .data           = &omap16xx_gpio1_config,
+       .size_data      = sizeof(omap16xx_gpio1_config),
+       .num_res        = ARRAY_SIZE(omap16xx_gpio1_resources),
+       .res            = omap16xx_gpio1_resources,
 };
 
 /* gpio2 */
@@ -127,14 +125,13 @@ static struct omap_gpio_platform_data omap16xx_gpio2_config = {
        .regs                   = &omap16xx_gpio_regs,
 };
 
-static struct platform_device omap16xx_gpio2 = {
+static const struct platform_device_info omap16xx_gpio2 = {
        .name           = "omap_gpio",
        .id             = 2,
-       .dev            = {
-               .platform_data = &omap16xx_gpio2_config,
-       },
-       .num_resources = ARRAY_SIZE(omap16xx_gpio2_resources),
-       .resource = omap16xx_gpio2_resources,
+       .data           = &omap16xx_gpio2_config,
+       .size_data      = sizeof(omap16xx_gpio2_config),
+       .num_res        = ARRAY_SIZE(omap16xx_gpio2_resources),
+       .res            = omap16xx_gpio2_resources,
 };
 
 /* gpio3 */
@@ -155,14 +152,13 @@ static struct omap_gpio_platform_data omap16xx_gpio3_config = {
        .regs                   = &omap16xx_gpio_regs,
 };
 
-static struct platform_device omap16xx_gpio3 = {
+static const struct platform_device_info omap16xx_gpio3 = {
        .name           = "omap_gpio",
        .id             = 3,
-       .dev            = {
-               .platform_data = &omap16xx_gpio3_config,
-       },
-       .num_resources = ARRAY_SIZE(omap16xx_gpio3_resources),
-       .resource = omap16xx_gpio3_resources,
+       .data           = &omap16xx_gpio3_config,
+       .size_data      = sizeof(omap16xx_gpio3_config),
+       .num_res        = ARRAY_SIZE(omap16xx_gpio3_resources),
+       .res            = omap16xx_gpio3_resources,
 };
 
 /* gpio4 */
@@ -183,17 +179,16 @@ static struct omap_gpio_platform_data omap16xx_gpio4_config = {
        .regs                   = &omap16xx_gpio_regs,
 };
 
-static struct platform_device omap16xx_gpio4 = {
+static const struct platform_device_info omap16xx_gpio4 = {
        .name           = "omap_gpio",
        .id             = 4,
-       .dev            = {
-               .platform_data = &omap16xx_gpio4_config,
-       },
-       .num_resources = ARRAY_SIZE(omap16xx_gpio4_resources),
-       .resource = omap16xx_gpio4_resources,
+       .data           = &omap16xx_gpio4_config,
+       .size_data      = sizeof(omap16xx_gpio4_config),
+       .num_res        = ARRAY_SIZE(omap16xx_gpio4_resources),
+       .res            = omap16xx_gpio4_resources,
 };
 
-static struct platform_device *omap16xx_gpio_dev[] __initdata = {
+static const struct platform_device_info *omap16xx_gpio_dev[] __initconst = {
        &omap16xx_mpu_gpio,
        &omap16xx_gpio1,
        &omap16xx_gpio2,
@@ -210,8 +205,8 @@ static int __init omap16xx_gpio_init(void)
 {
        int i;
        void __iomem *base;
-       struct resource *res;
-       struct platform_device *pdev;
+       const struct resource *res;
+       const struct platform_device_info *pdevinfo;
 
        if (!cpu_is_omap16xx())
                return -EINVAL;
@@ -224,24 +219,24 @@ static int __init omap16xx_gpio_init(void)
                                        ULPD_CAM_CLK_CTRL);
 
        for (i = 0; i < ARRAY_SIZE(omap16xx_gpio_dev); i++) {
-               pdev = omap16xx_gpio_dev[i];
+               pdevinfo = omap16xx_gpio_dev[i];
 
-               res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+               res = &pdevinfo->res[0];
                if (unlikely(!res)) {
-                       dev_err(&pdev->dev, "Invalid mem resource.\n");
+                       pr_err("%s.%d: Invalid mem resource.\n", pdevinfo->name, pdevinfo->id);
                        return -ENODEV;
                }
 
                base = ioremap(res->start, resource_size(res));
                if (unlikely(!base)) {
-                       dev_err(&pdev->dev, "ioremap failed.\n");
+                       pr_err("%s.%d: ioremap failed.\n", pdevinfo->name, pdevinfo->id);
                        return -ENOMEM;
                }
 
                __raw_writel(SYSCONFIG_WORD, base + OMAP1610_GPIO_SYSCONFIG);
                iounmap(base);
 
-               platform_device_register(omap16xx_gpio_dev[i]);
+               platform_device_register_full(omap16xx_gpio_dev[i]);
        }
 
        return 0;