Thread (61 messages) 61 messages, 1 author, 2021-12-23
STALE1640d LANDED

[PATCH 05/60] pinctrl: renesas: Add generic support for pin group subsets

From: Geert Uytterhoeven <geert+renesas@glider.be>
Date: 2021-12-23 14:42:18
Also in: linux-renesas-soc
Subsystem: pin control subsystem, pin controller - renesas, the rest · Maintainers: Linus Walleij, Geert Uytterhoeven, Linus Torvalds

It is fairly common for the pins in a pin group to be a subset of the
pins in another pin group.  Add a macro for defining a pin group that
refers to a subset of an array of pins.  This allows pin groups to share
pin data, and thus save memory.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/pinctrl/renesas/sh_pfc.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)
diff --git a/drivers/pinctrl/renesas/sh_pfc.h b/drivers/pinctrl/renesas/sh_pfc.h
index d6292a79282f198e..6f7fe21c982e5f48 100644
--- a/drivers/pinctrl/renesas/sh_pfc.h
+++ b/drivers/pinctrl/renesas/sh_pfc.h
@@ -58,6 +58,18 @@ struct sh_pfc_pin {
 }
 #define SH_PFC_PIN_GROUP(name)	SH_PFC_PIN_GROUP_ALIAS(name, name)
 
+/*
+ * Define a pin group referring to a subset of an array of pins.
+ */
+#define SH_PFC_PIN_GROUP_SUBSET(_name, data, first, n) {		\
+	.name = #_name,							\
+	.pins = data##_pins + first,					\
+	.mux = data##_mux + first,					\
+	.nr_pins = n +							\
+	BUILD_BUG_ON_ZERO(first + n > ARRAY_SIZE(data##_pins)) +	\
+	BUILD_BUG_ON_ZERO(first + n > ARRAY_SIZE(data##_mux)),		\
+}
+
 struct sh_pfc_pin_group {
 	const char *name;
 	const unsigned int *pins;
-- 
2.25.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help