[v5,1/6] pinctrl: sh-pfc: Add optional arg to VIN_DATA_PIN_GROUP

Message ID 1541693247-15599-2-git-send-email-jacopo+renesas@jmondi.org
State New
Headers show
Series
  • sh-pfc: Variadic VIN_DATA_PIN_GROUP macro + VIN updates
Related show

Commit Message

Jacopo Mondi Nov. 8, 2018, 4:07 p.m.
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 group
names not consistent with the ones defined using the SH_PFC_PIN_GROUP()
macro.

Fix this by making the VIN_DATA_PIN_GROUP macro a variadic one,
which accepts an optional 'version' argument.

Fixes: 423caa52534f ("pinctrl: sh-pfc: r8a779[01]: Move 'union vin_data' to shared header file")
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>

---
v4 -> v5:
- Rebased on sh-pfc-for-v4.21
- Add fixes tag

---
 drivers/pinctrl/sh-pfc/sh_pfc.h | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

--
2.7.4

Comments

Simon Horman Nov. 9, 2018, 10:07 a.m. | #1
On Thu, Nov 08, 2018 at 05:07:22PM +0100, Jacopo Mondi 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 group
> names not consistent with the ones defined using the SH_PFC_PIN_GROUP()
> macro.
> 
> Fix this by making the VIN_DATA_PIN_GROUP macro a variadic one,
> which accepts an optional 'version' argument.
> 
> Fixes: 423caa52534f ("pinctrl: sh-pfc: r8a779[01]: Move 'union vin_data' to shared header file")
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>

Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Geert Uytterhoeven Nov. 13, 2018, 10:24 a.m. | #2
On Thu, Nov 8, 2018 at 5:07 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 group
> names not consistent with the ones defined using the SH_PFC_PIN_GROUP()
> macro.
>
> Fix this by making the VIN_DATA_PIN_GROUP macro a variadic one,
> which accepts an optional 'version' argument.
>
> Fixes: 423caa52534f ("pinctrl: sh-pfc: r8a779[01]: Move 'union vin_data' to shared header file")
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>

Queuing in sh-pfc-for-v4.21.

Gr{oetje,eeting}s,

                        Geert

Patch

diff --git a/drivers/pinctrl/sh-pfc/sh_pfc.h b/drivers/pinctrl/sh-pfc/sh_pfc.h
index 1fc13366869a..4ef485cfe08d 100644
--- a/drivers/pinctrl/sh-pfc/sh_pfc.h
+++ b/drivers/pinctrl/sh-pfc/sh_pfc.h
@@ -55,14 +55,15 @@  struct sh_pfc_pin_group {
 /*
  * Using union vin_data{,12,16} 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.
+ * in this case. It accepts an optional 'version' argument used when the
+ * same group can appear on a different set of pins.
  */
-#define VIN_DATA_PIN_GROUP(n, s)				\
-	{							\
-		.name = #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#__VA_ARGS__,				\
+		.pins = n##__VA_ARGS__##_pins.data##s,			\
+		.mux = n##__VA_ARGS__##_mux.data##s,			\
+		.nr_pins = ARRAY_SIZE(n##__VA_ARGS__##_pins.data##s),	\
 	}

 union vin_data12 {