[PATCH 1/5] [RFC-HACK] pinctrl-single: init by postcore_initcall()

Ezequiel Garcia
2014-07-16T11:45:58Z

On 22 May 04:31 PM, Tony Lindgren wrote:
> * Christoph Fritz <chf.fritz@googlemail.com> [140522 16:07]:
> > --- a/drivers/pinctrl/pinctrl-single.c
> > +++ b/drivers/pinctrl/pinctrl-single.c
> > @@ -2069,7 +2069,22 @@ static struct platform_driver pcs_driver = {
> > #endif
> > };
> >
> > +#ifdef CONFIG_USE_OF
> > +static int __init pcs_driver_drv_init(void)
> > +{
> > + return platform_driver_register(&pcs_driver);
> > +}
> > +postcore_initcall(pcs_driver_drv_init);
> > +
> > +static void __exit pcs_driver_drv_exit(void)
> > +{
> > + platform_driver_unregister(&pcs_driver);
> > +}
> > +module_exit(pcs_driver_drv_exit);
> > +#else
> > module_platform_driver(pcs_driver);
> > +#endif
> > +
>
> I would prefer to initialize all the drivers with module_init
> and and if necessary, selected frameworks with subsys_initcall.
>
> In drivers/Makefile we do have painctrl before gpio, so this
> too could be just module_init once the other drivers are fixed.
>

I've been using patches that change gpio and i2c initialization to module_init
for some time now. However, I still see some non-DT boards using the GPIO API
in early functions such as .init_machine.

Only when these boards get converted and the legacy support is dropped, we'll
be able to move all the drivers to module_init.
--
Ezequiel Garcia, VanguardiaSur