[PATCH 2/5] pinctrl: rockchip: make driver be tristate module
Heiko Stübner
heiko at sntech.de
Sat Sep 12 07:41:17 EDT 2020
Hi,
Am Montag, 7. September 2020, 04:59:24 CEST schrieb Jianqun Xu:
> Make pinctrl-rockchip driver to be tristate module, support to build as
> a module, this is useful for GKI.
>
> Signed-off-by: Jianqun Xu <jay.xu at rock-chips.com>
> ---
> drivers/pinctrl/Kconfig | 2 +-
> drivers/pinctrl/pinctrl-rockchip.c | 18 ++++++++++++++++++
> 2 files changed, 19 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig
> index 4284f39a5c61..743eb2bb8709 100644
> --- a/drivers/pinctrl/Kconfig
> +++ b/drivers/pinctrl/Kconfig
> @@ -207,7 +207,7 @@ config PINCTRL_OXNAS
> select MFD_SYSCON
>
> config PINCTRL_ROCKCHIP
> - bool
> + tristate "Rockchip gpio and pinctrl driver"
> depends on OF
> select PINMUX
> select GENERIC_PINCONF
> diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
> index 0401c1da79dd..cc7512acfc5f 100644
> --- a/drivers/pinctrl/pinctrl-rockchip.c
> +++ b/drivers/pinctrl/pinctrl-rockchip.c
> @@ -16,10 +16,12 @@
> */
>
> #include <linux/init.h>
> +#include <linux/module.h>
> #include <linux/platform_device.h>
> #include <linux/io.h>
> #include <linux/bitops.h>
> #include <linux/gpio/driver.h>
> +#include <linux/of_device.h>
of_device.h below of_address.h please
> #include <linux/of_address.h>
> #include <linux/of_irq.h>
> #include <linux/pinctrl/machine.h>
> @@ -4257,4 +4259,20 @@ static int __init rockchip_pinctrl_drv_register(void)
> {
> return platform_driver_register(&rockchip_pinctrl_driver);
> }
> +
> +static void __exit rockchip_pinctrl_drv_unregister(void)
> +{
> + platform_driver_unregister(&rockchip_pinctrl_driver);
> +}
> +
> +#ifdef CONFIG_PINCTRL_ROCKCHIP_MODULE
> +module_init(rockchip_pinctrl_drv_register);
> +#else
> postcore_initcall(rockchip_pinctrl_drv_register);
> +#endif
You definitly don't need this hack. For modules postcore_initcall
already points to module_init ... see
https://elixir.bootlin.com/linux/latest/source/include/linux/module.h#L114
Heiko
More information about the Linux-rockchip
mailing list