diff mbox series

[2/2] gpio: vf610: Support building gpio-vf610 driver as module

Message ID 20221220090248.1134214-2-haibo.chen@nxp.com
State New
Headers show
Series [1/2] gpio: vf610: connect GPIO label to dev name | expand

Commit Message

Bough Chen Dec. 20, 2022, 9:02 a.m. UTC
From: Haibo Chen <haibo.chen@nxp.com>

To support Android GKI, need to build this driver as module.
So change the config as tristate type, and add module license.

Signed-off-by: Jindong Yue <jindong.yue@nxp.com>
Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
---
 drivers/gpio/Kconfig      | 3 ++-
 drivers/gpio/gpio-vf610.c | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)

Comments

Linus Walleij Dec. 29, 2022, 1:46 a.m. UTC | #1
On Tue, Dec 20, 2022 at 10:02 AM <haibo.chen@nxp.com> wrote:

> From: Haibo Chen <haibo.chen@nxp.com>
>
> To support Android GKI, need to build this driver as module.
> So change the config as tristate type, and add module license.
>
> Signed-off-by: Jindong Yue <jindong.yue@nxp.com>
> Signed-off-by: Haibo Chen <haibo.chen@nxp.com>

OK...

>  builtin_platform_driver(vf610_gpio_driver);

Then you want something like module_platform_driver() here.

Yours,
Linus Walleij
Linus Walleij Jan. 17, 2023, 2:12 p.m. UTC | #2
On Tue, Jan 17, 2023 at 3:01 PM Bough Chen <haibo.chen@nxp.com> wrote:
> > On Tue, Dec 20, 2022 at 10:02 AM <haibo.chen@nxp.com> wrote:
> >
> > > From: Haibo Chen <haibo.chen@nxp.com>
> > >
> > > To support Android GKI, need to build this driver as module.
> > > So change the config as tristate type, and add module license.
> > >
> > > Signed-off-by: Jindong Yue <jindong.yue@nxp.com>
> > > Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
> >
> > OK...
> >
> > >  builtin_platform_driver(vf610_gpio_driver);
> >
> > Then you want something like module_platform_driver() here.
>
> Hi Linus,
>
> Here, though need to build this gpio driver as module due to the Android GKI, but we do not really need to
> rmmod/unbind this driver, so do not need to implement the _exit or remove callback.
> In this case, still need to change to module_platform_driver()?
> If so, after use the module_platform_driver(), is it okay to not implement the __exit /remove callback?

Yes, our project is about maintaining and improving the Linux kernel, GKI
is not a project we are running. If they need stuff from Linux, it happens on
our terms, and that is that modularization should be self-motivated.

Check this article:
https://lwn.net/Articles/872209/

Yours,
Linus Walleij
diff mbox series

Patch

diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index ec7cfd4f52b1..53c35cc0ff73 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -680,7 +680,8 @@  config GPIO_UNIPHIER
 	  Say yes here to support UniPhier GPIOs.
 
 config GPIO_VF610
-	def_bool y
+	tristate "Vybrid vf610 GPIO support"
+	default y if ARCH_MXC
 	depends on ARCH_MXC
 	select GPIOLIB_IRQCHIP
 	help
diff --git a/drivers/gpio/gpio-vf610.c b/drivers/gpio/gpio-vf610.c
index a429176673e7..942932ce825a 100644
--- a/drivers/gpio/gpio-vf610.c
+++ b/drivers/gpio/gpio-vf610.c
@@ -15,6 +15,7 @@ 
 #include <linux/io.h>
 #include <linux/ioport.h>
 #include <linux/irq.h>
+#include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
@@ -355,3 +356,4 @@  static struct platform_driver vf610_gpio_driver = {
 };
 
 builtin_platform_driver(vf610_gpio_driver);
+MODULE_LICENSE("GPL");