Skip to contentSkip to conversation

pinctrl: bcm: ns: use generic groups & functions helpers

PATCH Superseded Rafał Miłecki 2 participants 4 messages Nov 16, 2021 – Dec 26, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pinctrl: bcm: ns: use generic groups & functions helpers

From: Rafał Miłecki <[email protected]>

This simplifies ns driver and gets rid of 70 lines of code.

Some "const"s had to be dropped to avoid:
drivers/pinctrl/bcm/pinctrl-ns.c:274:13: warning: passing argument 3 of 'pinctrl_generic_add_group' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] drivers/pinctrl/bcm/pinctrl-ns.c:284:18: warning: passing argument 3 of 'pinmux_generic_add_function' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]

---
 drivers/pinctrl/bcm/Kconfig      |   2 +
 drivers/pinctrl/bcm/pinctrl-ns.c | 173 ++++++++++---------------------
 2 files changed, 54 insertions(+), 121 deletions(-)
drivers/pinctrl/bcm/Kconfig +2 -0
index 8fc1feedd861..5123f4c33854 100644
@@ -146,6 +146,8 @@ config PINCTRL_NS
 	depends on OF && (ARCH_BCM_5301X || COMPILE_TEST)
 	select PINMUX
 	select GENERIC_PINCONF
+	select GENERIC_PINCTRL_GROUPS
+	select GENERIC_PINMUX_FUNCTIONS
 	default ARCH_BCM_5301X
 	help
 	  Say yes here to enable the Broadcom NS SoC pins driver.
drivers/pinctrl/bcm/pinctrl-ns.c +52 -121

249 lines not on this page · raw message

Signature · 1 line
2.31.1
#1 lore raw

PATCH v2 1/1 pinctrl: bcm: ns: use generic groups & functions helpers

From: Rafał Miłecki <[email protected]>

This simplifies ns driver and gets rid of 70 lines of code.

Some "const"s had to be dropped to avoid:
drivers/pinctrl/bcm/pinctrl-ns.c:274:13: warning: passing argument 3 of 'pinctrl_generic_add_group' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] drivers/pinctrl/bcm/pinctrl-ns.c:284:18: warning: passing argument 3 of 'pinmux_generic_add_function' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]

---
V2: Use pinctrl_generic_get_group() in .set_mux() cb

---
 drivers/pinctrl/bcm/Kconfig      |   2 +
 drivers/pinctrl/bcm/pinctrl-ns.c | 180 ++++++++++---------------------
 2 files changed, 59 insertions(+), 123 deletions(-)
drivers/pinctrl/bcm/Kconfig +2 -0
index 8fc1feedd861..5123f4c33854 100644
@@ -146,6 +146,8 @@ config PINCTRL_NS
 	depends on OF && (ARCH_BCM_5301X || COMPILE_TEST)
 	select PINMUX
 	select GENERIC_PINCONF
+	select GENERIC_PINCTRL_GROUPS
+	select GENERIC_PINMUX_FUNCTIONS
 	default ARCH_BCM_5301X
 	help
 	  Say yes here to enable the Broadcom NS SoC pins driver.
drivers/pinctrl/bcm/pinctrl-ns.c +57 -123

259 lines not on this page · raw message

Signature · 1 line
2.31.1
#2 lore raw

PATCH v3 1/1 pinctrl: bcm: ns: use generic groups & functions helpers

From: Rafał Miłecki <[email protected]>

This simplifies ns driver and gets rid of ~70 lines of code.

"const" had to be dropped from "struct ns_pinctrl_group" @pins to match "struct group_desc" @pins and pinctrl_generic_add_group(). Otherwise it would cause:

drivers/pinctrl/bcm/pinctrl-ns.c: In function 'ns_pinctrl_probe':
drivers/pinctrl/bcm/pinctrl-ns.c:277:13: warning: passing argument 3 of 'pinctrl_generic_add_group' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]

  277 |        group->pins, group->num_pins, NULL);
      |        ~~~~~^~~~~~

---
V2: Use pinctrl_generic_get_group() in .set_mux() cb
V3: Don't drop "const" from "ns_pinctrl_function" @groups. It's possible
thanks to the commit bd0aae66c482 ("pinctrl: add one more "const" for generic function groups").
This patch depends on above commit for that reason.

---
 drivers/pinctrl/bcm/Kconfig      |   2 +
 drivers/pinctrl/bcm/pinctrl-ns.c | 163 +++++++++----------------------
 2 files changed, 50 insertions(+), 115 deletions(-)
drivers/pinctrl/bcm/Kconfig +2 -0
index 273d2a4f9b10..ea5034cce644 100644
@@ -159,6 +159,8 @@ config PINCTRL_NS
 	depends on OF && (ARCH_BCM_5301X || COMPILE_TEST)
 	select PINMUX
 	select GENERIC_PINCONF
+	select GENERIC_PINCTRL_GROUPS
+	select GENERIC_PINMUX_FUNCTIONS
 	default ARCH_BCM_5301X
 	help
 	  Say yes here to enable the Broadcom NS SoC pins driver.
drivers/pinctrl/bcm/pinctrl-ns.c +48 -115

232 lines not on this page · raw message

Signature · 1 line
2.31.1
#3 lore raw
Quoted 8 lines · Rafał Miłecki

From: Rafał Miłecki <[email protected]>

This simplifies ns driver and gets rid of ~70 lines of code.

"const" had to be dropped from "struct ns_pinctrl_group" @pins to match "struct group_desc" @pins and pinctrl_generic_add_group(). Otherwise it would cause:

Quoted 6 lines

drivers/pinctrl/bcm/pinctrl-ns.c: In function 'ns_pinctrl_probe':
drivers/pinctrl/bcm/pinctrl-ns.c:277:13: warning: passing argument 3 of 'pinctrl_generic_add_group' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]

  277 |        group->pins, group->num_pins, NULL);
      |        ~~~~~^~~~~~

This v3 version applied, nice work!

Yours,
Linus Walleij