linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] gpio: palmas: Allow building as a module
@ 2025-05-22 22:22 Aaron Kling via B4 Relay
  2025-05-28 17:44 ` Aaron Kling
  2025-06-02  9:48 ` Bartosz Golaszewski
  0 siblings, 2 replies; 6+ messages in thread
From: Aaron Kling via B4 Relay @ 2025-05-22 22:22 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski; +Cc: linux-gpio, linux-kernel, Aaron Kling

From: Aaron Kling <webgeek1234@gmail.com>

The driver works fine as a module, so allowing building as such. This
drops the driver specific init in favor of the module macro which does
the same, plus handling exit.

Signed-off-by: Aaron Kling <webgeek1234@gmail.com>
---
Changes in v2:
- Drop module alias and add module device table
- Link to v1: https://lore.kernel.org/r/20250522-gpio-palmas-gpio-v1-1-d6b1a3776ef5@gmail.com
---
 drivers/gpio/Kconfig       |  2 +-
 drivers/gpio/gpio-palmas.c | 10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index f2c39bbff83a33dcb12b2d32aa3ebc358a0dd949..be5d823516d0e2bff4b4231dac6a82bf10887118 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -1464,7 +1464,7 @@ config GPIO_MAX77650
 	  These chips have a single pin that can be configured as GPIO.
 
 config GPIO_PALMAS
-	bool "TI PALMAS series PMICs GPIO"
+	tristate "TI PALMAS series PMICs GPIO"
 	depends on MFD_PALMAS
 	help
 	  Select this option to enable GPIO driver for the TI PALMAS
diff --git a/drivers/gpio/gpio-palmas.c b/drivers/gpio/gpio-palmas.c
index 28dba7048509a3ef9c7972c1be53ea30adddabb0..eaef29f59292de5281f31e196961d90974e65b75 100644
--- a/drivers/gpio/gpio-palmas.c
+++ b/drivers/gpio/gpio-palmas.c
@@ -140,6 +140,7 @@ static const struct of_device_id of_palmas_gpio_match[] = {
 	{ .compatible = "ti,tps80036-gpio", .data = &tps80036_dev_data,},
 	{ },
 };
+MODULE_DEVICE_TABLE(of, of_palmas_gpio_match);
 
 static int palmas_gpio_probe(struct platform_device *pdev)
 {
@@ -191,9 +192,8 @@ static struct platform_driver palmas_gpio_driver = {
 	.driver.of_match_table = of_palmas_gpio_match,
 	.probe		= palmas_gpio_probe,
 };
+module_platform_driver(palmas_gpio_driver);
 
-static int __init palmas_gpio_init(void)
-{
-	return platform_driver_register(&palmas_gpio_driver);
-}
-subsys_initcall(palmas_gpio_init);
+MODULE_DESCRIPTION("TI PALMAS series GPIO driver");
+MODULE_AUTHOR("Laxman Dewangan <ldewangan@nvidia.com>");
+MODULE_LICENSE("GPL");

---
base-commit: b36ddb9210e6812eb1c86ad46b66cc46aa193487
change-id: 20250520-gpio-palmas-gpio-a99fc046dc7f

Best regards,
-- 
Aaron Kling <webgeek1234@gmail.com>



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] gpio: palmas: Allow building as a module
  2025-05-22 22:22 [PATCH v2] gpio: palmas: Allow building as a module Aaron Kling via B4 Relay
