diff mbox series

[V2,2/3] pinctrl: imx: Support building SCU pinctrl core driver as module

Message ID 1599481953-32704-2-git-send-email-Anson.Huang@nxp.com
State New
Headers show
Series [V2,1/3] pinctrl: imx: Use function callbacks for SCU related functions | expand

Commit Message

Anson Huang Sept. 7, 2020, 12:32 p.m. UTC
Change PINCTR_IMX_SCU to tristate, remove unnecessary #ifdef and add
module author, description and license to support building SCU pinctrl
core driver as module.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
---
Changes since V1:
	- split V1 [1/2] patch to 2 patches, this patch supports building SCU pinctrl core
	  driver as module;
	- remove unnecessary #ifdef check and #else block.
---
 drivers/pinctrl/freescale/Kconfig       |  2 +-
 drivers/pinctrl/freescale/pinctrl-imx.h | 20 --------------------
 drivers/pinctrl/freescale/pinctrl-scu.c |  5 +++++
 3 files changed, 6 insertions(+), 21 deletions(-)

Comments

Aisheng Dong Sept. 8, 2020, 2:43 a.m. UTC | #1
> From: Anson Huang <Anson.Huang@nxp.com>
> Sent: Monday, September 7, 2020 8:33 PM
> 
> Change PINCTR_IMX_SCU to tristate, remove unnecessary #ifdef and add
> module author, description and license to support building SCU pinctrl core
> driver as module.
> 
> Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
> ---
> Changes since V1:
> 	- split V1 [1/2] patch to 2 patches, this patch supports building SCU pinctrl
> core
> 	  driver as module;
> 	- remove unnecessary #ifdef check and #else block.
> ---
>  drivers/pinctrl/freescale/Kconfig       |  2 +-
>  drivers/pinctrl/freescale/pinctrl-imx.h | 20 --------------------
> drivers/pinctrl/freescale/pinctrl-scu.c |  5 +++++
>  3 files changed, 6 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/pinctrl/freescale/Kconfig b/drivers/pinctrl/freescale/Kconfig
> index 08fcf5c..452c499 100644
> --- a/drivers/pinctrl/freescale/Kconfig
> +++ b/drivers/pinctrl/freescale/Kconfig
> @@ -7,7 +7,7 @@ config PINCTRL_IMX
>  	select REGMAP
> 
>  config PINCTRL_IMX_SCU
> -	bool
> +	tristate "IMX SCU pinctrl core driver"
>  	depends on IMX_SCU
>  	select PINCTRL_IMX
> 

[...]

