* [PATCH v2 1/1] gpio: stmpe: Allow to compile as a module
@ 2025-07-28 6:05 Alexander Stein
2025-08-11 9:10 ` Bartosz Golaszewski
0 siblings, 1 reply; 2+ messages in thread
From: Alexander Stein @ 2025-07-28 6:05 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Maxime Coquelin,
Alexandre Torgue
Cc: Alexander Stein, linux-gpio, linux-kernel, linux-stm32,
linux-arm-kernel
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>
---
Changes in v2:
* Do not touch subsys_initcall
* Add module_exit instead
* Adjust commit message
drivers/gpio/Kconfig | 2 +-
drivers/gpio/gpio-stmpe.c | 20 ++++++++++++++++++--
2 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 500d839f65ee8..0621832d045fa 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -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
diff --git a/drivers/gpio/gpio-stmpe.c b/drivers/gpio/gpio-stmpe.c
index 0a270156e0bea..97d6c4f98eaf7 100644
--- a/drivers/gpio/gpio-stmpe.c
+++ b/drivers/gpio/gpio-stmpe.c
@@ -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");
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2 1/1] gpio: stmpe: Allow to compile as a module
2025-07-28 6:05 [PATCH v2 1/1] gpio: stmpe: Allow to compile as a module Alexander Stein
@ 2025-08-11 9:10 ` Bartosz Golaszewski
0 siblings, 0 replies; 2+ messages in thread
From: Bartosz Golaszewski @ 2025-08-11 9:10 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Maxime Coquelin,
Alexandre Torgue, Alexander Stein
Cc: Bartosz Golaszewski, linux-gpio, linux-kernel, linux-stm32,
linux-arm-kernel
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
On Mon, 28 Jul 2025 08:05:43 +0200, Alexander Stein wrote:
> 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.
>
>
Applied, thanks!
[1/1] gpio: stmpe: Allow to compile as a module
https://git.kernel.org/brgl/linux/c/03db20aaa3ba3998b5a025e243b04e33b5bdefa5
Best regards,
--
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-08-11 9:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-28 6:05 [PATCH v2 1/1] gpio: stmpe: Allow to compile as a module Alexander Stein
2025-08-11 9:10 ` Bartosz Golaszewski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).