@ 2025-05-28 17:44 ` Aaron Kling
  2025-06-02  9:01   ` Bartosz Golaszewski
  2025-06-02  9:48 ` Bartosz Golaszewski
  1 sibling, 1 reply; 6+ messages in thread
From: Aaron Kling @ 2025-05-28 17:44 UTC (permalink / raw)
  To: webgeek1234; +Cc: Linus Walleij, Bartosz Golaszewski, linux-gpio, linux-kernel

On Thu, May 22, 2025 at 5:22 PM Aaron Kling via B4 Relay
<devnull+webgeek1234.gmail.com@kernel.org> wrote:
>
> From: Aaron Kling <webgeek1234@gmail.com>
>
> The driver works fine as a module, so allowing building as such. This
> drops the driver specific init in favor of the module macro which does
> the same, plus handling exit.
>
> Signed-off-by: Aaron Kling <webgeek1234@gmail.com>
> ---
> Changes in v2:
> - Drop module alias and add module device table
> - Link to v1: https://lore.kernel.org/r/20250522-gpio-palmas-gpio-v1-1-d6b1a3776ef5@gmail.com
> ---
>  drivers/gpio/Kconfig       |  2 +-
>  drivers/gpio/gpio-palmas.c | 10 +++++-----
>  2 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
> index f2c39bbff83a33dcb12b2d32aa3ebc358a0dd949..be5d823516d0e2bff4b4231dac6a82bf10887118 100644
> --- a/drivers/gpio/Kconfig
> +++ b/drivers/gpio/Kconfig
> @@ -1464,7 +1464,7 @@ config GPIO_MAX77650
>           These chips have a single pin that can be configured as GPIO.
>
>  config GPIO_PALMAS
> -       bool "TI PALMAS series PMICs GPIO"
> +       tristate "TI PALMAS series PMICs GPIO"
>         depends on MFD_PALMAS
>         help
>           Select this option to enable GPIO driver for the TI PALMAS
> diff --git a/drivers/gpio/gpio-palmas.c b/drivers/gpio/gpio-palmas.c
> index 28dba7048509a3ef9c7972c1be53ea30adddabb0..eaef29f59292de5281f31e196961d90974e65b75 100644
> --- a/drivers/gpio/gpio-palmas.c
> +++ b/drivers/gpio/gpio-palmas.c
> @@ -140,6 +140,7 @@ static const struct of_device_id of_palmas_gpio_match[] = {
>         { .compatible = "ti,tps80036-gpio", .data = &tps80036_dev_data,},
>         { },
>  };
> +MODULE_DEVICE_TABLE(of, of_palmas_gpio_match);
>
>  static int palmas_gpio_probe(struct platform_device *pdev)
>  {
> @@ -191,9 +192,8 @@ static struct platform_driver palmas_gpio_driver = {
>         .driver.of_match_table = of_palmas_gpio_match,
>         .probe          = palmas_gpio_probe,
>  };
> +module_platform_driver(palmas_gpio_driver);
>
> -static int __init palmas_gpio_init(void)
> -{
> -       return platform_driver_register(&palmas_gpio_driver);
> -}
> -subsys_initcall(palmas_gpio_init);
> +MODULE_DESCRIPTION("TI PALMAS series GPIO driver");
> +MODULE_AUTHOR("Laxman Dewangan <ldewangan@nvidia.com>");
> +MODULE_LICENSE("GPL");
>
> ---
> base-commit: b36ddb9210e6812eb1c86ad46b66cc46aa193487
> change-id: 20250520-gpio-palmas-gpio-a99fc046dc7f
>
> Best regards,
> --
> Aaron Kling <webgeek1234@gmail.com>
>
>

Friendly reminder about this patch.

Sincerely,
Aaron

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] gpio: palmas: Allow building as a module
  2025-05-28 17:44 ` Aaron Kling