> diff --git a/drivers/pinctrl/freescale/pinctrl-imx.h
> b/drivers/pinctrl/freescale/pinctrl-imx.h
> index 40927ca..fd8c4b6 100644
> --- a/drivers/pinctrl/freescale/pinctrl-imx.h
> +++ b/drivers/pinctrl/freescale/pinctrl-imx.h
> @@ -144,7 +144,6 @@ struct imx_pinctrl_soc_info {  int
> imx_pinctrl_probe(struct platform_device *pdev,
>  			const struct imx_pinctrl_soc_info *info);
> 
> -#ifdef CONFIG_PINCTRL_IMX_SCU
>  #define BM_PAD_CTL_GP_ENABLE		BIT(30)
>  #define BM_PAD_CTL_IFMUX_ENABLE		BIT(31)
>  #define BP_PAD_CTL_IFMUX		27
> @@ -157,23 +156,4 @@ int imx_pinconf_set_scu(struct pinctrl_dev *pctldev,
> unsigned pin_id,  void imx_pinctrl_parse_pin_scu(struct imx_pinctrl *ipctl,
>  			       unsigned int *pin_id, struct imx_pin *pin,
>  			       const __be32 **list_p);
> -#else
> -static inline int imx_pinconf_get_scu(struct pinctrl_dev *pctldev,
> -				      unsigned pin_id, unsigned long *config)
> -{
> -	return -EINVAL;
> -}
> -static inline int imx_pinconf_set_scu(struct pinctrl_dev *pctldev,
> -				      unsigned pin_id, unsigned long *configs,
> -				      unsigned num_configs)
> -{
> -	return -EINVAL;
> -}
> -static inline void imx_pinctrl_parse_pin_scu(struct imx_pinctrl *ipctl,
> -					    unsigned int *pin_id,
> -					    struct imx_pin *pin,
> -					    const __be32 **list_p)
> -{
> -}
> -#endif
>  #endif /* __DRIVERS_PINCTRL_IMX_H */

Should this part of changes go to Patch 1?

> diff --git a/drivers/pinctrl/freescale/pinctrl-scu.c
> b/drivers/pinctrl/freescale/pinctrl-scu.c
> index 9df45d3..59b5f8a 100644
> --- a/drivers/pinctrl/freescale/pinctrl-scu.c
> +++ b/drivers/pinctrl/freescale/pinctrl-scu.c
> @@ -7,6 +7,7 @@
> 
>  #include <linux/err.h>
>  #include <linux/firmware/imx/sci.h>
> +#include <linux/module.h>
>  #include <linux/of_address.h>
>  #include <linux/pinctrl/pinctrl.h>
>  #include <linux/platform_device.h>
> @@ -123,3 +124,7 @@ void imx_pinctrl_parse_pin_scu(struct imx_pinctrl
> *ipctl,
>  		pin_scu->mux_mode, pin_scu->config);
>  }
>  EXPORT_SYMBOL_GPL(imx_pinctrl_parse_pin_scu);
> +
> +MODULE_AUTHOR("Dong Aisheng <aisheng.dong@nxp.com>");
> +MODULE_DESCRIPTION("NXP i.MX SCU common pinctrl driver");
> +MODULE_LICENSE("GPL v2");
> --
> 2.7.4
Anson Huang Sept. 8, 2020, 5:06 a.m. UTC | #2
> Subject: RE: [PATCH V2 2/3] pinctrl: imx: Support building SCU pinctrl core
> driver as module
> 
> > From: Anson Huang <Anson.Huang@nxp.com>
> > Sent: Monday, September 7, 2020 8:33 PM
> >
> > Change PINCTR_IMX_SCU to tristate, remove unnecessary #ifdef and add
> > module author, description and license to support building SCU pinctrl
> > core driver as module.
> >
> > Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
> > ---
> > Changes since V1:
> > 	- split V1 [1/2] patch to 2 patches, this patch supports building SCU
> > pinctrl core
> > 	  driver as module;
> > 	- remove unnecessary #ifdef check and #else block.
> > ---
> >  drivers/pinctrl/freescale/Kconfig       |  2 +-
> >  drivers/pinctrl/freescale/pinctrl-imx.h | 20 --------------------
> > drivers/pinctrl/freescale/pinctrl-scu.c |  5 +++++
> >  3 files changed, 6 insertions(+), 21 deletions(-)
> >
> > diff --git a/drivers/pinctrl/freescale/Kconfig
> > b/drivers/pinctrl/freescale/Kconfig
> > index 08fcf5c..452c499 100644
> > --- a/drivers/pinctrl/freescale/Kconfig
> > +++ b/drivers/pinctrl/freescale/Kconfig
> > @@ -7,7 +7,7 @@ config PINCTRL_IMX
> >  	select REGMAP
> >
> >  config PINCTRL_IMX_SCU
> > -	bool
> > +	tristate "IMX SCU pinctrl core driver"
> >  	depends on IMX_SCU
> >  	select PINCTRL_IMX
> >
> 
> [...]
> 
> > diff --git a/drivers/pinctrl/freescale/pinctrl-imx.h
> > b/drivers/pinctrl/freescale/pinctrl-imx.h
> > index 40927ca..fd8c4b6 100644
> > --- a/drivers/pinctrl/freescale/pinctrl-imx.h
> > +++ b/drivers/pinctrl/freescale/pinctrl-imx.h
> > @@ -144,7 +144,6 @@ struct imx_pinctrl_soc_info {  int
> > imx_pinctrl_probe(struct platform_device *pdev,
> >  			const struct imx_pinctrl_soc_info *info);
> >
> > -#ifdef CONFIG_PINCTRL_IMX_SCU
> >  #define BM_PAD_CTL_GP_ENABLE		BIT(30)
> >  #define BM_PAD_CTL_IFMUX_ENABLE		BIT(31)
> >  #define BP_PAD_CTL_IFMUX		27
> > @@ -157,23 +156,4 @@ int imx_pinconf_set_scu(struct pinctrl_dev
> > *pctldev, unsigned pin_id,  void imx_pinctrl_parse_pin_scu(struct
> imx_pinctrl *ipctl,
> >  			       unsigned int *pin_id, struct imx_pin *pin,
> >  			       const __be32 **list_p);
> > -#else
> > -static inline int imx_pinconf_get_scu(struct pinctrl_dev *pctldev,
> > -				      unsigned pin_id, unsigned long *config)
> > -{
> > -	return -EINVAL;
> > -}
> > -static inline int imx_pinconf_set_scu(struct pinctrl_dev *pctldev,
> > -				      unsigned pin_id, unsigned long *configs,
> > -				      unsigned num_configs)
> > -{
> > -	return -EINVAL;
> > -}
> > -static inline void imx_pinctrl_parse_pin_scu(struct imx_pinctrl *ipctl,
> > -					    unsigned int *pin_id,
> > -					    struct imx_pin *pin,
> > -					    const __be32 **list_p)
> > -{
> > -}
> > -#endif
> >  #endif /* __DRIVERS_PINCTRL_IMX_H */
> 
> Should this part of changes go to Patch 1?

OK, will send V3.

Anson
diff mbox series

Patch

diff --git a/drivers/pinctrl/freescale/Kconfig b/drivers/pinctrl/freescale/Kconfig
index 08fcf5c..452c499 100644
--- a/drivers/pinctrl/freescale/Kconfig
+++ b/drivers/pinctrl/freescale/Kconfig
@@ -7,7 +7,7 @@  config PINCTRL_IMX
 	select REGMAP
 
 config PINCTRL_IMX_SCU
-	bool
+	tristate "IMX SCU pinctrl core driver"
 	depends on IMX_SCU
 	select PINCTRL_IMX
 
diff --git a/drivers/pinctrl/freescale/pinctrl-imx.h b/drivers/pinctrl/freescale/pinctrl-imx.h
index 40927ca..fd8c4b6 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx.h
+++ b/drivers/pinctrl/freescale/pinctrl-imx.h
@@ -144,7 +144,6 @@  struct imx_pinctrl_soc_info {
 int imx_pinctrl_probe(struct platform_device *pdev,
 			const struct imx_pinctrl_soc_info *info);
 
-#ifdef CONFIG_PINCTRL_IMX_SCU
 #define BM_PAD_CTL_GP_ENABLE		BIT(30)
 #define BM_PAD_CTL_IFMUX_ENABLE		BIT(31)
 #define BP_PAD_CTL_IFMUX		27
@@ -157,23 +156,4 @@  int imx_pinconf_set_scu(struct pinctrl_dev *pctldev, unsigned pin_id,
 void imx_pinctrl_parse_pin_scu(struct imx_pinctrl *ipctl,
 			       unsigned int *pin_id, struct imx_pin *pin,
 			       const __be32 **list_p);
-#else
-static inline int imx_pinconf_get_scu(struct pinctrl_dev *pctldev,
-				      unsigned pin_id, unsigned long *config)
-{
-	return -EINVAL;
-}
-static inline int imx_pinconf_set_scu(struct pinctrl_dev *pctldev,
-				      unsigned pin_id, unsigned long *configs,
-				      unsigned num_configs)
-{
-	return -EINVAL;
-}
-static inline void imx_pinctrl_parse_pin_scu(struct imx_pinctrl *ipctl,
-					    unsigned int *pin_id,
-					    struct imx_pin *pin,
-					    const __be32 **list_p)
-{
-}
-#endif
 #endif /* __DRIVERS_PINCTRL_IMX_H */
diff --git a/drivers/pinctrl/freescale/pinctrl-scu.c b/drivers/pinctrl/freescale/pinctrl-scu.c
index 9df45d3..59b5f8a 100644
--- a/drivers/pinctrl/freescale/pinctrl-scu.c
+++ b/drivers/pinctrl/freescale/pinctrl-scu.c
@@ -7,6 +7,7 @@ 
 
 #include <linux/err.h>
 #include <linux/firmware/imx/sci.h>
+#include <linux/module.h>
 #include <linux/of_address.h>
 #include <linux/pinctrl/pinctrl.h>
 #include <linux/platform_device.h>
@@ -123,3 +124,7 @@  void imx_pinctrl_parse_pin_scu(struct imx_pinctrl *ipctl,
 		pin_scu->mux_mode, pin_scu->config);
 }
 EXPORT_SYMBOL_GPL(imx_pinctrl_parse_pin_scu);
+
+MODULE_AUTHOR("Dong Aisheng <aisheng.dong@nxp.com>");
+MODULE_DESCRIPTION("NXP i.MX SCU common pinctrl driver");
+MODULE_LICENSE("GPL v2");