[1/2] pinctrl: sh-pfc: Introduce VIN_DATA_PIN_GROUP_VER
diff mbox series

Message ID 1540836824-4636-2-git-send-email-jacopo+renesas@jmondi.org
State New
Headers show
Series
  • pinctrl: sh-pfc: r8a77965: Add VIN4 and VIN5
Related show

Commit Message

Jacopo Mondi Oct. 29, 2018, 6:13 p.m. UTC
VIN data groups may appear on different sets of pins, usually named
"vinX_data_[a|b]". The existing VIN_DATA_PIN_GROUP() does not support appending
the 'a' or 'b' suffix, leading to the definition of groups names not consistent
with the ones defined using SH_PFC_PIN_GROUP() macro.

Fix this by adding a macro that supports appending suffixes when required.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
---
 drivers/pinctrl/sh-pfc/sh_pfc.h | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

Comments

Ulrich Hecht Oct. 30, 2018, 3:46 a.m. UTC | #1
> On October 29, 2018 at 7:13 PM Jacopo Mondi <jacopo+renesas@jmondi.org> wrote:
> 
> 
> VIN data groups may appear on different sets of pins, usually named
> "vinX_data_[a|b]". The existing VIN_DATA_PIN_GROUP() does not support appending
> the 'a' or 'b' suffix, leading to the definition of groups names not consistent
> with the ones defined using SH_PFC_PIN_GROUP() macro.
> 
> Fix this by adding a macro that supports appending suffixes when required.
> 
> Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
> ---
>  drivers/pinctrl/sh-pfc/sh_pfc.h | 20 +++++++++++++++-----
>  1 file changed, 15 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/pinctrl/sh-pfc/sh_pfc.h b/drivers/pinctrl/sh-pfc/sh_pfc.h
> index 458ae0a..2930e9a 100644
> --- a/drivers/pinctrl/sh-pfc/sh_pfc.h
> +++ b/drivers/pinctrl/sh-pfc/sh_pfc.h
> @@ -54,17 +54,27 @@ struct sh_pfc_pin_group {
>  
>  /*
>   * Using union vin_data saves memory occupied by the VIN data pins.
> - * VIN_DATA_PIN_GROUP() is  a macro  used  to describe the VIN pin groups
> - * in this case.
> + *
> + * VIN_DATA_PIN_GROUP() is  a macro  used  to describe the VIN pin groups,

Maybe fix the odd spacing, while you're at it?

> + * while VIN_DATA_PIN_GROUP_VER() is used when the same pin group can appear
> + * on different sets of pins.
>   */
> -#define VIN_DATA_PIN_GROUP(n, s)				\
> -	{							\
> -		.name = #n#s,					\
> +#define __VIN_DATA_PIN_GROUP(n, s)				\
>  		.pins = n##_pins.data##s,			\
>  		.mux = n##_mux.data##s,				\
>  		.nr_pins = ARRAY_SIZE(n##_pins.data##s),	\
>  	}
>  
> +#define VIN_DATA_PIN_GROUP(n, s)				\
> +	{							\
> +		.name = #n#s,					\
> +		__VIN_DATA_PIN_GROUP(n, s)
> +
> +#define VIN_DATA_PIN_GROUP_VER(n, v, s)				\
> +	{							\
> +		.name = #n#s"_"#v,				\
> +		__VIN_DATA_PIN_GROUP(n##_##v, s)
> +
>  union vin_data {
>  	unsigned int data24[24];
>  	unsigned int data20[20];
> -- 
> 2.7.4
>

With or without the whitespace fix:

Reviewed-by: Ulrich Hecht <uli+renesas@fpond.eu>

CU
Uli
Jacopo Mondi Oct. 30, 2018, 7:34 a.m. UTC | #2
Hi Uli,

On Tue, Oct 30, 2018 at 04:46:26AM +0100, Ulrich Hecht wrote:
>
> > On October 29, 2018 at 7:13 PM Jacopo Mondi <jacopo+renesas@jmondi.org> wrote:
> >
> >
> > VIN data groups may appear on different sets of pins, usually named
> > "vinX_data_[a|b]". The existing VIN_DATA_PIN_GROUP() does not support appending
> > the 'a' or 'b' suffix, leading to the definition of groups names not consistent
> > with the ones defined using SH_PFC_PIN_GROUP() macro.
> >
> > Fix this by adding a macro that supports appending suffixes when required.
> >
> > Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
> > ---
> >  drivers/pinctrl/sh-pfc/sh_pfc.h | 20 +++++++++++++++-----
> >  1 file changed, 15 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/pinctrl/sh-pfc/sh_pfc.h b/drivers/pinctrl/sh-pfc/sh_pfc.h
> > index 458ae0a..2930e9a 100644
> > --- a/drivers/pinctrl/sh-pfc/sh_pfc.h
> > +++ b/drivers/pinctrl/sh-pfc/sh_pfc.h
> > @@ -54,17 +54,27 @@ struct sh_pfc_pin_group {
> >
> >  /*
> >   * Using union vin_data saves memory occupied by the VIN data pins.
> > - * VIN_DATA_PIN_GROUP() is  a macro  used  to describe the VIN pin groups
> > - * in this case.
> > + *
> > + * VIN_DATA_PIN_GROUP() is  a macro  used  to describe the VIN pin groups,
>
> Maybe fix the odd spacing, while you're at it?

Ups, I have missed it.

Thanks, I'll wait for more feedbacks and add your tag to the next
version.

Thanks
  j

>
> > + * while VIN_DATA_PIN_GROUP_VER() is used when the same pin group can appear
> > + * on different sets of pins.
> >   */
> > -#define VIN_DATA_PIN_GROUP(n, s)				\
> > -	{							\
> > -		.name = #n#s,					\
> > +#define __VIN_DATA_PIN_GROUP(n, s)				\
> >  		.pins = n##_pins.data##s,			\
> >  		.mux = n##_mux.data##s,				\
> >  		.nr_pins = ARRAY_SIZE(n##_pins.data##s),	\
> >  	}
> >
> > +#define VIN_DATA_PIN_GROUP(n, s)				\
> > +	{							\
> > +		.name = #n#s,					\
> > +		__VIN_DATA_PIN_GROUP(n, s)
> > +
> > +#define VIN_DATA_PIN_GROUP_VER(n, v, s)				\
> > +	{							\
> > +		.name = #n#s"_"#v,				\
> > +		__VIN_DATA_PIN_GROUP(n##_##v, s)
> > +
> >  union vin_data {
> >  	unsigned int data24[24];
> >  	unsigned int data20[20];
> > --
> > 2.7.4
> >
>
> With or without the whitespace fix:
>
> Reviewed-by: Ulrich Hecht <uli+renesas@fpond.eu>
>
> CU
> Uli

Patch
diff mbox series

diff --git a/drivers/pinctrl/sh-pfc/sh_pfc.h b/drivers/pinctrl/sh-pfc/sh_pfc.h
index 458ae0a..2930e9a 100644
--- a/drivers/pinctrl/sh-pfc/sh_pfc.h
+++ b/drivers/pinctrl/sh-pfc/sh_pfc.h
@@ -54,17 +54,27 @@  struct sh_pfc_pin_group {
 
 /*
  * Using union vin_data saves memory occupied by the VIN data pins.
- * VIN_DATA_PIN_GROUP() is  a macro  used  to describe the VIN pin groups
- * in this case.
+ *
+ * VIN_DATA_PIN_GROUP() is  a macro  used  to describe the VIN pin groups,
+ * while VIN_DATA_PIN_GROUP_VER() is used when the same pin group can appear
+ * on different sets of pins.
  */
-#define VIN_DATA_PIN_GROUP(n, s)				\
-	{							\
-		.name = #n#s,					\
+#define __VIN_DATA_PIN_GROUP(n, s)				\
 		.pins = n##_pins.data##s,			\
 		.mux = n##_mux.data##s,				\
 		.nr_pins = ARRAY_SIZE(n##_pins.data##s),	\
 	}
 
+#define VIN_DATA_PIN_GROUP(n, s)				\
+	{							\
+		.name = #n#s,					\
+		__VIN_DATA_PIN_GROUP(n, s)
+
+#define VIN_DATA_PIN_GROUP_VER(n, v, s)				\
+	{							\
+		.name = #n#s"_"#v,				\
+		__VIN_DATA_PIN_GROUP(n##_##v, s)
+
 union vin_data {
 	unsigned int data24[24];
 	unsigned int data20[20];