]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
platform/x86: barco-p50-gpio: attach software node to its target GPIO device
authorBartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Mon, 27 Apr 2026 10:24:58 +0000 (12:24 +0200)
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Fri, 8 May 2026 15:49:20 +0000 (18:49 +0300)
The software node representing the GPIO controller to consumers is
"dangling": it's not really attached to the device. The GPIO lookup
relies on matching the name of the node to the chip's label. Switch to
using platform_device_register_full() and use the swnode field of struct
platform_device_info to attach the software node to the GPIO device.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Link: https://patch.msgid.link/20260427102459.110332-1-bartosz.golaszewski@oss.qualcomm.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
drivers/platform/x86/barco-p50-gpio.c

index 2a6d8607c40266a9d1c32c895e45a06dfc1e62a8..e1400382465dc478f4078185d5be192f17c5e17d 100644 (file)
@@ -124,7 +124,6 @@ static const struct software_node vendor_key_node = {
 };
 
 static const struct software_node *p50_swnodes[] = {
-       &gpiochip_node,
        &gpio_leds_node,
        &identify_led_node,
        &gpio_keys_node,
@@ -424,6 +423,13 @@ MODULE_DEVICE_TABLE(dmi, dmi_ids);
 static int __init p50_module_init(void)
 {
        struct resource res = DEFINE_RES_IO(P50_GPIO_IO_PORT_BASE, P50_PORT_CMD + 1);
+       struct platform_device_info pdevinfo = {
+               .name = DRIVER_NAME,
+               .id = PLATFORM_DEVID_NONE,
+               .res = &res,
+               .num_res = 1,
+               .swnode = &gpiochip_node,
+       };
        int ret;
 
        if (!dmi_first_match(dmi_ids))
@@ -433,7 +439,7 @@ static int __init p50_module_init(void)
        if (ret)
                return ret;
 
-       gpio_pdev = platform_device_register_simple(DRIVER_NAME, PLATFORM_DEVID_NONE, &res, 1);
+       gpio_pdev = platform_device_register_full(&pdevinfo);
        if (IS_ERR(gpio_pdev)) {
                pr_err("failed registering %s: %ld\n", DRIVER_NAME, PTR_ERR(gpio_pdev));
                platform_driver_unregister(&p50_gpio_driver);