Message ID | 20221026203539.517886-1-nfrayer@baylibre.com |
---|---|
State | New |
Headers | show |
Series | gpio: davinci: add support of module build | expand |
On Wed, Oct 26, 2022 at 10:35 PM Nicolas Frayer <nfrayer@baylibre.com> wrote: > > From: Guillaume La Roque <glaroque@baylibre.com> > > Added module build support for the davinci gpio driver > > Signed-off-by: Guillaume La Roque <glaroque@baylibre.com> > Signed-off-by: Nicolas Frayer <nfrayer@baylibre.com> > --- > drivers/gpio/Kconfig | 2 +- > drivers/gpio/gpio-davinci.c | 15 ++++++--------- > 2 files changed, 7 insertions(+), 10 deletions(-) > > diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig > index a01af1180616..f8bace51c2d0 100644 > --- a/drivers/gpio/Kconfig > +++ b/drivers/gpio/Kconfig > @@ -219,7 +219,7 @@ config GPIO_CLPS711X > Say yes here to support GPIO on CLPS711X SoCs. > > config GPIO_DAVINCI > - bool "TI Davinci/Keystone GPIO support" > + tristate "TI Davinci/Keystone GPIO support" > default y if ARCH_DAVINCI > depends on (ARM || ARM64) && (ARCH_DAVINCI || ARCH_KEYSTONE || ARCH_K3) > help > diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c > index 59c4c48d8296..def87b99691f 100644 > --- a/drivers/gpio/gpio-davinci.c > +++ b/drivers/gpio/gpio-davinci.c > @@ -721,12 +721,9 @@ static struct platform_driver davinci_gpio_driver = { > }, > }; > > -/** > - * GPIO driver registration needs to be done before machine_init functions > - * access GPIO. Hence davinci_gpio_drv_reg() is a postcore_initcall. > - */ > -static int __init davinci_gpio_drv_reg(void) > -{ > - return platform_driver_register(&davinci_gpio_driver); > -} > -postcore_initcall(davinci_gpio_drv_reg); > +module_platform_driver(davinci_gpio_driver); I'm sure there was a reason to register the driver early (at postcore) for some platforms. This moves the registration to module_init which is the last initcall to call. What HW did you test this on? Bart > + > +MODULE_AUTHOR("Jan Kotas <jank@cadence.com>"); > +MODULE_DESCRIPTION("DAVINCI GPIO driver"); > +MODULE_LICENSE("GPL"); > +MODULE_ALIAS("platform:gpio-davinci"); > -- > 2.25.1 >
Le lun. 7 nov. 2022 à 10:14, Bartosz Golaszewski <brgl@bgdev.pl> a écrit : > > On Wed, Oct 26, 2022 at 10:35 PM Nicolas Frayer <nfrayer@baylibre.com> wrote: > > > > From: Guillaume La Roque <glaroque@baylibre.com> > > > > Added module build support for the davinci gpio driver > > > > Signed-off-by: Guillaume La Roque <glaroque@baylibre.com> > > Signed-off-by: Nicolas Frayer <nfrayer@baylibre.com> > > --- > > drivers/gpio/Kconfig | 2 +- > > drivers/gpio/gpio-davinci.c | 15 ++++++--------- > > 2 files changed, 7 insertions(+), 10 deletions(-) > > > > diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig > > index a01af1180616..f8bace51c2d0 100644 > > --- a/drivers/gpio/Kconfig > > +++ b/drivers/gpio/Kconfig > > @@ -219,7 +219,7 @@ config GPIO_CLPS711X > > Say yes here to support GPIO on CLPS711X SoCs. > > > > config GPIO_DAVINCI > > - bool "TI Davinci/Keystone GPIO support" > > + tristate "TI Davinci/Keystone GPIO support" > > default y if ARCH_DAVINCI > > depends on (ARM || ARM64) && (ARCH_DAVINCI || ARCH_KEYSTONE || ARCH_K3) > > help > > diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c > > index 59c4c48d8296..def87b99691f 100644 > > --- a/drivers/gpio/gpio-davinci.c > > +++ b/drivers/gpio/gpio-davinci.c > > @@ -721,12 +721,9 @@ static struct platform_driver davinci_gpio_driver = { > > }, > > }; > > > > -/** > > - * GPIO driver registration needs to be done before machine_init functions > > - * access GPIO. Hence davinci_gpio_drv_reg() is a postcore_initcall. > > - */ > > -static int __init davinci_gpio_drv_reg(void) > > -{ > > - return platform_driver_register(&davinci_gpio_driver); > > -} > > -postcore_initcall(davinci_gpio_drv_reg); > > +module_platform_driver(davinci_gpio_driver); > > I'm sure there was a reason to register the driver early (at postcore) > for some platforms. This moves the registration to module_init which > is the last initcall to call. What HW did you test this on? > > Bart > You are right, I'll send a v2 keeping postcore_initcall. I've tested on a AM62x SK EVM. Thanks. > > + > > +MODULE_AUTHOR("Jan Kotas <jank@cadence.com>"); > > +MODULE_DESCRIPTION("DAVINCI GPIO driver"); > > +MODULE_LICENSE("GPL"); > > +MODULE_ALIAS("platform:gpio-davinci"); > > -- > > 2.25.1 > >
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index a01af1180616..f8bace51c2d0 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig @@ -219,7 +219,7 @@ config GPIO_CLPS711X Say yes here to support GPIO on CLPS711X SoCs. config GPIO_DAVINCI - bool "TI Davinci/Keystone GPIO support" + tristate "TI Davinci/Keystone GPIO support" default y if ARCH_DAVINCI depends on (ARM || ARM64) && (ARCH_DAVINCI || ARCH_KEYSTONE || ARCH_K3) help diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c index 59c4c48d8296..def87b99691f 100644 --- a/drivers/gpio/gpio-davinci.c +++ b/drivers/gpio/gpio-davinci.c @@ -721,12 +721,9 @@ static struct platform_driver davinci_gpio_driver = { }, }; -/** - * GPIO driver registration needs to be done before machine_init functions - * access GPIO. Hence davinci_gpio_drv_reg() is a postcore_initcall. - */ -static int __init davinci_gpio_drv_reg(void) -{ - return platform_driver_register(&davinci_gpio_driver); -} -postcore_initcall(davinci_gpio_drv_reg); +module_platform_driver(davinci_gpio_driver); + +MODULE_AUTHOR("Jan Kotas <jank@cadence.com>"); +MODULE_DESCRIPTION("DAVINCI GPIO driver"); +MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:gpio-davinci");