@ 2025-06-02  9:01   ` Bartosz Golaszewski
  0 siblings, 0 replies; 6+ messages in thread
From: Bartosz Golaszewski @ 2025-06-02  9:01 UTC (permalink / raw)
  To: Aaron Kling; +Cc: Linus Walleij, linux-gpio, linux-kernel

On Wed, May 28, 2025 at 7:44 PM Aaron Kling <webgeek1234@gmail.com> wrote:
>
> On Thu, May 22, 2025 at 5:22 PM Aaron Kling via B4 Relay
> <devnull+webgeek1234.gmail.com@kernel.org> wrote:
> >
> > From: Aaron Kling <webgeek1234@gmail.com>
> >
> > The driver works fine as a module, so allowing building as such. This
> > drops the driver specific init in favor of the module macro which does
> > the same, plus handling exit.
> >
> > Signed-off-by: Aaron Kling <webgeek1234@gmail.com>
> > ---
>
> Friendly reminder about this patch.

Hi Aaron,

We're in the middle of the merge window and you sent this patch at rc7
(too late to make the next release). I will not be picking it up
before v6.16-rc1 is tagged. Please don't ping me for at least 2 weeks
after you send a patch nor during the merge window.

Thanks,
Bartosz

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] gpio: palmas: Allow building as a module
  2025-05-22 22:22 [PATCH v2] gpio: palmas: Allow building as a module Aaron Kling via B4 Relay
  2025-05-28 17:44 ` Aaron Kling
@ 2025-06-02  9:48 ` Bartosz Golaszewski
  2025-06-30 19:33   ` Aaron Kling
  1 sibling, 1 reply; 6+ messages in thread
From: Bartosz Golaszewski @ 2025-06-02  9:48 UTC (permalink / raw)
  To: webgeek1234, Laxman Dewangan; +Cc: Linus Walleij, linux-gpio, linux-kernel

