]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
gpio: stmpe: Allow to compile as a module
authorAlexander Stein <alexander.stein@ew.tq-group.com>
Mon, 28 Jul 2025 06:05:43 +0000 (08:05 +0200)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Mon, 11 Aug 2025 09:06:17 +0000 (11:06 +0200)
Add the necessary boilerplate to also make this driver modular.
Keep the subsys_initcall to not change registration order for built-in.
Also add OF match table for module autoloading.

Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Link: https://lore.kernel.org/r/20250728060544.18169-1-alexander.stein@ew.tq-group.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
drivers/gpio/Kconfig
drivers/gpio/gpio-stmpe.c

index e43abb322fa6e15f19f2f498aa5adea03e6cd3bf..a437fe652dbc63312e293fde364bb1ed3ea9b942 100644 (file)
@@ -1559,7 +1559,7 @@ config GPIO_SL28CPLD
          called gpio-sl28cpld.
 
 config GPIO_STMPE
-       bool "STMPE GPIOs"
+       tristate "STMPE GPIOs"
        depends on MFD_STMPE
        depends on OF_GPIO
        select GPIOLIB_IRQCHIP
index 5dd4c21a8e601b32a1c6be04ca5f3a50d6fdb09c..7bf270af07fe49e7a778e91134b5bc5e7d0a13a5 100644 (file)
@@ -534,10 +534,16 @@ static int stmpe_gpio_probe(struct platform_device *pdev)
        return devm_gpiochip_add_data(dev, &stmpe_gpio->chip, stmpe_gpio);
 }
 
+static const struct of_device_id stmpe_gpio_of_matches[] = {
+       { .compatible = "st,stmpe-gpio", },
+       { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, stmpe_gpio_of_matches);
+
 static struct platform_driver stmpe_gpio_driver = {
        .driver = {
-               .suppress_bind_attrs    = true,
-               .name                   = "stmpe-gpio",
+               .name = "stmpe-gpio",
+               .of_match_table = stmpe_gpio_of_matches,
        },
        .probe          = stmpe_gpio_probe,
 };
@@ -547,3 +553,13 @@ static int __init stmpe_gpio_init(void)
        return platform_driver_register(&stmpe_gpio_driver);
 }
 subsys_initcall(stmpe_gpio_init);
+
+static void __exit stmpe_gpio_exit(void)
+{
+       platform_driver_unregister(&stmpe_gpio_driver);
+}
+module_exit(stmpe_gpio_exit);
+
+MODULE_DESCRIPTION("STMPE expander GPIO");
+MODULE_AUTHOR("Rabin Vincent <rabin.vincent@stericsson.com>");
+MODULE_LICENSE("GPL");