On Fri, May 23, 2025 at 12:22 AM Aaron Kling via B4 Relay
<devnull+webgeek1234.gmail.com@kernel.org> wrote:
>
> From: Aaron Kling <webgeek1234@gmail.com>
>
> The driver works fine as a module, so allowing building as such. This
> drops the driver specific init in favor of the module macro which does
> the same, plus handling exit.
>
> Signed-off-by: Aaron Kling <webgeek1234@gmail.com>
> ---
> Changes in v2:
> - Drop module alias and add module device table
> - Link to v1: https://lore.kernel.org/r/20250522-gpio-palmas-gpio-v1-1-d6b1a3776ef5@gmail.com
> ---
>  drivers/gpio/Kconfig       |  2 +-
>  drivers/gpio/gpio-palmas.c | 10 +++++-----
>  2 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
> index f2c39bbff83a33dcb12b2d32aa3ebc358a0dd949..be5d823516d0e2bff4b4231dac6a82bf10887118 100644
> --- a/drivers/gpio/Kconfig
> +++ b/drivers/gpio/Kconfig
> @@ -1464,7 +1464,7 @@ config GPIO_MAX77650
>           These chips have a single pin that can be configured as GPIO.
>
>  config GPIO_PALMAS
> -       bool "TI PALMAS series PMICs GPIO"
> +       tristate "TI PALMAS series PMICs GPIO"
>         depends on MFD_PALMAS
>         help
>           Select this option to enable GPIO driver for the TI PALMAS
> diff --git a/drivers/gpio/gpio-palmas.c b/drivers/gpio/gpio-palmas.c
> index 28dba7048509a3ef9c7972c1be53ea30adddabb0..eaef29f59292de5281f31e196961d90974e65b75 100644
> --- a/drivers/gpio/gpio-palmas.c
> +++ b/drivers/gpio/gpio-palmas.c
> @@ -140,6 +140,7 @@ static const struct of_device_id of_palmas_gpio_match[] = {
>         { .compatible = "ti,tps80036-gpio", .data = &tps80036_dev_data,},
>         { },
>  };
> +MODULE_DEVICE_TABLE(of, of_palmas_gpio_match);
>
>  static int palmas_gpio_probe(struct platform_device *pdev)
>  {
> @@ -191,9 +192,8 @@ static struct platform_driver palmas_gpio_driver = {
>         .driver.of_match_table = of_palmas_gpio_match,
>         .probe          = palmas_gpio_probe,
>  };
> +module_platform_driver(palmas_gpio_driver);
>
> -static int __init palmas_gpio_init(void)
> -{
> -       return platform_driver_register(&palmas_gpio_driver);
> -}
> -subsys_initcall(palmas_gpio_init);

This being put into an earlier initcall than device_initcall() makes
me think, someone had a reason for it and this change can break this.
I'm Cc'ing the original author who seems to still be active in the
kernel.

Laxman: can you verify that this can be safely moved to module_initcall()?

Bartosz

> +MODULE_DESCRIPTION("TI PALMAS series GPIO driver");
> +MODULE_AUTHOR("Laxman Dewangan <ldewangan@nvidia.com>");
> +MODULE_LICENSE("GPL");
>
> ---
> base-commit: b36ddb9210e6812eb1c86ad46b66cc46aa193487
> change-id: 20250520-gpio-palmas-gpio-a99fc046dc7f
>
> Best regards,
> --
> Aaron Kling <webgeek1234@gmail.com>
>
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] gpio: palmas: Allow building as a module
  2025-06-02  9:48 ` Bartosz Golaszewski
@ 2025-06-30 19:33   ` Aaron Kling
  2025-07-01  8:37     ` Bartosz Golaszewski
  0 siblings, 1 reply; 6+ messages in thread
From: Aaron Kling @ 2025-06-30 19:33 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Laxman Dewangan, Linus Walleij, linux-gpio, linux-kernel

On Mon, Jun 2, 2025 at 4:48 AM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
>
> On Fri, May 23, 2025 at 12:22 AM Aaron Kling via B4 Relay
> <devnull+webgeek1234.gmail.com@kernel.org> wrote:
> >
> > From: Aaron Kling <webgeek1234@gmail.com>
> >
> > The driver works fine as a module, so allowing building as such. This
> > drops the driver specific init in favor of the module macro which does
> > the same, plus handling exit.
> >
> > Signed-off-by: Aaron Kling <webgeek1234@gmail.com>
> > ---
> > Changes in v2:
> > - Drop module alias and add module device table
> > - Link to v1: https://lore.kernel.org/r/20250522-gpio-palmas-gpio-v1-1-d6b1a3776ef5@gmail.com
> > ---
> >  drivers/gpio/Kconfig       |  2 +-
> >  drivers/gpio/gpio-palmas.c | 10 +++++-----
> >  2 files changed, 6 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
> > index f2c39bbff83a33dcb12b2d32aa3ebc358a0dd949..be5d823516d0e2bff4b4231dac6a82bf10887118 100644
> > --- a/drivers/gpio/Kconfig
> > +++ b/drivers/gpio/Kconfig
> > @@ -1464,7 +1464,7 @@ config GPIO_MAX77650
> >           These chips have a single pin that can be configured as GPIO.
> >
> >  config GPIO_PALMAS
> > -       bool "TI PALMAS series PMICs GPIO"
> > +       tristate "TI PALMAS series PMICs GPIO"
> >         depends on MFD_PALMAS
> >         help
> >           Select this option to enable GPIO driver for the TI PALMAS
> > diff --git a/drivers/gpio/gpio-palmas.c b/drivers/gpio/gpio-palmas.c
> > index 28dba7048509a3ef9c7972c1be53ea30adddabb0..eaef29f59292de5281f31e196961d90974e65b75 100644
> > --- a/drivers/gpio/gpio-palmas.c
> > +++ b/drivers/gpio/gpio-palmas.c
> > @@ -140,6 +140,7 @@ static const struct of_device_id of_palmas_gpio_match[] = {
> >         { .compatible = "ti,tps80036-gpio", .data = &tps80036_dev_data,},
> >         { },
> >  };
> > +MODULE_DEVICE_TABLE(of, of_palmas_gpio_match);
> >
> >  static int palmas_gpio_probe(struct platform_device *pdev)
> >  {
> > @@ -191,9 +192,8 @@ static struct platform_driver palmas_gpio_driver = {
> >         .driver.of_match_table = of_palmas_gpio_match,
> >         .probe          = palmas_gpio_probe,
> >  };
> > +module_platform_driver(palmas_gpio_driver);
> >
> > -static int __init palmas_gpio_init(void)
> > -{
> > -       return platform_driver_register(&palmas_gpio_driver);
> > -}
> > -subsys_initcall(palmas_gpio_init);
>
> This being put into an earlier initcall than device_initcall() makes
> me think, someone had a reason for it and this change can break this.
> I'm Cc'ing the original author who seems to still be active in the
> kernel.
>
> Laxman: can you verify that this can be safely moved to module_initcall()?
>

Reminder about this patch/question. It's well into the 6.16 cycle now.
If Laxman doesn't respond, is this mergeable? I didn't see any issues
in my basic boot tests on a tegra124 device using a tps65913. But I
didn't do anything close to full functionality tests.

Aaron

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] gpio: palmas: Allow building as a module
  2025-06-30 19:33   ` Aaron Kling
@ 2025-07-01  8:37     ` Bartosz Golaszewski
  0 siblings, 0 replies; 6+ messages in thread
From: Bartosz Golaszewski @ 2025-07-01  8:37 UTC (permalink / raw)
  To: Aaron Kling
  Cc: Laxman Dewangan, Linus Walleij, linux-gpio, linux-kernel,
	Bartosz Golaszewski

On Mon, 30 Jun 2025 21:33:07 +0200, Aaron Kling <webgeek1234@gmail.com> said:
>>
>> This being put into an earlier initcall than device_initcall() makes
>> me think, someone had a reason for it and this change can break this.
>> I'm Cc'ing the original author who seems to still be active in the
>> kernel.
>>
>> Laxman: can you verify that this can be safely moved to module_initcall()?
>>
>
> Reminder about this patch/question. It's well into the 6.16 cycle now.
> If Laxman doesn't respond, is this mergeable? I didn't see any issues
> in my basic boot tests on a tegra124 device using a tps65913. But I
> didn't do anything close to full functionality tests.
>

Why not do the following?

diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 44f922e10db2..dcea3c1bb31c 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -1501,7 +1501,7 @@ config GPIO_MAX77759
          called gpio-max77759.

 config GPIO_PALMAS
-       bool "TI PALMAS series PMICs GPIO"
+       tristate "TI PALMAS series PMICs GPIO"
        depends on MFD_PALMAS
        help
          Select this option to enable GPIO driver for the TI PALMAS
diff --git a/drivers/gpio/gpio-palmas.c b/drivers/gpio/gpio-palmas.c
index a076daee0065..ec503b008d0d 100644
--- a/drivers/gpio/gpio-palmas.c
+++ b/drivers/gpio/gpio-palmas.c
@@ -139,6 +139,7 @@ static const struct of_device_id of_palmas_gpio_match[] = {
        { .compatible = "ti,tps80036-gpio", .data = &tps80036_dev_data,},
        { },
 };
+MODULE_DEVICE_TABLE(of, of_palmas_gpio_match);

 static int palmas_gpio_probe(struct platform_device *pdev)
 {
@@ -196,3 +197,7 @@ static int __init palmas_gpio_init(void)
        return platform_driver_register(&palmas_gpio_driver);
 }
 subsys_initcall(palmas_gpio_init);
+
+MODULE_DESCRIPTION("TI PALMAS series GPIO driver");
+MODULE_AUTHOR("Laxman Dewangan <ldewangan@nvidia.com>");
+MODULE_LICENSE("GPL");

This would keep the initcall level when the module is built-in.

Bartosz

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-07-01  8:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-22 22:22 [PATCH v2] gpio: palmas: Allow building as a module Aaron Kling via B4 Relay
2025-05-28 17:44 ` Aaron Kling
2025-06-02  9:01   ` Bartosz Golaszewski
2025-06-02  9:48 ` Bartosz Golaszewski
2025-06-30 19:33   ` Aaron Kling
2025-07-01  8:37     ` 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).