* [PATCH v3 00/22] pinctrl: Convert struct group_desc to use struct pingroup
@ 2023-11-28 19:56 Andy Shevchenko
2023-11-28 19:56 ` [PATCH v3 01/22] pinctrl: qcom: lpass-lpi: Replace kernel.h with what is being used Andy Shevchenko
` (21 more replies)
0 siblings, 22 replies; 32+ messages in thread
From: Andy Shevchenko @ 2023-11-28 19:56 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Andy Shevchenko,
Rasmus Villemoes, Jonathan Neuschäfer, Krzysztof Kozlowski,
Uwe Kleine-König, Geert Uytterhoeven, Biju Das,
Claudiu Beznea, Jianlong Huang, linux-arm-kernel, linux-gpio,
linux-kernel, linux-mediatek, openbmc, linux-mips, linux-arm-msm,
linux-renesas-soc
Cc: Ray Jui, Scott Branden, Broadcom internal kernel review list,
Dong Aisheng, Fabio Estevam, Shawn Guo, Jacky Bai,
Pengutronix Kernel Team, Sascha Hauer, NXP Linux Team, Sean Wang,
Paul Cercueil, Lakshmi Sowjanya D, Andy Gross, Bjorn Andersson,
Konrad Dybcio, Emil Renner Berthing, Hal Feng
The struct group_desc has a lot of duplication with struct pingroup.
Deduplicate that by embeddind the latter in the former and convert
users.
Linus, assuming everything is fine, I can push this to my tree.
Or you can apply it (assumming all CIs and people are happy with
the series).
NB. It seems to me that GCC 7.x has an issue when compound literal
is being assigned to a constant object. I believe it's a false positive
(at least I can't reproduce this with recent GCC and LLVM and hence
I haven't touched the code in order to address this.
NB. This series contains previously sent patches for Qualcomm and
Nuovoton. Here the updated version for Qualcomm that splits previous
patch to two and fixes compilation warnings.
NB. The function_desc is in plan to follow the similar deduplication.
In v3:
- fixed reported bug in equilibrium code (LKP)
- collected tags (Emil, Florian, Paul)
v2: https://lore.kernel.org/r/20231123193355.3400852-1-andriy.shevchenko@linux.intel.com
In v2:
- added a few patches to fix multiple compile-time errors (LKP)
- added tag (Jonathan)
v1: https://lore.kernel.org/r/20231122164040.2262742-1-andriy.shevchenko@linux.intel.com
Andy Shevchenko (22):
pinctrl: qcom: lpass-lpi: Replace kernel.h with what is being used
pinctrl: qcom: lpass-lpi: Remove unused member in struct lpi_pingroup
pinctrl: equilibrium: Unshadow error code of
of_property_count_u32_elems()
pinctrl: equilibrium: Use temporary variable to hold pins
pinctrl: imx: Use temporary variable to hold pins
pinctrl: core: Make pins const in struct group_desc
pinctrl: equilibrium: Convert to use struct pingroup
pinctrl: keembay: Convert to use struct pingroup
pinctrl: nuvoton: Convert to use struct pingroup and
PINCTRL_PINGROUP()
pinctrl: core: Add a convenient define PINCTRL_GROUP_DESC()
pinctrl: ingenic: Make use of PINCTRL_GROUP_DESC()
pinctrl: mediatek: Make use of PINCTRL_GROUP_DESC()
pinctrl: core: Embed struct pingroup into struct group_desc
pinctrl: bcm: Convert to use grp member
pinctrl: equilibrium: Convert to use grp member
pinctrl: imx: Convert to use grp member
pinctrl: ingenic: Convert to use grp member
pinctrl: keembay: Convert to use grp member
pinctrl: mediatek: Convert to use grp member
pinctrl: renesas: Convert to use grp member
pinctrl: starfive: Convert to use grp member
pinctrl: core: Remove unused members from struct group_desc
drivers/pinctrl/bcm/pinctrl-ns.c | 4 +-
drivers/pinctrl/core.c | 13 +++---
drivers/pinctrl/core.h | 19 +++++---
drivers/pinctrl/freescale/pinctrl-imx.c | 44 +++++++++----------
drivers/pinctrl/mediatek/pinctrl-moore.c | 13 +++---
drivers/pinctrl/mediatek/pinctrl-moore.h | 7 +--
drivers/pinctrl/mediatek/pinctrl-paris.h | 7 +--
drivers/pinctrl/nuvoton/pinctrl-wpcm450.c | 9 ++--
drivers/pinctrl/pinctrl-equilibrium.c | 42 +++++++++---------
drivers/pinctrl/pinctrl-ingenic.c | 27 +++++-------
drivers/pinctrl/pinctrl-keembay.c | 6 +--
drivers/pinctrl/qcom/pinctrl-lpass-lpi.h | 6 +--
.../pinctrl/qcom/pinctrl-sc7280-lpass-lpi.c | 16 -------
.../pinctrl/qcom/pinctrl-sc8280xp-lpass-lpi.c | 20 ---------
.../pinctrl/qcom/pinctrl-sm6115-lpass-lpi.c | 20 ---------
.../pinctrl/qcom/pinctrl-sm8250-lpass-lpi.c | 15 -------
.../pinctrl/qcom/pinctrl-sm8350-lpass-lpi.c | 16 -------
.../pinctrl/qcom/pinctrl-sm8450-lpass-lpi.c | 24 ----------
.../pinctrl/qcom/pinctrl-sm8550-lpass-lpi.c | 24 ----------
.../pinctrl/qcom/pinctrl-sm8650-lpass-lpi.c | 24 ----------
drivers/pinctrl/renesas/pinctrl-rza1.c | 2 +-
drivers/pinctrl/renesas/pinctrl-rza2.c | 10 ++---
drivers/pinctrl/renesas/pinctrl-rzg2l.c | 6 +--
drivers/pinctrl/renesas/pinctrl-rzv2m.c | 6 +--
.../starfive/pinctrl-starfive-jh7100.c | 8 ++--
.../starfive/pinctrl-starfive-jh7110.c | 8 ++--
26 files changed, 108 insertions(+), 288 deletions(-)
--
2.43.0.rc1.1.gbec44491f096
^ permalink raw reply [flat|nested] 32+ messages in thread
* [PATCH v3 01/22] pinctrl: qcom: lpass-lpi: Replace kernel.h with what is being used
2023-11-28 19:56 [PATCH v3 00/22] pinctrl: Convert struct group_desc to use struct pingroup Andy Shevchenko
@ 2023-11-28 19:56 ` Andy Shevchenko
2023-11-28 19:56 ` [PATCH v3 02/22] pinctrl: qcom: lpass-lpi: Remove unused member in struct lpi_pingroup Andy Shevchenko
` (20 subsequent siblings)
21 siblings, 0 replies; 32+ messages in thread
From: Andy Shevchenko @ 2023-11-28 19:56 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Andy Shevchenko,
Rasmus Villemoes, Jonathan Neuschäfer, Krzysztof Kozlowski,
Uwe Kleine-König, Geert Uytterhoeven, Biju Das,
Claudiu Beznea, Jianlong Huang, linux-arm-kernel, linux-gpio,
linux-kernel, linux-mediatek, openbmc, linux-mips, linux-arm-msm,
linux-renesas-soc
Cc: Ray Jui, Scott Branden, Broadcom internal kernel review list,
Dong Aisheng, Fabio Estevam, Shawn Guo, Jacky Bai,
Pengutronix Kernel Team, Sascha Hauer, NXP Linux Team, Sean Wang,
Paul Cercueil, Lakshmi Sowjanya D, Andy Gross, Bjorn Andersson,
Konrad Dybcio, Emil Renner Berthing, Hal Feng
Replace kernel.h with what exactly is being used, i.e. array_size.h.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/pinctrl/qcom/pinctrl-lpass-lpi.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pinctrl/qcom/pinctrl-lpass-lpi.h b/drivers/pinctrl/qcom/pinctrl-lpass-lpi.h
index 206b2c0ca828..2017bc80314d 100644
--- a/drivers/pinctrl/qcom/pinctrl-lpass-lpi.h
+++ b/drivers/pinctrl/qcom/pinctrl-lpass-lpi.h
@@ -6,8 +6,8 @@
#ifndef __PINCTRL_LPASS_LPI_H__
#define __PINCTRL_LPASS_LPI_H__
+#include <linux/array_size.h>
#include <linux/bits.h>
-#include <linux/kernel.h>
#include "../core.h"
--
2.43.0.rc1.1.gbec44491f096
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH v3 02/22] pinctrl: qcom: lpass-lpi: Remove unused member in struct lpi_pingroup
2023-11-28 19:56 [PATCH v3 00/22] pinctrl: Convert struct group_desc to use struct pingroup Andy Shevchenko
2023-11-28 19:56 ` [PATCH v3 01/22] pinctrl: qcom: lpass-lpi: Replace kernel.h with what is being used Andy Shevchenko
@ 2023-11-28 19:56 ` Andy Shevchenko
2023-11-28 19:56 ` [PATCH v3 03/22] pinctrl: equilibrium: Unshadow error code of of_property_count_u32_elems() Andy Shevchenko
` (19 subsequent siblings)
21 siblings, 0 replies; 32+ messages in thread
From: Andy Shevchenko @ 2023-11-28 19:56 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Andy Shevchenko,
Rasmus Villemoes, Jonathan Neuschäfer, Krzysztof Kozlowski,
Uwe Kleine-König, Geert Uytterhoeven, Biju Das,
Claudiu Beznea, Jianlong Huang, linux-arm-kernel, linux-gpio,
linux-kernel, linux-mediatek, openbmc, linux-mips, linux-arm-msm,
linux-renesas-soc
Cc: Ray Jui, Scott Branden, Broadcom internal kernel review list,
Dong Aisheng, Fabio Estevam, Shawn Guo, Jacky Bai,
Pengutronix Kernel Team, Sascha Hauer, NXP Linux Team, Sean Wang,
Paul Cercueil, Lakshmi Sowjanya D, Andy Gross, Bjorn Andersson,
Konrad Dybcio, Emil Renner Berthing, Hal Feng
The group is not used anywhere, remove it. And if needed, it should be
struct pingroup anyway.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/pinctrl/qcom/pinctrl-lpass-lpi.h | 4 ----
.../pinctrl/qcom/pinctrl-sc7280-lpass-lpi.c | 16 -------------
.../pinctrl/qcom/pinctrl-sc8280xp-lpass-lpi.c | 20 ----------------
.../pinctrl/qcom/pinctrl-sm6115-lpass-lpi.c | 20 ----------------
.../pinctrl/qcom/pinctrl-sm8250-lpass-lpi.c | 15 ------------
.../pinctrl/qcom/pinctrl-sm8350-lpass-lpi.c | 16 -------------
.../pinctrl/qcom/pinctrl-sm8450-lpass-lpi.c | 24 -------------------
.../pinctrl/qcom/pinctrl-sm8550-lpass-lpi.c | 24 -------------------
.../pinctrl/qcom/pinctrl-sm8650-lpass-lpi.c | 24 -------------------
9 files changed, 163 deletions(-)
diff --git a/drivers/pinctrl/qcom/pinctrl-lpass-lpi.h b/drivers/pinctrl/qcom/pinctrl-lpass-lpi.h
index 2017bc80314d..a9b2f65c1ebe 100644
--- a/drivers/pinctrl/qcom/pinctrl-lpass-lpi.h
+++ b/drivers/pinctrl/qcom/pinctrl-lpass-lpi.h
@@ -45,11 +45,8 @@ struct pinctrl_pin_desc;
#define LPI_PINGROUP(id, soff, f1, f2, f3, f4) \
{ \
- .group.name = "gpio" #id, \
- .group.pins = gpio##id##_pins, \
.pin = id, \
.slew_offset = soff, \
- .group.num_pins = ARRAY_SIZE(gpio##id##_pins), \
.funcs = (int[]){ \
LPI_MUX_gpio, \
LPI_MUX_##f1, \
@@ -67,7 +64,6 @@ struct pinctrl_pin_desc;
#define LPI_FLAG_SLEW_RATE_SAME_REG BIT(0)
struct lpi_pingroup {
- struct group_desc group;
unsigned int pin;
/* Bit offset in slew register for SoundWire pins only */
int slew_offset;
diff --git a/drivers/pinctrl/qcom/pinctrl-sc7280-lpass-lpi.c b/drivers/pinctrl/qcom/pinctrl-sc7280-lpass-lpi.c
index 99156217c6a5..6bb39812e1d8 100644
--- a/drivers/pinctrl/qcom/pinctrl-sc7280-lpass-lpi.c
+++ b/drivers/pinctrl/qcom/pinctrl-sc7280-lpass-lpi.c
@@ -36,22 +36,6 @@ enum lpass_lpi_functions {
LPI_MUX__,
};
-static int gpio0_pins[] = { 0 };
-static int gpio1_pins[] = { 1 };
-static int gpio2_pins[] = { 2 };
-static int gpio3_pins[] = { 3 };
-static int gpio4_pins[] = { 4 };
-static int gpio5_pins[] = { 5 };
-static int gpio6_pins[] = { 6 };
-static int gpio7_pins[] = { 7 };
-static int gpio8_pins[] = { 8 };
-static int gpio9_pins[] = { 9 };
-static int gpio10_pins[] = { 10 };
-static int gpio11_pins[] = { 11 };
-static int gpio12_pins[] = { 12 };
-static int gpio13_pins[] = { 13 };
-static int gpio14_pins[] = { 14 };
-
static const struct pinctrl_pin_desc sc7280_lpi_pins[] = {
PINCTRL_PIN(0, "gpio0"),
PINCTRL_PIN(1, "gpio1"),
diff --git a/drivers/pinctrl/qcom/pinctrl-sc8280xp-lpass-lpi.c b/drivers/pinctrl/qcom/pinctrl-sc8280xp-lpass-lpi.c
index b33483056f42..c0369baf3398 100644
--- a/drivers/pinctrl/qcom/pinctrl-sc8280xp-lpass-lpi.c
+++ b/drivers/pinctrl/qcom/pinctrl-sc8280xp-lpass-lpi.c
@@ -45,26 +45,6 @@ enum lpass_lpi_functions {
LPI_MUX__,
};
-static int gpio0_pins[] = { 0 };
-static int gpio1_pins[] = { 1 };
-static int gpio2_pins[] = { 2 };
-static int gpio3_pins[] = { 3 };
-static int gpio4_pins[] = { 4 };
-static int gpio5_pins[] = { 5 };
-static int gpio6_pins[] = { 6 };
-static int gpio7_pins[] = { 7 };
-static int gpio8_pins[] = { 8 };
-static int gpio9_pins[] = { 9 };
-static int gpio10_pins[] = { 10 };
-static int gpio11_pins[] = { 11 };
-static int gpio12_pins[] = { 12 };
-static int gpio13_pins[] = { 13 };
-static int gpio14_pins[] = { 14 };
-static int gpio15_pins[] = { 15 };
-static int gpio16_pins[] = { 16 };
-static int gpio17_pins[] = { 17 };
-static int gpio18_pins[] = { 18 };
-
static const struct pinctrl_pin_desc sc8280xp_lpi_pins[] = {
PINCTRL_PIN(0, "gpio0"),
PINCTRL_PIN(1, "gpio1"),
diff --git a/drivers/pinctrl/qcom/pinctrl-sm6115-lpass-lpi.c b/drivers/pinctrl/qcom/pinctrl-sm6115-lpass-lpi.c
index e8a6f6f6af54..316d6fc69131 100644
--- a/drivers/pinctrl/qcom/pinctrl-sm6115-lpass-lpi.c
+++ b/drivers/pinctrl/qcom/pinctrl-sm6115-lpass-lpi.c
@@ -36,26 +36,6 @@ enum lpass_lpi_functions {
LPI_MUX__,
};
-static int gpio0_pins[] = { 0 };
-static int gpio1_pins[] = { 1 };
-static int gpio2_pins[] = { 2 };
-static int gpio3_pins[] = { 3 };
-static int gpio4_pins[] = { 4 };
-static int gpio5_pins[] = { 5 };
-static int gpio6_pins[] = { 6 };
-static int gpio7_pins[] = { 7 };
-static int gpio8_pins[] = { 8 };
-static int gpio9_pins[] = { 9 };
-static int gpio10_pins[] = { 10 };
-static int gpio11_pins[] = { 11 };
-static int gpio12_pins[] = { 12 };
-static int gpio13_pins[] = { 13 };
-static int gpio14_pins[] = { 14 };
-static int gpio15_pins[] = { 15 };
-static int gpio16_pins[] = { 16 };
-static int gpio17_pins[] = { 17 };
-static int gpio18_pins[] = { 18 };
-
static const struct pinctrl_pin_desc sm6115_lpi_pins[] = {
PINCTRL_PIN(0, "gpio0"),
PINCTRL_PIN(1, "gpio1"),
diff --git a/drivers/pinctrl/qcom/pinctrl-sm8250-lpass-lpi.c b/drivers/pinctrl/qcom/pinctrl-sm8250-lpass-lpi.c
index cb10ce8d5d28..9791d9ba5087 100644
--- a/drivers/pinctrl/qcom/pinctrl-sm8250-lpass-lpi.c
+++ b/drivers/pinctrl/qcom/pinctrl-sm8250-lpass-lpi.c
@@ -36,21 +36,6 @@ enum lpass_lpi_functions {
LPI_MUX__,
};
-static int gpio0_pins[] = { 0 };
-static int gpio1_pins[] = { 1 };
-static int gpio2_pins[] = { 2 };
-static int gpio3_pins[] = { 3 };
-static int gpio4_pins[] = { 4 };
-static int gpio5_pins[] = { 5 };
-static int gpio6_pins[] = { 6 };
-static int gpio7_pins[] = { 7 };
-static int gpio8_pins[] = { 8 };
-static int gpio9_pins[] = { 9 };
-static int gpio10_pins[] = { 10 };
-static int gpio11_pins[] = { 11 };
-static int gpio12_pins[] = { 12 };
-static int gpio13_pins[] = { 13 };
-
static const struct pinctrl_pin_desc sm8250_lpi_pins[] = {
PINCTRL_PIN(0, "gpio0"),
PINCTRL_PIN(1, "gpio1"),
diff --git a/drivers/pinctrl/qcom/pinctrl-sm8350-lpass-lpi.c b/drivers/pinctrl/qcom/pinctrl-sm8350-lpass-lpi.c
index 297cc95ac3c0..5b9a2cb216bd 100644
--- a/drivers/pinctrl/qcom/pinctrl-sm8350-lpass-lpi.c
+++ b/drivers/pinctrl/qcom/pinctrl-sm8350-lpass-lpi.c
@@ -36,22 +36,6 @@ enum lpass_lpi_functions {
LPI_MUX__,
};
-static int gpio0_pins[] = { 0 };
-static int gpio1_pins[] = { 1 };
-static int gpio2_pins[] = { 2 };
-static int gpio3_pins[] = { 3 };
-static int gpio4_pins[] = { 4 };
-static int gpio5_pins[] = { 5 };
-static int gpio6_pins[] = { 6 };
-static int gpio7_pins[] = { 7 };
-static int gpio8_pins[] = { 8 };
-static int gpio9_pins[] = { 9 };
-static int gpio10_pins[] = { 10 };
-static int gpio11_pins[] = { 11 };
-static int gpio12_pins[] = { 12 };
-static int gpio13_pins[] = { 13 };
-static int gpio14_pins[] = { 14 };
-
static const struct pinctrl_pin_desc sm8350_lpi_pins[] = {
PINCTRL_PIN(0, "gpio0"),
PINCTRL_PIN(1, "gpio1"),
diff --git a/drivers/pinctrl/qcom/pinctrl-sm8450-lpass-lpi.c b/drivers/pinctrl/qcom/pinctrl-sm8450-lpass-lpi.c
index 2e7896791fc0..a028cbb49947 100644
--- a/drivers/pinctrl/qcom/pinctrl-sm8450-lpass-lpi.c
+++ b/drivers/pinctrl/qcom/pinctrl-sm8450-lpass-lpi.c
@@ -52,30 +52,6 @@ enum lpass_lpi_functions {
LPI_MUX__,
};
-static int gpio0_pins[] = { 0 };
-static int gpio1_pins[] = { 1 };
-static int gpio2_pins[] = { 2 };
-static int gpio3_pins[] = { 3 };
-static int gpio4_pins[] = { 4 };
-static int gpio5_pins[] = { 5 };
-static int gpio6_pins[] = { 6 };
-static int gpio7_pins[] = { 7 };
-static int gpio8_pins[] = { 8 };
-static int gpio9_pins[] = { 9 };
-static int gpio10_pins[] = { 10 };
-static int gpio11_pins[] = { 11 };
-static int gpio12_pins[] = { 12 };
-static int gpio13_pins[] = { 13 };
-static int gpio14_pins[] = { 14 };
-static int gpio15_pins[] = { 15 };
-static int gpio16_pins[] = { 16 };
-static int gpio17_pins[] = { 17 };
-static int gpio18_pins[] = { 18 };
-static int gpio19_pins[] = { 19 };
-static int gpio20_pins[] = { 20 };
-static int gpio21_pins[] = { 21 };
-static int gpio22_pins[] = { 22 };
-
static const struct pinctrl_pin_desc sm8450_lpi_pins[] = {
PINCTRL_PIN(0, "gpio0"),
PINCTRL_PIN(1, "gpio1"),
diff --git a/drivers/pinctrl/qcom/pinctrl-sm8550-lpass-lpi.c b/drivers/pinctrl/qcom/pinctrl-sm8550-lpass-lpi.c
index 64458c3fbe5e..852192b044e1 100644
--- a/drivers/pinctrl/qcom/pinctrl-sm8550-lpass-lpi.c
+++ b/drivers/pinctrl/qcom/pinctrl-sm8550-lpass-lpi.c
@@ -52,30 +52,6 @@ enum lpass_lpi_functions {
LPI_MUX__,
};
-static int gpio0_pins[] = { 0 };
-static int gpio1_pins[] = { 1 };
-static int gpio2_pins[] = { 2 };
-static int gpio3_pins[] = { 3 };
-static int gpio4_pins[] = { 4 };
-static int gpio5_pins[] = { 5 };
-static int gpio6_pins[] = { 6 };
-static int gpio7_pins[] = { 7 };
-static int gpio8_pins[] = { 8 };
-static int gpio9_pins[] = { 9 };
-static int gpio10_pins[] = { 10 };
-static int gpio11_pins[] = { 11 };
-static int gpio12_pins[] = { 12 };
-static int gpio13_pins[] = { 13 };
-static int gpio14_pins[] = { 14 };
-static int gpio15_pins[] = { 15 };
-static int gpio16_pins[] = { 16 };
-static int gpio17_pins[] = { 17 };
-static int gpio18_pins[] = { 18 };
-static int gpio19_pins[] = { 19 };
-static int gpio20_pins[] = { 20 };
-static int gpio21_pins[] = { 21 };
-static int gpio22_pins[] = { 22 };
-
static const struct pinctrl_pin_desc sm8550_lpi_pins[] = {
PINCTRL_PIN(0, "gpio0"),
PINCTRL_PIN(1, "gpio1"),
diff --git a/drivers/pinctrl/qcom/pinctrl-sm8650-lpass-lpi.c b/drivers/pinctrl/qcom/pinctrl-sm8650-lpass-lpi.c
index 6e4be91ff085..04400c832327 100644
--- a/drivers/pinctrl/qcom/pinctrl-sm8650-lpass-lpi.c
+++ b/drivers/pinctrl/qcom/pinctrl-sm8650-lpass-lpi.c
@@ -54,30 +54,6 @@ enum lpass_lpi_functions {
LPI_MUX__,
};
-static int gpio0_pins[] = { 0 };
-static int gpio1_pins[] = { 1 };
-static int gpio2_pins[] = { 2 };
-static int gpio3_pins[] = { 3 };
-static int gpio4_pins[] = { 4 };
-static int gpio5_pins[] = { 5 };
-static int gpio6_pins[] = { 6 };
-static int gpio7_pins[] = { 7 };
-static int gpio8_pins[] = { 8 };
-static int gpio9_pins[] = { 9 };
-static int gpio10_pins[] = { 10 };
-static int gpio11_pins[] = { 11 };
-static int gpio12_pins[] = { 12 };
-static int gpio13_pins[] = { 13 };
-static int gpio14_pins[] = { 14 };
-static int gpio15_pins[] = { 15 };
-static int gpio16_pins[] = { 16 };
-static int gpio17_pins[] = { 17 };
-static int gpio18_pins[] = { 18 };
-static int gpio19_pins[] = { 19 };
-static int gpio20_pins[] = { 20 };
-static int gpio21_pins[] = { 21 };
-static int gpio22_pins[] = { 22 };
-
static const struct pinctrl_pin_desc sm8650_lpi_pins[] = {
PINCTRL_PIN(0, "gpio0"),
PINCTRL_PIN(1, "gpio1"),
--
2.43.0.rc1.1.gbec44491f096
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH v3 03/22] pinctrl: equilibrium: Unshadow error code of of_property_count_u32_elems()
2023-11-28 19:56 [PATCH v3 00/22] pinctrl: Convert struct group_desc to use struct pingroup Andy Shevchenko
2023-11-28 19:56 ` [PATCH v3 01/22] pinctrl: qcom: lpass-lpi: Replace kernel.h with what is being used Andy Shevchenko
2023-11-28 19:56 ` [PATCH v3 02/22] pinctrl: qcom: lpass-lpi: Remove unused member in struct lpi_pingroup Andy Shevchenko
@ 2023-11-28 19:56 ` Andy Shevchenko
2023-11-28 19:56 ` [PATCH v3 04/22] pinctrl: equilibrium: Use temporary variable to hold pins Andy Shevchenko
` (18 subsequent siblings)
21 siblings, 0 replies; 32+ messages in thread
From: Andy Shevchenko @ 2023-11-28 19:56 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Andy Shevchenko,
Rasmus Villemoes, Jonathan Neuschäfer, Krzysztof Kozlowski,
Uwe Kleine-König, Geert Uytterhoeven, Biju Das,
Claudiu Beznea, Jianlong Huang, linux-arm-kernel, linux-gpio,
linux-kernel, linux-mediatek, openbmc, linux-mips, linux-arm-msm,
linux-renesas-soc
Cc: Ray Jui, Scott Branden, Broadcom internal kernel review list,
Dong Aisheng, Fabio Estevam, Shawn Guo, Jacky Bai,
Pengutronix Kernel Team, Sascha Hauer, NXP Linux Team, Sean Wang,
Paul Cercueil, Lakshmi Sowjanya D, Andy Gross, Bjorn Andersson,
Konrad Dybcio, Emil Renner Berthing, Hal Feng
of_property_count_u32_elems() might return an error code in some cases.
It's naturally better to assign what it's returned to the err variable
and supply the real code to the upper layer(s). Besides that, it's a
common practice to avoid assignments for the data in cases when we know
that the error condition happened. Refactor the code accordingly.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/pinctrl/pinctrl-equilibrium.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-equilibrium.c b/drivers/pinctrl/pinctrl-equilibrium.c
index 5b5ddf7e5d0e..54755b583d3f 100644
--- a/drivers/pinctrl/pinctrl-equilibrium.c
+++ b/drivers/pinctrl/pinctrl-equilibrium.c
@@ -715,12 +715,13 @@ static int eqbr_build_groups(struct eqbr_pinctrl_drv_data *drvdata)
if (!prop)
continue;
- group.num_pins = of_property_count_u32_elems(np, "pins");
- if (group.num_pins < 0) {
+ err = of_property_count_u32_elems(np, "pins");
+ if (err < 0) {
dev_err(dev, "No pins in the group: %s\n", prop->name);
of_node_put(np);
- return -EINVAL;
+ return err;
}
+ group.num_pins = err;
group.name = prop->value;
group.pins = devm_kcalloc(dev, group.num_pins,
sizeof(*(group.pins)), GFP_KERNEL);
--
2.43.0.rc1.1.gbec44491f096
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH v3 04/22] pinctrl: equilibrium: Use temporary variable to hold pins
2023-11-28 19:56 [PATCH v3 00/22] pinctrl: Convert struct group_desc to use struct pingroup Andy Shevchenko
` (2 preceding siblings ...)
2023-11-28 19:56 ` [PATCH v3 03/22] pinctrl: equilibrium: Unshadow error code of of_property_count_u32_elems() Andy Shevchenko
@ 2023-11-28 19:56 ` Andy Shevchenko
2023-11-28 19:56 ` [PATCH v3 05/22] pinctrl: imx: " Andy Shevchenko
` (17 subsequent siblings)
21 siblings, 0 replies; 32+ messages in thread
From: Andy Shevchenko @ 2023-11-28 19:56 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Andy Shevchenko,
Rasmus Villemoes, Jonathan Neuschäfer, Krzysztof Kozlowski,
Uwe Kleine-König, Geert Uytterhoeven, Biju Das,
Claudiu Beznea, Jianlong Huang, linux-arm-kernel, linux-gpio,
linux-kernel, linux-mediatek, openbmc, linux-mips, linux-arm-msm,
linux-renesas-soc
Cc: Ray Jui, Scott Branden, Broadcom internal kernel review list,
Dong Aisheng, Fabio Estevam, Shawn Guo, Jacky Bai,
Pengutronix Kernel Team, Sascha Hauer, NXP Linux Team, Sean Wang,
Paul Cercueil, Lakshmi Sowjanya D, Andy Gross, Bjorn Andersson,
Konrad Dybcio, Emil Renner Berthing, Hal Feng
The pins are allocated from the heap, but in order to pass
them as constant object, we need to use non-constant pointer.
Achieve this by using a temporary variable.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/pinctrl/pinctrl-equilibrium.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-equilibrium.c b/drivers/pinctrl/pinctrl-equilibrium.c
index 54755b583d3f..fd59cfdeefac 100644
--- a/drivers/pinctrl/pinctrl-equilibrium.c
+++ b/drivers/pinctrl/pinctrl-equilibrium.c
@@ -704,7 +704,7 @@ static int eqbr_build_groups(struct eqbr_pinctrl_drv_data *drvdata)
{
struct device *dev = drvdata->dev;
struct device_node *node = dev->of_node;
- unsigned int *pinmux, pin_id, pinmux_id;
+ unsigned int *pins, *pinmux, pin_id, pinmux_id;
struct group_desc group;
struct device_node *np;
struct property *prop;
@@ -723,15 +723,14 @@ static int eqbr_build_groups(struct eqbr_pinctrl_drv_data *drvdata)
}
group.num_pins = err;
group.name = prop->value;
- group.pins = devm_kcalloc(dev, group.num_pins,
- sizeof(*(group.pins)), GFP_KERNEL);
- if (!group.pins) {
+ pins = devm_kcalloc(dev, group.num_pins, sizeof(*pins), GFP_KERNEL);
+ if (!pins) {
of_node_put(np);
return -ENOMEM;
}
+ group.pins = pins;
- pinmux = devm_kcalloc(dev, group.num_pins, sizeof(*pinmux),
- GFP_KERNEL);
+ pinmux = devm_kcalloc(dev, group.num_pins, sizeof(*pinmux), GFP_KERNEL);
if (!pinmux) {
of_node_put(np);
return -ENOMEM;
@@ -750,7 +749,7 @@ static int eqbr_build_groups(struct eqbr_pinctrl_drv_data *drvdata)
of_node_put(np);
return -EINVAL;
}
- group.pins[j] = pin_id;
+ pins[j] = pin_id;
if (of_property_read_u32_index(np, "pinmux", j, &pinmux_id)) {
dev_err(dev, "Group %s: Read intel pinmux id failed\n",
group.name);
--
2.43.0.rc1.1.gbec44491f096
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH v3 05/22] pinctrl: imx: Use temporary variable to hold pins
2023-11-28 19:56 [PATCH v3 00/22] pinctrl: Convert struct group_desc to use struct pingroup Andy Shevchenko
` (3 preceding siblings ...)
2023-11-28 19:56 ` [PATCH v3 04/22] pinctrl: equilibrium: Use temporary variable to hold pins Andy Shevchenko
@ 2023-11-28 19:56 ` Andy Shevchenko
2023-11-28 19:56 ` [PATCH v3 06/22] pinctrl: core: Make pins const in struct group_desc Andy Shevchenko
` (16 subsequent siblings)
21 siblings, 0 replies; 32+ messages in thread
From: Andy Shevchenko @ 2023-11-28 19:56 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Andy Shevchenko,
Rasmus Villemoes, Jonathan Neuschäfer, Krzysztof Kozlowski,
Uwe Kleine-König, Geert Uytterhoeven, Biju Das,
Claudiu Beznea, Jianlong Huang, linux-arm-kernel, linux-gpio,
linux-kernel, linux-mediatek, openbmc, linux-mips, linux-arm-msm,
linux-renesas-soc
Cc: Ray Jui, Scott Branden, Broadcom internal kernel review list,
Dong Aisheng, Fabio Estevam, Shawn Guo, Jacky Bai,
Pengutronix Kernel Team, Sascha Hauer, NXP Linux Team, Sean Wang,
Paul Cercueil, Lakshmi Sowjanya D, Andy Gross, Bjorn Andersson,
Konrad Dybcio, Emil Renner Berthing, Hal Feng
The pins are allocated from the heap, but in order to pass
them as constant object, we need to use non-constant pointer.
Achieve this by using a temporary variable.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/pinctrl/freescale/pinctrl-imx.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c b/drivers/pinctrl/freescale/pinctrl-imx.c
index 9bc16943014f..9099a7c81d4a 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx.c
@@ -513,6 +513,7 @@ static int imx_pinctrl_parse_groups(struct device_node *np,
struct imx_pin *pin;
int size, pin_size;
const __be32 *list;
+ int *pins;
int i;
dev_dbg(ipctl->dev, "group(%d): %pOFn\n", index, np);
@@ -557,20 +558,20 @@ static int imx_pinctrl_parse_groups(struct device_node *np,
grp->data = devm_kcalloc(ipctl->dev,
grp->num_pins, sizeof(struct imx_pin),
GFP_KERNEL);
- grp->pins = devm_kcalloc(ipctl->dev,
- grp->num_pins, sizeof(unsigned int),
- GFP_KERNEL);
- if (!grp->pins || !grp->data)
+ if (!grp->data)
return -ENOMEM;
+ pins = devm_kcalloc(ipctl->dev, grp->num_pins, sizeof(*pins), GFP_KERNEL);
+ if (!pins)
+ return -ENOMEM;
+ grp->pins = pins;
+
for (i = 0; i < grp->num_pins; i++) {
pin = &((struct imx_pin *)(grp->data))[i];
if (info->flags & IMX_USE_SCU)
- info->imx_pinctrl_parse_pin(ipctl, &grp->pins[i],
- pin, &list);
+ info->imx_pinctrl_parse_pin(ipctl, &pins[i], pin, &list);
else
- imx_pinctrl_parse_pin_mmio(ipctl, &grp->pins[i],
- pin, &list, np);
+ imx_pinctrl_parse_pin_mmio(ipctl, &pins[i], pin, &list, np);
}
return 0;
--
2.43.0.rc1.1.gbec44491f096
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH v3 06/22] pinctrl: core: Make pins const in struct group_desc
2023-11-28 19:56 [PATCH v3 00/22] pinctrl: Convert struct group_desc to use struct pingroup Andy Shevchenko
` (4 preceding siblings ...)
2023-11-28 19:56 ` [PATCH v3 05/22] pinctrl: imx: " Andy Shevchenko
@ 2023-11-28 19:56 ` Andy Shevchenko
2023-11-29 11:21 ` Geert Uytterhoeven
2023-11-28 19:56 ` [PATCH v3 07/22] pinctrl: equilibrium: Convert to use struct pingroup Andy Shevchenko
` (15 subsequent siblings)
21 siblings, 1 reply; 32+ messages in thread
From: Andy Shevchenko @ 2023-11-28 19:56 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Andy Shevchenko,
Rasmus Villemoes, Jonathan Neuschäfer, Krzysztof Kozlowski,
Uwe Kleine-König, Geert Uytterhoeven, Biju Das,
Claudiu Beznea, Jianlong Huang, linux-arm-kernel, linux-gpio,
linux-kernel, linux-mediatek, openbmc, linux-mips, linux-arm-msm,
linux-renesas-soc
Cc: Ray Jui, Scott Branden, Broadcom internal kernel review list,
Dong Aisheng, Fabio Estevam, Shawn Guo, Jacky Bai,
Pengutronix Kernel Team, Sascha Hauer, NXP Linux Team, Sean Wang,
Paul Cercueil, Lakshmi Sowjanya D, Andy Gross, Bjorn Andersson,
Konrad Dybcio, Emil Renner Berthing, Hal Feng
It's unclear why it's not a const from day 1. Make the pins member
const in struct group_desc. Update necessary APIs.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/pinctrl/core.c | 2 +-
drivers/pinctrl/core.h | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index f2977eb65522..d20e3aad923e 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -642,7 +642,7 @@ static int pinctrl_generic_group_name_to_selector(struct pinctrl_dev *pctldev,
* Note that the caller must take care of locking.
*/
int pinctrl_generic_add_group(struct pinctrl_dev *pctldev, const char *name,
- int *pins, int num_pins, void *data)
+ const int *pins, int num_pins, void *data)
{
struct group_desc *group;
int selector, error;
diff --git a/drivers/pinctrl/core.h b/drivers/pinctrl/core.h
index 530370443c19..01ea1ce99fe8 100644
--- a/drivers/pinctrl/core.h
+++ b/drivers/pinctrl/core.h
@@ -203,7 +203,7 @@ struct pinctrl_maps {
*/
struct group_desc {
const char *name;
- int *pins;
+ const int *pins;
int num_pins;
void *data;
};
@@ -222,7 +222,7 @@ struct group_desc *pinctrl_generic_get_group(struct pinctrl_dev *pctldev,
unsigned int group_selector);
int pinctrl_generic_add_group(struct pinctrl_dev *pctldev, const char *name,
- int *gpins, int ngpins, void *data);
+ const int *pins, int num_pins, void *data);
int pinctrl_generic_remove_group(struct pinctrl_dev *pctldev,
unsigned int group_selector);
--
2.43.0.rc1.1.gbec44491f096
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH v3 07/22] pinctrl: equilibrium: Convert to use struct pingroup
2023-11-28 19:56 [PATCH v3 00/22] pinctrl: Convert struct group_desc to use struct pingroup Andy Shevchenko
` (5 preceding siblings ...)
2023-11-28 19:56 ` [PATCH v3 06/22] pinctrl: core: Make pins const in struct group_desc Andy Shevchenko
@ 2023-11-28 19:56 ` Andy Shevchenko
2023-11-28 19:56 ` [PATCH v3 08/22] pinctrl: keembay: " Andy Shevchenko
` (14 subsequent siblings)
21 siblings, 0 replies; 32+ messages in thread
From: Andy Shevchenko @ 2023-11-28 19:56 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Andy Shevchenko,
Rasmus Villemoes, Jonathan Neuschäfer, Krzysztof Kozlowski,
Uwe Kleine-König, Geert Uytterhoeven, Biju Das,
Claudiu Beznea, Jianlong Huang, linux-arm-kernel, linux-gpio,
linux-kernel, linux-mediatek, openbmc, linux-mips, linux-arm-msm,
linux-renesas-soc
Cc: Ray Jui, Scott Branden, Broadcom internal kernel review list,
Dong Aisheng, Fabio Estevam, Shawn Guo, Jacky Bai,
Pengutronix Kernel Team, Sascha Hauer, NXP Linux Team, Sean Wang,
Paul Cercueil, Lakshmi Sowjanya D, Andy Gross, Bjorn Andersson,
Konrad Dybcio, Emil Renner Berthing, Hal Feng
The pin control header provides struct pingroup.
Utilize it instead of open coded variants in the driver.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/pinctrl/pinctrl-equilibrium.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-equilibrium.c b/drivers/pinctrl/pinctrl-equilibrium.c
index fd59cfdeefac..4ebae516d1b1 100644
--- a/drivers/pinctrl/pinctrl-equilibrium.c
+++ b/drivers/pinctrl/pinctrl-equilibrium.c
@@ -705,7 +705,7 @@ static int eqbr_build_groups(struct eqbr_pinctrl_drv_data *drvdata)
struct device *dev = drvdata->dev;
struct device_node *node = dev->of_node;
unsigned int *pins, *pinmux, pin_id, pinmux_id;
- struct group_desc group;
+ struct pingroup group, *grp = &group;
struct device_node *np;
struct property *prop;
int j, err;
@@ -721,49 +721,49 @@ static int eqbr_build_groups(struct eqbr_pinctrl_drv_data *drvdata)
of_node_put(np);
return err;
}
- group.num_pins = err;
- group.name = prop->value;
- pins = devm_kcalloc(dev, group.num_pins, sizeof(*pins), GFP_KERNEL);
+ grp->npins = err;
+ grp->name = prop->value;
+ pins = devm_kcalloc(dev, grp->npins, sizeof(*pins), GFP_KERNEL);
if (!pins) {
of_node_put(np);
return -ENOMEM;
}
- group.pins = pins;
+ grp->pins = pins;
- pinmux = devm_kcalloc(dev, group.num_pins, sizeof(*pinmux), GFP_KERNEL);
+ pinmux = devm_kcalloc(dev, grp->npins, sizeof(*pinmux), GFP_KERNEL);
if (!pinmux) {
of_node_put(np);
return -ENOMEM;
}
- for (j = 0; j < group.num_pins; j++) {
+ for (j = 0; j < grp->npins; j++) {
if (of_property_read_u32_index(np, "pins", j, &pin_id)) {
dev_err(dev, "Group %s: Read intel pins id failed\n",
- group.name);
+ grp->name);
of_node_put(np);
return -EINVAL;
}
if (pin_id >= drvdata->pctl_desc.npins) {
dev_err(dev, "Group %s: Invalid pin ID, idx: %d, pin %u\n",
- group.name, j, pin_id);
+ grp->name, j, pin_id);
of_node_put(np);
return -EINVAL;
}
pins[j] = pin_id;
if (of_property_read_u32_index(np, "pinmux", j, &pinmux_id)) {
dev_err(dev, "Group %s: Read intel pinmux id failed\n",
- group.name);
+ grp->name);
of_node_put(np);
return -EINVAL;
}
pinmux[j] = pinmux_id;
}
- err = pinctrl_generic_add_group(drvdata->pctl_dev, group.name,
- group.pins, group.num_pins,
+ err = pinctrl_generic_add_group(drvdata->pctl_dev,
+ grp->name, grp->pins, grp->npins,
pinmux);
if (err < 0) {
- dev_err(dev, "Failed to register group %s\n", group.name);
+ dev_err(dev, "Failed to register group %s\n", grp->name);
of_node_put(np);
return err;
}
--
2.43.0.rc1.1.gbec44491f096
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH v3 08/22] pinctrl: keembay: Convert to use struct pingroup
2023-11-28 19:56 [PATCH v3 00/22] pinctrl: Convert struct group_desc to use struct pingroup Andy Shevchenko
` (6 preceding siblings ...)
2023-11-28 19:56 ` [PATCH v3 07/22] pinctrl: equilibrium: Convert to use struct pingroup Andy Shevchenko
@ 2023-11-28 19:56 ` Andy Shevchenko
2023-11-28 19:56 ` [PATCH v3 09/22] pinctrl: nuvoton: Convert to use struct pingroup and PINCTRL_PINGROUP() Andy Shevchenko
` (13 subsequent siblings)
21 siblings, 0 replies; 32+ messages in thread
From: Andy Shevchenko @ 2023-11-28 19:56 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Andy Shevchenko,
Rasmus Villemoes, Jonathan Neuschäfer, Krzysztof Kozlowski,
Uwe Kleine-König, Geert Uytterhoeven, Biju Das,
Claudiu Beznea, Jianlong Huang, linux-arm-kernel, linux-gpio,
linux-kernel, linux-mediatek, openbmc, linux-mips, linux-arm-msm,
linux-renesas-soc
Cc: Ray Jui, Scott Branden, Broadcom internal kernel review list,
Dong Aisheng, Fabio Estevam, Shawn Guo, Jacky Bai,
Pengutronix Kernel Team, Sascha Hauer, NXP Linux Team, Sean Wang,
Paul Cercueil, Lakshmi Sowjanya D, Andy Gross, Bjorn Andersson,
Konrad Dybcio, Emil Renner Berthing, Hal Feng
The pin control header provides struct pingroup.
Utilize it instead of open coded variants in the driver.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/pinctrl/pinctrl-keembay.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-keembay.c b/drivers/pinctrl/pinctrl-keembay.c
index 152c35bce8ec..87d328853ae4 100644
--- a/drivers/pinctrl/pinctrl-keembay.c
+++ b/drivers/pinctrl/pinctrl-keembay.c
@@ -1517,7 +1517,7 @@ static int keembay_gpiochip_probe(struct keembay_pinctrl *kpc,
static int keembay_build_groups(struct keembay_pinctrl *kpc)
{
- struct group_desc *grp;
+ struct pingroup *grp;
unsigned int i;
kpc->ngroups = kpc->npins;
@@ -1528,7 +1528,7 @@ static int keembay_build_groups(struct keembay_pinctrl *kpc)
/* Each pin is categorised as one group */
for (i = 0; i < kpc->ngroups; i++) {
const struct pinctrl_pin_desc *pdesc = keembay_pins + i;
- struct group_desc *kmb_grp = grp + i;
+ struct pingroup *kmb_grp = grp + i;
kmb_grp->name = pdesc->name;
kmb_grp->pins = (int *)&pdesc->number;
--
2.43.0.rc1.1.gbec44491f096
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH v3 09/22] pinctrl: nuvoton: Convert to use struct pingroup and PINCTRL_PINGROUP()
2023-11-28 19:56 [PATCH v3 00/22] pinctrl: Convert struct group_desc to use struct pingroup Andy Shevchenko
` (7 preceding siblings ...)
2023-11-28 19:56 ` [PATCH v3 08/22] pinctrl: keembay: " Andy Shevchenko
@ 2023-11-28 19:56 ` Andy Shevchenko
2023-11-28 19:56 ` [PATCH v3 10/22] pinctrl: core: Add a convenient define PINCTRL_GROUP_DESC() Andy Shevchenko
` (12 subsequent siblings)
21 siblings, 0 replies; 32+ messages in thread
From: Andy Shevchenko @ 2023-11-28 19:56 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Andy Shevchenko,
Rasmus Villemoes, Jonathan Neuschäfer, Krzysztof Kozlowski,
Uwe Kleine-König, Geert Uytterhoeven, Biju Das,
Claudiu Beznea, Jianlong Huang, linux-arm-kernel, linux-gpio,
linux-kernel, linux-mediatek, openbmc, linux-mips, linux-arm-msm,
linux-renesas-soc
Cc: Ray Jui, Scott Branden, Broadcom internal kernel review list,
Dong Aisheng, Fabio Estevam, Shawn Guo, Jacky Bai,
Pengutronix Kernel Team, Sascha Hauer, NXP Linux Team, Sean Wang,
Paul Cercueil, Lakshmi Sowjanya D, Andy Gross, Bjorn Andersson,
Konrad Dybcio, Emil Renner Berthing, Hal Feng
The pin control header provides struct pingroup and PINCTRL_PINGROUP() macro.
Utilize them instead of open coded variants in the driver.
Reviewed-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/pinctrl/nuvoton/pinctrl-wpcm450.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c b/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
index 0cff44b07b29..4589900244c7 100644
--- a/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
+++ b/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
@@ -474,9 +474,8 @@ enum {
#undef WPCM450_GRP
};
-static struct group_desc wpcm450_groups[] = {
-#define WPCM450_GRP(x) { .name = #x, .pins = x ## _pins, \
- .num_pins = ARRAY_SIZE(x ## _pins) }
+static struct pingroup wpcm450_groups[] = {
+#define WPCM450_GRP(x) PINCTRL_PINGROUP(#x, x ## _pins, ARRAY_SIZE(x ## _pins))
WPCM450_GRPS
#undef WPCM450_GRP
};
@@ -852,7 +851,7 @@ static int wpcm450_get_group_pins(struct pinctrl_dev *pctldev,
const unsigned int **pins,
unsigned int *npins)
{
- *npins = wpcm450_groups[selector].num_pins;
+ *npins = wpcm450_groups[selector].npins;
*pins = wpcm450_groups[selector].pins;
return 0;
@@ -901,7 +900,7 @@ static int wpcm450_pinmux_set_mux(struct pinctrl_dev *pctldev,
struct wpcm450_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
wpcm450_setfunc(pctrl->gcr_regmap, wpcm450_groups[group].pins,
- wpcm450_groups[group].num_pins, function);
+ wpcm450_groups[group].npins, function);
return 0;
}
--
2.43.0.rc1.1.gbec44491f096
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH v3 10/22] pinctrl: core: Add a convenient define PINCTRL_GROUP_DESC()
2023-11-28 19:56 [PATCH v3 00/22] pinctrl: Convert struct group_desc to use struct pingroup Andy Shevchenko
` (8 preceding siblings ...)
2023-11-28 19:56 ` [PATCH v3 09/22] pinctrl: nuvoton: Convert to use struct pingroup and PINCTRL_PINGROUP() Andy Shevchenko
@ 2023-11-28 19:56 ` Andy Shevchenko
2023-11-29 11:12 ` Geert Uytterhoeven
2023-11-28 19:57 ` [PATCH v3 11/22] pinctrl: ingenic: Make use of PINCTRL_GROUP_DESC() Andy Shevchenko
` (11 subsequent siblings)
21 siblings, 1 reply; 32+ messages in thread
From: Andy Shevchenko @ 2023-11-28 19:56 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Andy Shevchenko,
Rasmus Villemoes, Jonathan Neuschäfer, Krzysztof Kozlowski,
Uwe Kleine-König, Geert Uytterhoeven, Biju Das,
Claudiu Beznea, Jianlong Huang, linux-arm-kernel, linux-gpio,
linux-kernel, linux-mediatek, openbmc, linux-mips, linux-arm-msm,
linux-renesas-soc
Cc: Ray Jui, Scott Branden, Broadcom internal kernel review list,
Dong Aisheng, Fabio Estevam, Shawn Guo, Jacky Bai,
Pengutronix Kernel Team, Sascha Hauer, NXP Linux Team, Sean Wang,
Paul Cercueil, Lakshmi Sowjanya D, Andy Gross, Bjorn Andersson,
Konrad Dybcio, Emil Renner Berthing, Hal Feng
Add PINCTRL_GROUP_DESC() macro for inline use.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/pinctrl/core.c | 5 +----
drivers/pinctrl/core.h | 9 +++++++++
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index d20e3aad923e..3f1fd50fbb10 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -660,10 +660,7 @@ int pinctrl_generic_add_group(struct pinctrl_dev *pctldev, const char *name,
if (!group)
return -ENOMEM;
- group->name = name;
- group->pins = pins;
- group->num_pins = num_pins;
- group->data = data;
+ *group = PINCTRL_GROUP_DESC(name, pins, num_pins, data);
error = radix_tree_insert(&pctldev->pin_group_tree, selector, group);
if (error)
diff --git a/drivers/pinctrl/core.h b/drivers/pinctrl/core.h
index 01ea1ce99fe8..276a631fd49c 100644
--- a/drivers/pinctrl/core.h
+++ b/drivers/pinctrl/core.h
@@ -208,6 +208,15 @@ struct group_desc {
void *data;
};
+/* Convenience macro to define a generic pin group descriptor */
+#define PINCTRL_GROUP_DESC(_name, _pins, _num_pins, _data) \
+(struct group_desc) { \
+ .name = _name, \
+ .pins = _pins, \
+ .num_pins = _num_pins, \
+ .data = _data, \
+}
+
int pinctrl_generic_get_group_count(struct pinctrl_dev *pctldev);
const char *pinctrl_generic_get_group_name(struct pinctrl_dev *pctldev,
--
2.43.0.rc1.1.gbec44491f096
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH v3 11/22] pinctrl: ingenic: Make use of PINCTRL_GROUP_DESC()
2023-11-28 19:56 [PATCH v3 00/22] pinctrl: Convert struct group_desc to use struct pingroup Andy Shevchenko
` (9 preceding siblings ...)
2023-11-28 19:56 ` [PATCH v3 10/22] pinctrl: core: Add a convenient define PINCTRL_GROUP_DESC() Andy Shevchenko
@ 2023-11-28 19:57 ` Andy Shevchenko
2023-11-29 12:40 ` Paul Cercueil
2023-11-28 19:57 ` [PATCH v3 12/22] pinctrl: mediatek: " Andy Shevchenko
` (10 subsequent siblings)
21 siblings, 1 reply; 32+ messages in thread
From: Andy Shevchenko @ 2023-11-28 19:57 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Andy Shevchenko,
Rasmus Villemoes, Jonathan Neuschäfer, Krzysztof Kozlowski,
Uwe Kleine-König, Geert Uytterhoeven, Biju Das,
Claudiu Beznea, Jianlong Huang, linux-arm-kernel, linux-gpio,
linux-kernel, linux-mediatek, openbmc, linux-mips, linux-arm-msm,
linux-renesas-soc
Cc: Ray Jui, Scott Branden, Broadcom internal kernel review list,
Dong Aisheng, Fabio Estevam, Shawn Guo, Jacky Bai,
Pengutronix Kernel Team, Sascha Hauer, NXP Linux Team, Sean Wang,
Paul Cercueil, Lakshmi Sowjanya D, Andy Gross, Bjorn Andersson,
Konrad Dybcio, Emil Renner Berthing, Hal Feng
Make use of PINCTRL_GROUP_DESC() instead of open coding it.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/pinctrl/pinctrl-ingenic.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-ingenic.c b/drivers/pinctrl/pinctrl-ingenic.c
index ee718f6e2556..393873de910a 100644
--- a/drivers/pinctrl/pinctrl-ingenic.c
+++ b/drivers/pinctrl/pinctrl-ingenic.c
@@ -83,15 +83,10 @@
#define JZ4730_PINS_PER_PAIRED_REG 16
#define INGENIC_PIN_GROUP_FUNCS(name, id, funcs) \
- { \
- name, \
- id##_pins, \
- ARRAY_SIZE(id##_pins), \
- funcs, \
- }
+ PINCTRL_GROUP_DESC(name, id##_pins, ARRAY_SIZE(id##_pins), funcs)
#define INGENIC_PIN_GROUP(name, id, func) \
- INGENIC_PIN_GROUP_FUNCS(name, id, (void *)(func))
+ PINCTRL_GROUP_DESC(name, id##_pins, ARRAY_SIZE(id##_pins), (void *)(func))
enum jz_version {
ID_JZ4730,
--
2.43.0.rc1.1.gbec44491f096
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH v3 12/22] pinctrl: mediatek: Make use of PINCTRL_GROUP_DESC()
2023-11-28 19:56 [PATCH v3 00/22] pinctrl: Convert struct group_desc to use struct pingroup Andy Shevchenko
` (10 preceding siblings ...)
2023-11-28 19:57 ` [PATCH v3 11/22] pinctrl: ingenic: Make use of PINCTRL_GROUP_DESC() Andy Shevchenko
@ 2023-11-28 19:57 ` Andy Shevchenko
2023-11-28 19:57 ` [PATCH v3 13/22] pinctrl: core: Embed struct pingroup into struct group_desc Andy Shevchenko
` (9 subsequent siblings)
21 siblings, 0 replies; 32+ messages in thread
From: Andy Shevchenko @ 2023-11-28 19:57 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Andy Shevchenko,
Rasmus Villemoes, Jonathan Neuschäfer, Krzysztof Kozlowski,
Uwe Kleine-König, Geert Uytterhoeven, Biju Das,
Claudiu Beznea, Jianlong Huang, linux-arm-kernel, linux-gpio,
linux-kernel, linux-mediatek, openbmc, linux-mips, linux-arm-msm,
linux-renesas-soc
Cc: Ray Jui, Scott Branden, Broadcom internal kernel review list,
Dong Aisheng, Fabio Estevam, Shawn Guo, Jacky Bai,
Pengutronix Kernel Team, Sascha Hauer, NXP Linux Team, Sean Wang,
Paul Cercueil, Lakshmi Sowjanya D, Andy Gross, Bjorn Andersson,
Konrad Dybcio, Emil Renner Berthing, Hal Feng
Make use of PINCTRL_GROUP_DESC() instead of open coding it.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/pinctrl/mediatek/pinctrl-moore.h | 7 +------
drivers/pinctrl/mediatek/pinctrl-paris.h | 7 +------
2 files changed, 2 insertions(+), 12 deletions(-)
diff --git a/drivers/pinctrl/mediatek/pinctrl-moore.h b/drivers/pinctrl/mediatek/pinctrl-moore.h
index e1b4b82b9d3d..22ef1ffbcdcb 100644
--- a/drivers/pinctrl/mediatek/pinctrl-moore.h
+++ b/drivers/pinctrl/mediatek/pinctrl-moore.h
@@ -38,12 +38,7 @@
}
#define PINCTRL_PIN_GROUP(name, id) \
- { \
- name, \
- id##_pins, \
- ARRAY_SIZE(id##_pins), \
- id##_funcs, \
- }
+ PINCTRL_GROUP_DESC(name, id##_pins, ARRAY_SIZE(id##_pins), id##_funcs)
int mtk_moore_pinctrl_probe(struct platform_device *pdev,
const struct mtk_pin_soc *soc);
diff --git a/drivers/pinctrl/mediatek/pinctrl-paris.h b/drivers/pinctrl/mediatek/pinctrl-paris.h
index 8762ac599329..f208a904c4a8 100644
--- a/drivers/pinctrl/mediatek/pinctrl-paris.h
+++ b/drivers/pinctrl/mediatek/pinctrl-paris.h
@@ -50,12 +50,7 @@
}
#define PINCTRL_PIN_GROUP(name, id) \
- { \
- name, \
- id##_pins, \
- ARRAY_SIZE(id##_pins), \
- id##_funcs, \
- }
+ PINCTRL_GROUP_DESC(name, id##_pins, ARRAY_SIZE(id##_pins), id##_funcs)
int mtk_paris_pinctrl_probe(struct platform_device *pdev);
--
2.43.0.rc1.1.gbec44491f096
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH v3 13/22] pinctrl: core: Embed struct pingroup into struct group_desc
2023-11-28 19:56 [PATCH v3 00/22] pinctrl: Convert struct group_desc to use struct pingroup Andy Shevchenko
` (11 preceding siblings ...)
2023-11-28 19:57 ` [PATCH v3 12/22] pinctrl: mediatek: " Andy Shevchenko
@ 2023-11-28 19:57 ` Andy Shevchenko
2023-11-29 11:14 ` Geert Uytterhoeven
2023-11-28 19:57 ` [PATCH v3 14/22] pinctrl: bcm: Convert to use grp member Andy Shevchenko
` (8 subsequent siblings)
21 siblings, 1 reply; 32+ messages in thread
From: Andy Shevchenko @ 2023-11-28 19:57 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Andy Shevchenko,
Rasmus Villemoes, Jonathan Neuschäfer, Krzysztof Kozlowski,
Uwe Kleine-König, Geert Uytterhoeven, Biju Das,
Claudiu Beznea, Jianlong Huang, linux-arm-kernel, linux-gpio,
linux-kernel, linux-mediatek, openbmc, linux-mips, linux-arm-msm,
linux-renesas-soc
Cc: Ray Jui, Scott Branden, Broadcom internal kernel review list,
Dong Aisheng, Fabio Estevam, Shawn Guo, Jacky Bai,
Pengutronix Kernel Team, Sascha Hauer, NXP Linux Team, Sean Wang,
Paul Cercueil, Lakshmi Sowjanya D, Andy Gross, Bjorn Andersson,
Konrad Dybcio, Emil Renner Berthing, Hal Feng
struct group_desc is a particular version of the struct pingroup
with associated opaque data. Start switching pin control core and
drivers to use it explicitly.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/pinctrl/core.c | 15 ++++++++++++---
drivers/pinctrl/core.h | 5 +++++
2 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index 3f1fd50fbb10..e08d4b3b0a56 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -559,7 +559,10 @@ const char *pinctrl_generic_get_group_name(struct pinctrl_dev *pctldev,
if (!group)
return NULL;
- return group->name;
+ if (group->name)
+ return group->name;
+
+ return group->grp.name;
}
EXPORT_SYMBOL_GPL(pinctrl_generic_get_group_name);
@@ -585,8 +588,14 @@ int pinctrl_generic_get_group_pins(struct pinctrl_dev *pctldev,
return -EINVAL;
}
- *pins = group->pins;
- *num_pins = group->num_pins;
+ if (group->pins) {
+ *pins = group->pins;
+ *num_pins = group->num_pins;
+ return 0;
+ }
+
+ *pins = group->grp.pins;
+ *num_pins = group->grp.npins;
return 0;
}
diff --git a/drivers/pinctrl/core.h b/drivers/pinctrl/core.h
index 276a631fd49c..863b4956a41e 100644
--- a/drivers/pinctrl/core.h
+++ b/drivers/pinctrl/core.h
@@ -194,14 +194,18 @@ struct pinctrl_maps {
#ifdef CONFIG_GENERIC_PINCTRL_GROUPS
+#include <linux/pinctrl/pinctrl.h>
+
/**
* struct group_desc - generic pin group descriptor
+ * @grp: generic data of the pin group (name and pins)
* @name: name of the pin group
* @pins: array of pins that belong to the group
* @num_pins: number of pins in the group
* @data: pin controller driver specific data
*/
struct group_desc {
+ struct pingroup grp;
const char *name;
const int *pins;
int num_pins;
@@ -211,6 +215,7 @@ struct group_desc {
/* Convenience macro to define a generic pin group descriptor */
#define PINCTRL_GROUP_DESC(_name, _pins, _num_pins, _data) \
(struct group_desc) { \
+ .grp = PINCTRL_PINGROUP(_name, _pins, _num_pins), \
.name = _name, \
.pins = _pins, \
.num_pins = _num_pins, \
--
2.43.0.rc1.1.gbec44491f096
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH v3 14/22] pinctrl: bcm: Convert to use grp member
2023-11-28 19:56 [PATCH v3 00/22] pinctrl: Convert struct group_desc to use struct pingroup Andy Shevchenko
` (12 preceding siblings ...)
2023-11-28 19:57 ` [PATCH v3 13/22] pinctrl: core: Embed struct pingroup into struct group_desc Andy Shevchenko
@ 2023-11-28 19:57 ` Andy Shevchenko
2023-11-28 19:57 ` [PATCH v3 15/22] pinctrl: equilibrium: " Andy Shevchenko
` (7 subsequent siblings)
21 siblings, 0 replies; 32+ messages in thread
From: Andy Shevchenko @ 2023-11-28 19:57 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Andy Shevchenko,
Rasmus Villemoes, Jonathan Neuschäfer, Krzysztof Kozlowski,
Uwe Kleine-König, Geert Uytterhoeven, Biju Das,
Claudiu Beznea, Jianlong Huang, linux-arm-kernel, linux-gpio,
linux-kernel, linux-mediatek, openbmc, linux-mips, linux-arm-msm,
linux-renesas-soc
Cc: Ray Jui, Scott Branden, Broadcom internal kernel review list,
Dong Aisheng, Fabio Estevam, Shawn Guo, Jacky Bai,
Pengutronix Kernel Team, Sascha Hauer, NXP Linux Team, Sean Wang,
Paul Cercueil, Lakshmi Sowjanya D, Andy Gross, Bjorn Andersson,
Konrad Dybcio, Emil Renner Berthing, Hal Feng, Florian Fainelli
Convert drivers to use grp member embedded in struct group_desc.
Tested-by: Florian Fainelli <florian.fainelli@broadcom.com>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/pinctrl/bcm/pinctrl-ns.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/pinctrl/bcm/pinctrl-ns.c b/drivers/pinctrl/bcm/pinctrl-ns.c
index d099a7f25f64..6bb2b461950b 100644
--- a/drivers/pinctrl/bcm/pinctrl-ns.c
+++ b/drivers/pinctrl/bcm/pinctrl-ns.c
@@ -171,8 +171,8 @@ static int ns_pinctrl_set_mux(struct pinctrl_dev *pctrl_dev,
if (!group)
return -EINVAL;
- for (i = 0; i < group->num_pins; i++)
- unset |= BIT(group->pins[i]);
+ for (i = 0; i < group->grp.npins; i++)
+ unset |= BIT(group->grp.pins[i]);
tmp = readl(ns_pinctrl->base);
tmp &= ~unset;
--
2.43.0.rc1.1.gbec44491f096
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH v3 15/22] pinctrl: equilibrium: Convert to use grp member
2023-11-28 19:56 [PATCH v3 00/22] pinctrl: Convert struct group_desc to use struct pingroup Andy Shevchenko
` (13 preceding siblings ...)
2023-11-28 19:57 ` [PATCH v3 14/22] pinctrl: bcm: Convert to use grp member Andy Shevchenko
@ 2023-11-28 19:57 ` Andy Shevchenko
2023-11-28 19:57 ` [PATCH v3 16/22] pinctrl: imx: " Andy Shevchenko
` (6 subsequent siblings)
21 siblings, 0 replies; 32+ messages in thread
From: Andy Shevchenko @ 2023-11-28 19:57 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Andy Shevchenko,
Rasmus Villemoes, Jonathan Neuschäfer, Krzysztof Kozlowski,
Uwe Kleine-König, Geert Uytterhoeven, Biju Das,
Claudiu Beznea, Jianlong Huang, linux-arm-kernel, linux-gpio,
linux-kernel, linux-mediatek, openbmc, linux-mips, linux-arm-msm,
linux-renesas-soc
Cc: Ray Jui, Scott Branden, Broadcom internal kernel review list,
Dong Aisheng, Fabio Estevam, Shawn Guo, Jacky Bai,
Pengutronix Kernel Team, Sascha Hauer, NXP Linux Team, Sean Wang,
Paul Cercueil, Lakshmi Sowjanya D, Andy Gross, Bjorn Andersson,
Konrad Dybcio, Emil Renner Berthing, Hal Feng
Convert drivers to use grp member embedded in struct group_desc.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/pinctrl/pinctrl-equilibrium.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-equilibrium.c b/drivers/pinctrl/pinctrl-equilibrium.c
index 4ebae516d1b1..6e1be38865c3 100644
--- a/drivers/pinctrl/pinctrl-equilibrium.c
+++ b/drivers/pinctrl/pinctrl-equilibrium.c
@@ -331,8 +331,8 @@ static int eqbr_pinmux_set_mux(struct pinctrl_dev *pctldev,
return -EINVAL;
pinmux = grp->data;
- for (i = 0; i < grp->num_pins; i++)
- eqbr_set_pin_mux(pctl, pinmux[i], grp->pins[i]);
+ for (i = 0; i < grp->grp.npins; i++)
+ eqbr_set_pin_mux(pctl, pinmux[i], grp->grp.pins[i]);
return 0;
}
--
2.43.0.rc1.1.gbec44491f096
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH v3 16/22] pinctrl: imx: Convert to use grp member
2023-11-28 19:56 [PATCH v3 00/22] pinctrl: Convert struct group_desc to use struct pingroup Andy Shevchenko
` (14 preceding siblings ...)
2023-11-28 19:57 ` [PATCH v3 15/22] pinctrl: equilibrium: " Andy Shevchenko
@ 2023-11-28 19:57 ` Andy Shevchenko
2023-11-28 19:57 ` [PATCH v3 17/22] pinctrl: ingenic: " Andy Shevchenko
` (5 subsequent siblings)
21 siblings, 0 replies; 32+ messages in thread
From: Andy Shevchenko @ 2023-11-28 19:57 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Andy Shevchenko,
Rasmus Villemoes, Jonathan Neuschäfer, Krzysztof Kozlowski,
Uwe Kleine-König, Geert Uytterhoeven, Biju Das,
Claudiu Beznea, Jianlong Huang, linux-arm-kernel, linux-gpio,
linux-kernel, linux-mediatek, openbmc, linux-mips, linux-arm-msm,
linux-renesas-soc
Cc: Ray Jui, Scott Branden, Broadcom internal kernel review list,
Dong Aisheng, Fabio Estevam, Shawn Guo, Jacky Bai,
Pengutronix Kernel Team, Sascha Hauer, NXP Linux Team, Sean Wang,
Paul Cercueil, Lakshmi Sowjanya D, Andy Gross, Bjorn Andersson,
Konrad Dybcio, Emil Renner Berthing, Hal Feng
Convert drivers to use grp member embedded in struct group_desc.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/pinctrl/freescale/pinctrl-imx.c | 31 +++++++++++--------------
1 file changed, 14 insertions(+), 17 deletions(-)
diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c b/drivers/pinctrl/freescale/pinctrl-imx.c
index 9099a7c81d4a..4245189b59a5 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx.c
@@ -42,7 +42,7 @@ static inline const struct group_desc *imx_pinctrl_find_group_by_name(
for (i = 0; i < pctldev->num_groups; i++) {
grp = pinctrl_generic_get_group(pctldev, i);
- if (grp && !strcmp(grp->name, name))
+ if (grp && !strcmp(grp->grp.name, name))
break;
}
@@ -79,9 +79,9 @@ static int imx_dt_node_to_map(struct pinctrl_dev *pctldev,
}
if (info->flags & IMX_USE_SCU) {
- map_num += grp->num_pins;
+ map_num += grp->grp.npins;
} else {
- for (i = 0; i < grp->num_pins; i++) {
+ for (i = 0; i < grp->grp.npins; i++) {
pin = &((struct imx_pin *)(grp->data))[i];
if (!(pin->conf.mmio.config & IMX_NO_PAD_CTL))
map_num++;
@@ -109,7 +109,7 @@ static int imx_dt_node_to_map(struct pinctrl_dev *pctldev,
/* create config map */
new_map++;
- for (i = j = 0; i < grp->num_pins; i++) {
+ for (i = j = 0; i < grp->grp.npins; i++) {
pin = &((struct imx_pin *)(grp->data))[i];
/*
@@ -263,10 +263,10 @@ static int imx_pmx_set(struct pinctrl_dev *pctldev, unsigned selector,
if (!func)
return -EINVAL;
- npins = grp->num_pins;
+ npins = grp->grp.npins;
dev_dbg(ipctl->dev, "enable function %s group %s\n",
- func->name, grp->name);
+ func->name, grp->grp.name);
for (i = 0; i < npins; i++) {
/*
@@ -423,7 +423,7 @@ static void imx_pinconf_group_dbg_show(struct pinctrl_dev *pctldev,
if (!grp)
return;
- for (i = 0; i < grp->num_pins; i++) {
+ for (i = 0; i < grp->grp.npins; i++) {
struct imx_pin *pin = &((struct imx_pin *)(grp->data))[i];
name = pin_get_name(pctldev, pin->pin);
@@ -526,7 +526,7 @@ static int imx_pinctrl_parse_groups(struct device_node *np,
pin_size = FSL_PIN_SIZE;
/* Initialise group */
- grp->name = np->name;
+ grp->grp.name = np->name;
/*
* the binding format is fsl,pins = <PIN_FUNC_ID CONFIG ...>,
@@ -554,19 +554,17 @@ static int imx_pinctrl_parse_groups(struct device_node *np,
return -EINVAL;
}
- grp->num_pins = size / pin_size;
- grp->data = devm_kcalloc(ipctl->dev,
- grp->num_pins, sizeof(struct imx_pin),
- GFP_KERNEL);
+ grp->grp.npins = size / pin_size;
+ grp->data = devm_kcalloc(ipctl->dev, grp->grp.npins, sizeof(*pin), GFP_KERNEL);
if (!grp->data)
return -ENOMEM;
- pins = devm_kcalloc(ipctl->dev, grp->num_pins, sizeof(*pins), GFP_KERNEL);
+ pins = devm_kcalloc(ipctl->dev, grp->grp.npins, sizeof(*pins), GFP_KERNEL);
if (!pins)
return -ENOMEM;
- grp->pins = pins;
+ grp->grp.pins = pins;
- for (i = 0; i < grp->num_pins; i++) {
+ for (i = 0; i < grp->grp.npins; i++) {
pin = &((struct imx_pin *)(grp->data))[i];
if (info->flags & IMX_USE_SCU)
info->imx_pinctrl_parse_pin(ipctl, &pins[i], pin, &list);
@@ -613,8 +611,7 @@ static int imx_pinctrl_parse_functions(struct device_node *np,
i = 0;
for_each_child_of_node(np, child) {
- grp = devm_kzalloc(ipctl->dev, sizeof(struct group_desc),
- GFP_KERNEL);
+ grp = devm_kzalloc(ipctl->dev, sizeof(*grp), GFP_KERNEL);
if (!grp) {
of_node_put(child);
return -ENOMEM;
--
2.43.0.rc1.1.gbec44491f096
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH v3 17/22] pinctrl: ingenic: Convert to use grp member
2023-11-28 19:56 [PATCH v3 00/22] pinctrl: Convert struct group_desc to use struct pingroup Andy Shevchenko
` (15 preceding siblings ...)
2023-11-28 19:57 ` [PATCH v3 16/22] pinctrl: imx: " Andy Shevchenko
@ 2023-11-28 19:57 ` Andy Shevchenko
2023-11-28 19:57 ` [PATCH v3 18/22] pinctrl: keembay: " Andy Shevchenko
` (4 subsequent siblings)
21 siblings, 0 replies; 32+ messages in thread
From: Andy Shevchenko @ 2023-11-28 19:57 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Andy Shevchenko,
Rasmus Villemoes, Jonathan Neuschäfer, Krzysztof Kozlowski,
Uwe Kleine-König, Geert Uytterhoeven, Biju Das,
Claudiu Beznea, Jianlong Huang, linux-arm-kernel, linux-gpio,
linux-kernel, linux-mediatek, openbmc, linux-mips, linux-arm-msm,
linux-renesas-soc
Cc: Ray Jui, Scott Branden, Broadcom internal kernel review list,
Dong Aisheng, Fabio Estevam, Shawn Guo, Jacky Bai,
Pengutronix Kernel Team, Sascha Hauer, NXP Linux Team, Sean Wang,
Paul Cercueil, Lakshmi Sowjanya D, Andy Gross, Bjorn Andersson,
Konrad Dybcio, Emil Renner Berthing, Hal Feng
Convert drivers to use grp member embedded in struct group_desc.
Acked-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/pinctrl/pinctrl-ingenic.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-ingenic.c b/drivers/pinctrl/pinctrl-ingenic.c
index 393873de910a..6806fede5df4 100644
--- a/drivers/pinctrl/pinctrl-ingenic.c
+++ b/drivers/pinctrl/pinctrl-ingenic.c
@@ -3756,17 +3756,17 @@ static int ingenic_pinmux_set_mux(struct pinctrl_dev *pctldev,
return -EINVAL;
dev_dbg(pctldev->dev, "enable function %s group %s\n",
- func->name, grp->name);
+ func->name, grp->grp.name);
mode = (uintptr_t)grp->data;
if (mode <= 3) {
- for (i = 0; i < grp->num_pins; i++)
- ingenic_pinmux_set_pin_fn(jzpc, grp->pins[i], mode);
+ for (i = 0; i < grp->grp.npins; i++)
+ ingenic_pinmux_set_pin_fn(jzpc, grp->grp.pins[i], mode);
} else {
pin_modes = grp->data;
- for (i = 0; i < grp->num_pins; i++)
- ingenic_pinmux_set_pin_fn(jzpc, grp->pins[i], pin_modes[i]);
+ for (i = 0; i < grp->grp.npins; i++)
+ ingenic_pinmux_set_pin_fn(jzpc, grp->grp.pins[i], pin_modes[i]);
}
return 0;
@@ -4293,12 +4293,12 @@ static int __init ingenic_pinctrl_probe(struct platform_device *pdev)
for (i = 0; i < chip_info->num_groups; i++) {
const struct group_desc *group = &chip_info->groups[i];
+ const struct pingroup *grp = &group->grp;
- err = pinctrl_generic_add_group(jzpc->pctl, group->name,
- group->pins, group->num_pins, group->data);
+ err = pinctrl_generic_add_group(jzpc->pctl, grp->name, grp->pins, grp->npins,
+ group->data);
if (err < 0) {
- dev_err(dev, "Failed to register group %s\n",
- group->name);
+ dev_err(dev, "Failed to register group %s\n", grp->name);
return err;
}
}
--
2.43.0.rc1.1.gbec44491f096
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH v3 18/22] pinctrl: keembay: Convert to use grp member
2023-11-28 19:56 [PATCH v3 00/22] pinctrl: Convert struct group_desc to use struct pingroup Andy Shevchenko
` (16 preceding siblings ...)
2023-11-28 19:57 ` [PATCH v3 17/22] pinctrl: ingenic: " Andy Shevchenko
@ 2023-11-28 19:57 ` Andy Shevchenko
2023-11-28 19:57 ` [PATCH v3 19/22] pinctrl: mediatek: " Andy Shevchenko
` (3 subsequent siblings)
21 siblings, 0 replies; 32+ messages in thread
From: Andy Shevchenko @ 2023-11-28 19:57 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Andy Shevchenko,
Rasmus Villemoes, Jonathan Neuschäfer, Krzysztof Kozlowski,
Uwe Kleine-König, Geert Uytterhoeven, Biju Das,
Claudiu Beznea, Jianlong Huang, linux-arm-kernel, linux-gpio,
linux-kernel, linux-mediatek, openbmc, linux-mips, linux-arm-msm,
linux-renesas-soc
Cc: Ray Jui, Scott Branden, Broadcom internal kernel review list,
Dong Aisheng, Fabio Estevam, Shawn Guo, Jacky Bai,
Pengutronix Kernel Team, Sascha Hauer, NXP Linux Team, Sean Wang,
Paul Cercueil, Lakshmi Sowjanya D, Andy Gross, Bjorn Andersson,
Konrad Dybcio, Emil Renner Berthing, Hal Feng
Convert drivers to use grp member embedded in struct group_desc.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/pinctrl/pinctrl-keembay.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pinctrl/pinctrl-keembay.c b/drivers/pinctrl/pinctrl-keembay.c
index 87d328853ae4..b1349ee22799 100644
--- a/drivers/pinctrl/pinctrl-keembay.c
+++ b/drivers/pinctrl/pinctrl-keembay.c
@@ -945,7 +945,7 @@ static int keembay_set_mux(struct pinctrl_dev *pctldev, unsigned int fun_sel,
return -EINVAL;
/* Change modes for pins in the selected group */
- pin = *grp->pins;
+ pin = *grp->grp.pins;
pin_mode = *(u8 *)(func->data);
val = keembay_read_reg(kpc->base1 + KEEMBAY_GPIO_MODE, pin);
--
2.43.0.rc1.1.gbec44491f096
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH v3 19/22] pinctrl: mediatek: Convert to use grp member
2023-11-28 19:56 [PATCH v3 00/22] pinctrl: Convert struct group_desc to use struct pingroup Andy Shevchenko
` (17 preceding siblings ...)
2023-11-28 19:57 ` [PATCH v3 18/22] pinctrl: keembay: " Andy Shevchenko
@ 2023-11-28 19:57 ` Andy Shevchenko
2023-11-28 19:57 ` [PATCH v3 20/22] pinctrl: renesas: " Andy Shevchenko
` (2 subsequent siblings)
21 siblings, 0 replies; 32+ messages in thread
From: Andy Shevchenko @ 2023-11-28 19:57 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Andy Shevchenko,
Rasmus Villemoes, Jonathan Neuschäfer, Krzysztof Kozlowski,
Uwe Kleine-König, Geert Uytterhoeven, Biju Das,
Claudiu Beznea, Jianlong Huang, linux-arm-kernel, linux-gpio,
linux-kernel, linux-mediatek, openbmc, linux-mips, linux-arm-msm,
linux-renesas-soc
Cc: Ray Jui, Scott Branden, Broadcom internal kernel review list,
Dong Aisheng, Fabio Estevam, Shawn Guo, Jacky Bai,
Pengutronix Kernel Team, Sascha Hauer, NXP Linux Team, Sean Wang,
Paul Cercueil, Lakshmi Sowjanya D, Andy Gross, Bjorn Andersson,
Konrad Dybcio, Emil Renner Berthing, Hal Feng
Convert drivers to use grp member embedded in struct group_desc.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/pinctrl/mediatek/pinctrl-moore.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/drivers/pinctrl/mediatek/pinctrl-moore.c b/drivers/pinctrl/mediatek/pinctrl-moore.c
index c3d59eddd994..d972584c0519 100644
--- a/drivers/pinctrl/mediatek/pinctrl-moore.c
+++ b/drivers/pinctrl/mediatek/pinctrl-moore.c
@@ -56,12 +56,12 @@ static int mtk_pinmux_set_mux(struct pinctrl_dev *pctldev,
return -EINVAL;
dev_dbg(pctldev->dev, "enable function %s group %s\n",
- func->name, grp->name);
+ func->name, grp->grp.name);
- for (i = 0; i < grp->num_pins; i++) {
+ for (i = 0; i < grp->grp.npins; i++) {
const struct mtk_pin_desc *desc;
int *pin_modes = grp->data;
- int pin = grp->pins[i];
+ int pin = grp->grp.pins[i];
desc = (const struct mtk_pin_desc *)&hw->soc->pins[pin];
if (!desc->name)
@@ -602,13 +602,12 @@ static int mtk_build_groups(struct mtk_pinctrl *hw)
for (i = 0; i < hw->soc->ngrps; i++) {
const struct group_desc *group = hw->soc->grps + i;
+ const struct pingroup *grp = &group->grp;
- err = pinctrl_generic_add_group(hw->pctrl, group->name,
- group->pins, group->num_pins,
+ err = pinctrl_generic_add_group(hw->pctrl, grp->name, grp->pins, grp->npins,
group->data);
if (err < 0) {
- dev_err(hw->dev, "Failed to register group %s\n",
- group->name);
+ dev_err(hw->dev, "Failed to register group %s\n", grp->name);
return err;
}
}
--
2.43.0.rc1.1.gbec44491f096
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH v3 20/22] pinctrl: renesas: Convert to use grp member
2023-11-28 19:56 [PATCH v3 00/22] pinctrl: Convert struct group_desc to use struct pingroup Andy Shevchenko
` (18 preceding siblings ...)
2023-11-28 19:57 ` [PATCH v3 19/22] pinctrl: mediatek: " Andy Shevchenko
@ 2023-11-28 19:57 ` Andy Shevchenko
2023-11-29 11:10 ` Geert Uytterhoeven
2023-11-28 19:57 ` [PATCH v3 21/22] pinctrl: starfive: " Andy Shevchenko
2023-11-28 19:57 ` [PATCH v3 22/22] pinctrl: core: Remove unused members from struct group_desc Andy Shevchenko
21 siblings, 1 reply; 32+ messages in thread
From: Andy Shevchenko @ 2023-11-28 19:57 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Andy Shevchenko,
Rasmus Villemoes, Jonathan Neuschäfer, Krzysztof Kozlowski,
Uwe Kleine-König, Geert Uytterhoeven, Biju Das,
Claudiu Beznea, Jianlong Huang, linux-arm-kernel, linux-gpio,
linux-kernel, linux-mediatek, openbmc, linux-mips, linux-arm-msm,
linux-renesas-soc
Cc: Ray Jui, Scott Branden, Broadcom internal kernel review list,
Dong Aisheng, Fabio Estevam, Shawn Guo, Jacky Bai,
Pengutronix Kernel Team, Sascha Hauer, NXP Linux Team, Sean Wang,
Paul Cercueil, Lakshmi Sowjanya D, Andy Gross, Bjorn Andersson,
Konrad Dybcio, Emil Renner Berthing, Hal Feng
Convert drivers to use grp member embedded in struct group_desc.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/pinctrl/renesas/pinctrl-rza1.c | 2 +-
drivers/pinctrl/renesas/pinctrl-rza2.c | 10 +++++-----
drivers/pinctrl/renesas/pinctrl-rzg2l.c | 6 +++---
drivers/pinctrl/renesas/pinctrl-rzv2m.c | 6 +++---
4 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/drivers/pinctrl/renesas/pinctrl-rza1.c b/drivers/pinctrl/renesas/pinctrl-rza1.c
index ab334de89b69..b03f22c54ca8 100644
--- a/drivers/pinctrl/renesas/pinctrl-rza1.c
+++ b/drivers/pinctrl/renesas/pinctrl-rza1.c
@@ -1131,7 +1131,7 @@ static int rza1_set_mux(struct pinctrl_dev *pctldev, unsigned int selector,
return -EINVAL;
mux_confs = (struct rza1_mux_conf *)func->data;
- for (i = 0; i < grp->num_pins; ++i) {
+ for (i = 0; i < grp->grp.npins; ++i) {
int ret;
ret = rza1_pin_mux_single(rza1_pctl, &mux_confs[i]);
diff --git a/drivers/pinctrl/renesas/pinctrl-rza2.c b/drivers/pinctrl/renesas/pinctrl-rza2.c
index 990b96d45967..af689d7c117f 100644
--- a/drivers/pinctrl/renesas/pinctrl-rza2.c
+++ b/drivers/pinctrl/renesas/pinctrl-rza2.c
@@ -447,15 +447,15 @@ static int rza2_set_mux(struct pinctrl_dev *pctldev, unsigned int selector,
psel_val = func->data;
- for (i = 0; i < grp->num_pins; ++i) {
+ for (i = 0; i < grp->grp.npins; ++i) {
dev_dbg(priv->dev, "Setting P%c_%d to PSEL=%d\n",
- port_names[RZA2_PIN_ID_TO_PORT(grp->pins[i])],
- RZA2_PIN_ID_TO_PIN(grp->pins[i]),
+ port_names[RZA2_PIN_ID_TO_PORT(grp->grp.pins[i])],
+ RZA2_PIN_ID_TO_PIN(grp->grp.pins[i]),
psel_val[i]);
rza2_set_pin_function(
priv->base,
- RZA2_PIN_ID_TO_PORT(grp->pins[i]),
- RZA2_PIN_ID_TO_PIN(grp->pins[i]),
+ RZA2_PIN_ID_TO_PORT(grp->grp.pins[i]),
+ RZA2_PIN_ID_TO_PIN(grp->grp.pins[i]),
psel_val[i]);
}
diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
index aed59c53207c..3cfe4558eb92 100644
--- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c
+++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
@@ -273,7 +273,7 @@ static int rzg2l_pinctrl_set_mux(struct pinctrl_dev *pctldev,
struct function_desc *func;
unsigned int i, *psel_val;
struct group_desc *group;
- int *pins;
+ const int *pins;
func = pinmux_generic_get_function(pctldev, func_selector);
if (!func)
@@ -283,9 +283,9 @@ static int rzg2l_pinctrl_set_mux(struct pinctrl_dev *pctldev,
return -EINVAL;
psel_val = func->data;
- pins = group->pins;
+ pins = group->grp.pins;
- for (i = 0; i < group->num_pins; i++) {
+ for (i = 0; i < group->grp.npins; i++) {
unsigned int *pin_data = pctrl->desc.pins[pins[i]].drv_data;
u32 off = RZG2L_PIN_CFG_TO_PORT_OFFSET(*pin_data);
u32 pin = RZG2L_PIN_ID_TO_PIN(pins[i]);
diff --git a/drivers/pinctrl/renesas/pinctrl-rzv2m.c b/drivers/pinctrl/renesas/pinctrl-rzv2m.c
index 21d7d5ac8c4a..eb66e306b8c8 100644
--- a/drivers/pinctrl/renesas/pinctrl-rzv2m.c
+++ b/drivers/pinctrl/renesas/pinctrl-rzv2m.c
@@ -165,7 +165,7 @@ static int rzv2m_pinctrl_set_mux(struct pinctrl_dev *pctldev,
struct function_desc *func;
unsigned int i, *psel_val;
struct group_desc *group;
- int *pins;
+ const int *pins;
func = pinmux_generic_get_function(pctldev, func_selector);
if (!func)
@@ -175,9 +175,9 @@ static int rzv2m_pinctrl_set_mux(struct pinctrl_dev *pctldev,
return -EINVAL;
psel_val = func->data;
- pins = group->pins;
+ pins = group->grp.pins;
- for (i = 0; i < group->num_pins; i++) {
+ for (i = 0; i < group->grp.npins; i++) {
dev_dbg(pctrl->dev, "port:%u pin: %u PSEL:%u\n",
RZV2M_PIN_ID_TO_PORT(pins[i]), RZV2M_PIN_ID_TO_PIN(pins[i]),
psel_val[i]);
--
2.43.0.rc1.1.gbec44491f096
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH v3 21/22] pinctrl: starfive: Convert to use grp member
2023-11-28 19:56 [PATCH v3 00/22] pinctrl: Convert struct group_desc to use struct pingroup Andy Shevchenko
` (19 preceding siblings ...)
2023-11-28 19:57 ` [PATCH v3 20/22] pinctrl: renesas: " Andy Shevchenko
@ 2023-11-28 19:57 ` Andy Shevchenko
2023-11-28 19:57 ` [PATCH v3 22/22] pinctrl: core: Remove unused members from struct group_desc Andy Shevchenko
21 siblings, 0 replies; 32+ messages in thread
From: Andy Shevchenko @ 2023-11-28 19:57 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Andy Shevchenko,
Rasmus Villemoes, Jonathan Neuschäfer, Krzysztof Kozlowski,
Uwe Kleine-König, Geert Uytterhoeven, Biju Das,
Claudiu Beznea, Jianlong Huang, linux-arm-kernel, linux-gpio,
linux-kernel, linux-mediatek, openbmc, linux-mips, linux-arm-msm,
linux-renesas-soc
Cc: Ray Jui, Scott Branden, Broadcom internal kernel review list,
Dong Aisheng, Fabio Estevam, Shawn Guo, Jacky Bai,
Pengutronix Kernel Team, Sascha Hauer, NXP Linux Team, Sean Wang,
Paul Cercueil, Lakshmi Sowjanya D, Andy Gross, Bjorn Andersson,
Konrad Dybcio, Emil Renner Berthing, Hal Feng,
Emil Renner Berthing
Convert drivers to use grp member embedded in struct group_desc.
Reviewed-by: Emil Renner Berthing <emil.renner.berthing@canonical.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c | 8 ++++----
drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c | 8 ++++----
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c b/drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c
index ea70b8c61679..21bfbbaede72 100644
--- a/drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c
+++ b/drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c
@@ -654,7 +654,7 @@ static int starfive_set_mux(struct pinctrl_dev *pctldev,
return -EINVAL;
pinmux = group->data;
- for (i = 0; i < group->num_pins; i++) {
+ for (i = 0; i < group->grp.npins; i++) {
u32 v = pinmux[i];
unsigned int gpio = starfive_pinmux_to_gpio(v);
u32 dout = starfive_pinmux_to_dout(v);
@@ -797,7 +797,7 @@ static int starfive_pinconf_group_get(struct pinctrl_dev *pctldev,
if (!group)
return -EINVAL;
- return starfive_pinconf_get(pctldev, group->pins[0], config);
+ return starfive_pinconf_get(pctldev, group->grp.pins[0], config);
}
static int starfive_pinconf_group_set(struct pinctrl_dev *pctldev,
@@ -876,8 +876,8 @@ static int starfive_pinconf_group_set(struct pinctrl_dev *pctldev,
}
}
- for (i = 0; i < group->num_pins; i++)
- starfive_padctl_rmw(sfp, group->pins[i], mask, value);
+ for (i = 0; i < group->grp.npins; i++)
+ starfive_padctl_rmw(sfp, group->grp.pins[i], mask, value);
return 0;
}
diff --git a/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c b/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c
index 9d71e8c13310..60160965cd29 100644
--- a/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c
+++ b/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c
@@ -307,7 +307,7 @@ static int jh7110_set_mux(struct pinctrl_dev *pctldev,
return -EINVAL;
pinmux = group->data;
- for (i = 0; i < group->num_pins; i++) {
+ for (i = 0; i < group->grp.npins; i++) {
u32 v = pinmux[i];
if (info->jh7110_set_one_pin_mux)
@@ -437,7 +437,7 @@ static int jh7110_pinconf_group_get(struct pinctrl_dev *pctldev,
if (!group)
return -EINVAL;
- return jh7110_pinconf_get(pctldev, group->pins[0], config);
+ return jh7110_pinconf_get(pctldev, group->grp.pins[0], config);
}
static int jh7110_pinconf_group_set(struct pinctrl_dev *pctldev,
@@ -508,8 +508,8 @@ static int jh7110_pinconf_group_set(struct pinctrl_dev *pctldev,
}
}
- for (i = 0; i < group->num_pins; i++)
- jh7110_padcfg_rmw(sfp, group->pins[i], mask, value);
+ for (i = 0; i < group->grp.npins; i++)
+ jh7110_padcfg_rmw(sfp, group->grp.pins[i], mask, value);
return 0;
}
--
2.43.0.rc1.1.gbec44491f096
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH v3 22/22] pinctrl: core: Remove unused members from struct group_desc
2023-11-28 19:56 [PATCH v3 00/22] pinctrl: Convert struct group_desc to use struct pingroup Andy Shevchenko
` (20 preceding siblings ...)
2023-11-28 19:57 ` [PATCH v3 21/22] pinctrl: starfive: " Andy Shevchenko
@ 2023-11-28 19:57 ` Andy Shevchenko
2023-11-29 11:14 ` Geert Uytterhoeven
21 siblings, 1 reply; 32+ messages in thread
From: Andy Shevchenko @ 2023-11-28 19:57 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Andy Shevchenko,
Rasmus Villemoes, Jonathan Neuschäfer, Krzysztof Kozlowski,
Uwe Kleine-König, Geert Uytterhoeven, Biju Das,
Claudiu Beznea, Jianlong Huang, linux-arm-kernel, linux-gpio,
linux-kernel, linux-mediatek, openbmc, linux-mips, linux-arm-msm,
linux-renesas-soc
Cc: Ray Jui, Scott Branden, Broadcom internal kernel review list,
Dong Aisheng, Fabio Estevam, Shawn Guo, Jacky Bai,
Pengutronix Kernel Team, Sascha Hauer, NXP Linux Team, Sean Wang,
Paul Cercueil, Lakshmi Sowjanya D, Andy Gross, Bjorn Andersson,
Konrad Dybcio, Emil Renner Berthing, Hal Feng
All drivers are converted to use embedded struct pingroup.
Remove unused members from struct group_desc.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/pinctrl/core.c | 9 ---------
drivers/pinctrl/core.h | 9 ---------
2 files changed, 18 deletions(-)
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index e08d4b3b0a56..88de80187445 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -559,9 +559,6 @@ const char *pinctrl_generic_get_group_name(struct pinctrl_dev *pctldev,
if (!group)
return NULL;
- if (group->name)
- return group->name;
-
return group->grp.name;
}
EXPORT_SYMBOL_GPL(pinctrl_generic_get_group_name);
@@ -588,12 +585,6 @@ int pinctrl_generic_get_group_pins(struct pinctrl_dev *pctldev,
return -EINVAL;
}
- if (group->pins) {
- *pins = group->pins;
- *num_pins = group->num_pins;
- return 0;
- }
-
*pins = group->grp.pins;
*num_pins = group->grp.npins;
diff --git a/drivers/pinctrl/core.h b/drivers/pinctrl/core.h
index 863b4956a41e..c1ace4c2eccc 100644
--- a/drivers/pinctrl/core.h
+++ b/drivers/pinctrl/core.h
@@ -199,16 +199,10 @@ struct pinctrl_maps {
/**
* struct group_desc - generic pin group descriptor
* @grp: generic data of the pin group (name and pins)
- * @name: name of the pin group
- * @pins: array of pins that belong to the group
- * @num_pins: number of pins in the group
* @data: pin controller driver specific data
*/
struct group_desc {
struct pingroup grp;
- const char *name;
- const int *pins;
- int num_pins;
void *data;
};
@@ -216,9 +210,6 @@ struct group_desc {
#define PINCTRL_GROUP_DESC(_name, _pins, _num_pins, _data) \
(struct group_desc) { \
.grp = PINCTRL_PINGROUP(_name, _pins, _num_pins), \
- .name = _name, \
- .pins = _pins, \
- .num_pins = _num_pins, \
.data = _data, \
}
--
2.43.0.rc1.1.gbec44491f096
^ permalink raw reply related [flat|nested] 32+ messages in thread
* Re: [PATCH v3 20/22] pinctrl: renesas: Convert to use grp member
2023-11-28 19:57 ` [PATCH v3 20/22] pinctrl: renesas: " Andy Shevchenko
@ 2023-11-29 11:10 ` Geert Uytterhoeven
0 siblings, 0 replies; 32+ messages in thread
From: Geert Uytterhoeven @ 2023-11-29 11:10 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Linus Walleij, Bartosz Golaszewski, Rasmus Villemoes,
Jonathan Neuschäfer, Krzysztof Kozlowski,
Uwe Kleine-König, Geert Uytterhoeven, Biju Das,
Claudiu Beznea, Jianlong Huang, linux-arm-kernel, linux-gpio,
linux-kernel, linux-mediatek, openbmc, linux-mips, linux-arm-msm,
linux-renesas-soc, Ray Jui, Scott Branden,
Broadcom internal kernel review list, Dong Aisheng, Fabio Estevam,
Shawn Guo, Jacky Bai, Pengutronix Kernel Team, Sascha Hauer,
NXP Linux Team, Sean Wang, Paul Cercueil, Lakshmi Sowjanya D,
Andy Gross, Bjorn Andersson, Konrad Dybcio, Emil Renner Berthing,
Hal Feng
Hi Andy,
On Tue, Nov 28, 2023 at 9:04 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> Convert drivers to use grp member embedded in struct group_desc.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Thanks for your patch!
> --- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c
> +++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
> @@ -273,7 +273,7 @@ static int rzg2l_pinctrl_set_mux(struct pinctrl_dev *pctldev,
> struct function_desc *func;
> unsigned int i, *psel_val;
> struct group_desc *group;
> - int *pins;
> + const int *pins;
unsigned, as this no longer signed.
>
> func = pinmux_generic_get_function(pctldev, func_selector);
> if (!func)
> @@ -283,9 +283,9 @@ static int rzg2l_pinctrl_set_mux(struct pinctrl_dev *pctldev,
> return -EINVAL;
>
> psel_val = func->data;
> - pins = group->pins;
> + pins = group->grp.pins;
> --- a/drivers/pinctrl/renesas/pinctrl-rzv2m.c
> +++ b/drivers/pinctrl/renesas/pinctrl-rzv2m.c
> @@ -165,7 +165,7 @@ static int rzv2m_pinctrl_set_mux(struct pinctrl_dev *pctldev,
> struct function_desc *func;
> unsigned int i, *psel_val;
> struct group_desc *group;
> - int *pins;
> + const int *pins;
unsigned
>
> func = pinmux_generic_get_function(pctldev, func_selector);
> if (!func)
> @@ -175,9 +175,9 @@ static int rzv2m_pinctrl_set_mux(struct pinctrl_dev *pctldev,
> return -EINVAL;
>
> psel_val = func->data;
> - pins = group->pins;
> + pins = group->grp.pins;
With the above fixed:
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH v3 10/22] pinctrl: core: Add a convenient define PINCTRL_GROUP_DESC()
2023-11-28 19:56 ` [PATCH v3 10/22] pinctrl: core: Add a convenient define PINCTRL_GROUP_DESC() Andy Shevchenko
@ 2023-11-29 11:12 ` Geert Uytterhoeven
0 siblings, 0 replies; 32+ messages in thread
From: Geert Uytterhoeven @ 2023-11-29 11:12 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Linus Walleij, Bartosz Golaszewski, Rasmus Villemoes,
Jonathan Neuschäfer, Krzysztof Kozlowski,
Uwe Kleine-König, Biju Das, Claudiu Beznea, Jianlong Huang,
linux-arm-kernel, linux-gpio, linux-kernel, linux-mediatek,
openbmc, linux-mips, linux-arm-msm, linux-renesas-soc, Ray Jui,
Scott Branden, Broadcom internal kernel review list, Dong Aisheng,
Fabio Estevam, Shawn Guo, Jacky Bai, Pengutronix Kernel Team,
Sascha Hauer, NXP Linux Team, Sean Wang, Paul Cercueil,
Lakshmi Sowjanya D, Andy Gross, Bjorn Andersson, Konrad Dybcio,
Emil Renner Berthing, Hal Feng
On Tue, Nov 28, 2023 at 9:05 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> Add PINCTRL_GROUP_DESC() macro for inline use.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH v3 22/22] pinctrl: core: Remove unused members from struct group_desc
2023-11-28 19:57 ` [PATCH v3 22/22] pinctrl: core: Remove unused members from struct group_desc Andy Shevchenko
@ 2023-11-29 11:14 ` Geert Uytterhoeven
0 siblings, 0 replies; 32+ messages in thread
From: Geert Uytterhoeven @ 2023-11-29 11:14 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Linus Walleij, Bartosz Golaszewski, Rasmus Villemoes,
Jonathan Neuschäfer, Krzysztof Kozlowski,
Uwe Kleine-König, Biju Das, Claudiu Beznea, Jianlong Huang,
linux-arm-kernel, linux-gpio, linux-kernel, linux-mediatek,
openbmc, linux-mips, linux-arm-msm, linux-renesas-soc, Ray Jui,
Scott Branden, Broadcom internal kernel review list, Dong Aisheng,
Fabio Estevam, Shawn Guo, Jacky Bai, Pengutronix Kernel Team,
Sascha Hauer, NXP Linux Team, Sean Wang, Paul Cercueil,
Lakshmi Sowjanya D, Andy Gross, Bjorn Andersson, Konrad Dybcio,
Emil Renner Berthing, Hal Feng
On Tue, Nov 28, 2023 at 9:04 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> All drivers are converted to use embedded struct pingroup.
> Remove unused members from struct group_desc.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH v3 13/22] pinctrl: core: Embed struct pingroup into struct group_desc
2023-11-28 19:57 ` [PATCH v3 13/22] pinctrl: core: Embed struct pingroup into struct group_desc Andy Shevchenko
@ 2023-11-29 11:14 ` Geert Uytterhoeven
0 siblings, 0 replies; 32+ messages in thread
From: Geert Uytterhoeven @ 2023-11-29 11:14 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Linus Walleij, Bartosz Golaszewski, Rasmus Villemoes,
Jonathan Neuschäfer, Krzysztof Kozlowski,
Uwe Kleine-König, Biju Das, Claudiu Beznea, Jianlong Huang,
linux-arm-kernel, linux-gpio, linux-kernel, linux-mediatek,
openbmc, linux-mips, linux-arm-msm, linux-renesas-soc, Ray Jui,
Scott Branden, Broadcom internal kernel review list, Dong Aisheng,
Fabio Estevam, Shawn Guo, Jacky Bai, Pengutronix Kernel Team,
Sascha Hauer, NXP Linux Team, Sean Wang, Paul Cercueil,
Lakshmi Sowjanya D, Andy Gross, Bjorn Andersson, Konrad Dybcio,
Emil Renner Berthing, Hal Feng
On Tue, Nov 28, 2023 at 9:05 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> struct group_desc is a particular version of the struct pingroup
> with associated opaque data. Start switching pin control core and
> drivers to use it explicitly.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH v3 06/22] pinctrl: core: Make pins const in struct group_desc
2023-11-28 19:56 ` [PATCH v3 06/22] pinctrl: core: Make pins const in struct group_desc Andy Shevchenko
@ 2023-11-29 11:21 ` Geert Uytterhoeven
2023-11-29 13:41 ` Andy Shevchenko
0 siblings, 1 reply; 32+ messages in thread
From: Geert Uytterhoeven @ 2023-11-29 11:21 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Linus Walleij, Bartosz Golaszewski, Rasmus Villemoes,
Jonathan Neuschäfer, Krzysztof Kozlowski,
Uwe Kleine-König, Biju Das, Claudiu Beznea, Jianlong Huang,
linux-arm-kernel, linux-gpio, linux-kernel, linux-mediatek,
openbmc, linux-mips, linux-arm-msm, linux-renesas-soc, Ray Jui,
Scott Branden, Broadcom internal kernel review list, Dong Aisheng,
Fabio Estevam, Shawn Guo, Jacky Bai, Pengutronix Kernel Team,
Sascha Hauer, NXP Linux Team, Sean Wang, Paul Cercueil,
Lakshmi Sowjanya D, Andy Gross, Bjorn Andersson, Konrad Dybcio,
Emil Renner Berthing, Hal Feng
Hi Andy,
On Tue, Nov 28, 2023 at 9:04 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> It's unclear why it's not a const from day 1. Make the pins member
> const in struct group_desc. Update necessary APIs.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Thanks for your patch!
> --- a/drivers/pinctrl/core.c
> +++ b/drivers/pinctrl/core.c
> @@ -642,7 +642,7 @@ static int pinctrl_generic_group_name_to_selector(struct pinctrl_dev *pctldev,
> * Note that the caller must take care of locking.
> */
> int pinctrl_generic_add_group(struct pinctrl_dev *pctldev, const char *name,
> - int *pins, int num_pins, void *data)
> + const int *pins, int num_pins, void *data)
> {
> struct group_desc *group;
> int selector, error;
> diff --git a/drivers/pinctrl/core.h b/drivers/pinctrl/core.h
> index 530370443c19..01ea1ce99fe8 100644
> --- a/drivers/pinctrl/core.h
> +++ b/drivers/pinctrl/core.h
> @@ -203,7 +203,7 @@ struct pinctrl_maps {
> */
> struct group_desc {
> const char *name;
> - int *pins;
> + const int *pins;
> int num_pins;
> void *data;
> };
> @@ -222,7 +222,7 @@ struct group_desc *pinctrl_generic_get_group(struct pinctrl_dev *pctldev,
> unsigned int group_selector);
>
> int pinctrl_generic_add_group(struct pinctrl_dev *pctldev, const char *name,
> - int *gpins, int ngpins, void *data);
> + const int *pins, int num_pins, void *data);
>
> int pinctrl_generic_remove_group(struct pinctrl_dev *pctldev,
> unsigned int group_selector);
Probably this is also the right moment to change all of these to arrays
of unsigned ints? Else you will have mixed int/unsigned int after
"[PATCH v3 13/22] pinctrl: core: Embed struct pingroup into struct
group_desc", and purely unsigned int after "[PATCH v3 22/22] pinctrl:
core: Remove unused members from struct group_desc".
The Renesas pinctrl drivers already pass arrays of unsigned ints.
Some other drivers still use arrays of ints, though.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH v3 11/22] pinctrl: ingenic: Make use of PINCTRL_GROUP_DESC()
2023-11-28 19:57 ` [PATCH v3 11/22] pinctrl: ingenic: Make use of PINCTRL_GROUP_DESC() Andy Shevchenko
@ 2023-11-29 12:40 ` Paul Cercueil
0 siblings, 0 replies; 32+ messages in thread
From: Paul Cercueil @ 2023-11-29 12:40 UTC (permalink / raw)
To: Andy Shevchenko, Linus Walleij, Bartosz Golaszewski,
Rasmus Villemoes, Jonathan Neuschäfer, Krzysztof Kozlowski,
Uwe Kleine-König, Geert Uytterhoeven, Biju Das,
Claudiu Beznea, Jianlong Huang, linux-arm-kernel, linux-gpio,
linux-kernel, linux-mediatek, openbmc, linux-mips, linux-arm-msm,
linux-renesas-soc
Cc: Ray Jui, Scott Branden, Broadcom internal kernel review list,
Dong Aisheng, Fabio Estevam, Shawn Guo, Jacky Bai,
Pengutronix Kernel Team, Sascha Hauer, NXP Linux Team, Sean Wang,
Lakshmi Sowjanya D, Andy Gross, Bjorn Andersson, Konrad Dybcio,
Emil Renner Berthing, Hal Feng
Le mardi 28 novembre 2023 à 21:57 +0200, Andy Shevchenko a écrit :
> Make use of PINCTRL_GROUP_DESC() instead of open coding it.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
I missed this one in your V2 (didn't notice that there were 2 patches
touching pinctrl-ingenic).
Acked-by: Paul Cercueil <paul@crapouillou.net>
Cheers,
-Paul
> ---
> drivers/pinctrl/pinctrl-ingenic.c | 9 ++-------
> 1 file changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/pinctrl/pinctrl-ingenic.c
> b/drivers/pinctrl/pinctrl-ingenic.c
> index ee718f6e2556..393873de910a 100644
> --- a/drivers/pinctrl/pinctrl-ingenic.c
> +++ b/drivers/pinctrl/pinctrl-ingenic.c
> @@ -83,15 +83,10 @@
> #define JZ4730_PINS_PER_PAIRED_REG 16
>
> #define INGENIC_PIN_GROUP_FUNCS(name, id, funcs) \
> - { \
> - name, \
> - id##_pins, \
> - ARRAY_SIZE(id##_pins), \
> - funcs, \
> - }
> + PINCTRL_GROUP_DESC(name, id##_pins, ARRAY_SIZE(id##_pins),
> funcs)
>
> #define INGENIC_PIN_GROUP(name, id, func) \
> - INGENIC_PIN_GROUP_FUNCS(name, id, (void *)(func))
> + PINCTRL_GROUP_DESC(name, id##_pins, ARRAY_SIZE(id##_pins),
> (void *)(func))
>
> enum jz_version {
> ID_JZ4730,
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH v3 06/22] pinctrl: core: Make pins const in struct group_desc
2023-11-29 11:21 ` Geert Uytterhoeven
@ 2023-11-29 13:41 ` Andy Shevchenko
2023-11-29 14:23 ` Andy Shevchenko
0 siblings, 1 reply; 32+ messages in thread
From: Andy Shevchenko @ 2023-11-29 13:41 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Linus Walleij, Bartosz Golaszewski, Rasmus Villemoes,
Jonathan Neuschäfer, Krzysztof Kozlowski,
Uwe Kleine-König, Biju Das, Claudiu Beznea, Jianlong Huang,
linux-arm-kernel, linux-gpio, linux-kernel, linux-mediatek,
openbmc, linux-mips, linux-arm-msm, linux-renesas-soc, Ray Jui,
Scott Branden, Broadcom internal kernel review list, Dong Aisheng,
Fabio Estevam, Shawn Guo, Jacky Bai, Pengutronix Kernel Team,
Sascha Hauer, NXP Linux Team, Sean Wang, Paul Cercueil,
Lakshmi Sowjanya D, Andy Gross, Bjorn Andersson, Konrad Dybcio,
Emil Renner Berthing, Hal Feng
On Wed, Nov 29, 2023 at 12:21:45PM +0100, Geert Uytterhoeven wrote:
> On Tue, Nov 28, 2023 at 9:04 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > It's unclear why it's not a const from day 1. Make the pins member
> > const in struct group_desc. Update necessary APIs.
...
> > int pinctrl_generic_add_group(struct pinctrl_dev *pctldev, const char *name,
> > - int *gpins, int ngpins, void *data);
> > + const int *pins, int num_pins, void *data);
> >
> > int pinctrl_generic_remove_group(struct pinctrl_dev *pctldev,
> > unsigned int group_selector);
>
> Probably this is also the right moment to change all of these to arrays
> of unsigned ints? Else you will have mixed int/unsigned int after
> "[PATCH v3 13/22] pinctrl: core: Embed struct pingroup into struct
> group_desc", and purely unsigned int after "[PATCH v3 22/22] pinctrl:
> core: Remove unused members from struct group_desc".
Hmm... Can it be done later?
I can, of course try to change the parameter here to be unsigned, but it most
likely fail the build for those drivers means need more patches, more delay to
this series.
Linus?
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH v3 06/22] pinctrl: core: Make pins const in struct group_desc
2023-11-29 13:41 ` Andy Shevchenko
@ 2023-11-29 14:23 ` Andy Shevchenko
2023-11-29 15:34 ` Geert Uytterhoeven
0 siblings, 1 reply; 32+ messages in thread
From: Andy Shevchenko @ 2023-11-29 14:23 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Linus Walleij, Bartosz Golaszewski, Rasmus Villemoes,
Jonathan Neuschäfer, Krzysztof Kozlowski,
Uwe Kleine-König, Biju Das, Claudiu Beznea, Jianlong Huang,
linux-arm-kernel, linux-gpio, linux-kernel, linux-mediatek,
openbmc, linux-mips, linux-arm-msm, linux-renesas-soc, Ray Jui,
Scott Branden, Broadcom internal kernel review list, Dong Aisheng,
Fabio Estevam, Shawn Guo, Jacky Bai, Pengutronix Kernel Team,
Sascha Hauer, NXP Linux Team, Sean Wang, Paul Cercueil,
Lakshmi Sowjanya D, Andy Gross, Bjorn Andersson, Konrad Dybcio,
Emil Renner Berthing, Hal Feng
On Wed, Nov 29, 2023 at 03:41:55PM +0200, Andy Shevchenko wrote:
> On Wed, Nov 29, 2023 at 12:21:45PM +0100, Geert Uytterhoeven wrote:
> > On Tue, Nov 28, 2023 at 9:04 PM Andy Shevchenko
> > <andriy.shevchenko@linux.intel.com> wrote:
> > > It's unclear why it's not a const from day 1. Make the pins member
> > > const in struct group_desc. Update necessary APIs.
...
> > > int pinctrl_generic_add_group(struct pinctrl_dev *pctldev, const char *name,
> > > - int *gpins, int ngpins, void *data);
> > > + const int *pins, int num_pins, void *data);
> > >
> > > int pinctrl_generic_remove_group(struct pinctrl_dev *pctldev,
> > > unsigned int group_selector);
> >
> > Probably this is also the right moment to change all of these to arrays
> > of unsigned ints? Else you will have mixed int/unsigned int after
> > "[PATCH v3 13/22] pinctrl: core: Embed struct pingroup into struct
> > group_desc", and purely unsigned int after "[PATCH v3 22/22] pinctrl:
> > core: Remove unused members from struct group_desc".
>
> Hmm... Can it be done later?
>
> I can, of course try to change the parameter here to be unsigned, but it most
> likely fail the build for those drivers means need more patches, more delay to
> this series.
>
> Linus?
On the first glance updating API here does not fail the build.
Lemme incorporate this into v4.
Meanwhile the drivers I left untouched, it might be separate changes
to convert from int to const unsigned int.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH v3 06/22] pinctrl: core: Make pins const in struct group_desc
2023-11-29 14:23 ` Andy Shevchenko
@ 2023-11-29 15:34 ` Geert Uytterhoeven
0 siblings, 0 replies; 32+ messages in thread
From: Geert Uytterhoeven @ 2023-11-29 15:34 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Linus Walleij, Bartosz Golaszewski, Rasmus Villemoes,
Jonathan Neuschäfer, Krzysztof Kozlowski,
Uwe Kleine-König, Biju Das, Claudiu Beznea, Jianlong Huang,
linux-arm-kernel, linux-gpio, linux-kernel, linux-mediatek,
openbmc, linux-mips, linux-arm-msm, linux-renesas-soc, Ray Jui,
Scott Branden, Broadcom internal kernel review list, Dong Aisheng,
Fabio Estevam, Shawn Guo, Jacky Bai, Pengutronix Kernel Team,
Sascha Hauer, NXP Linux Team, Sean Wang, Paul Cercueil,
Lakshmi Sowjanya D, Andy Gross, Bjorn Andersson, Konrad Dybcio,
Emil Renner Berthing, Hal Feng
Hi Andy,
On Wed, Nov 29, 2023 at 3:23 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> On Wed, Nov 29, 2023 at 03:41:55PM +0200, Andy Shevchenko wrote:
> > On Wed, Nov 29, 2023 at 12:21:45PM +0100, Geert Uytterhoeven wrote:
> > > On Tue, Nov 28, 2023 at 9:04 PM Andy Shevchenko
> > > <andriy.shevchenko@linux.intel.com> wrote:
> > > > It's unclear why it's not a const from day 1. Make the pins member
> > > > const in struct group_desc. Update necessary APIs.
>
> ...
>
> > > > int pinctrl_generic_add_group(struct pinctrl_dev *pctldev, const char *name,
> > > > - int *gpins, int ngpins, void *data);
> > > > + const int *pins, int num_pins, void *data);
> > > >
> > > > int pinctrl_generic_remove_group(struct pinctrl_dev *pctldev,
> > > > unsigned int group_selector);
> > >
> > > Probably this is also the right moment to change all of these to arrays
> > > of unsigned ints? Else you will have mixed int/unsigned int after
> > > "[PATCH v3 13/22] pinctrl: core: Embed struct pingroup into struct
> > > group_desc", and purely unsigned int after "[PATCH v3 22/22] pinctrl:
> > > core: Remove unused members from struct group_desc".
> >
> > Hmm... Can it be done later?
> >
> > I can, of course try to change the parameter here to be unsigned, but it most
> > likely fail the build for those drivers means need more patches, more delay to
> > this series.
> >
> > Linus?
>
> On the first glance updating API here does not fail the build.
That's what I had expected, as drivers already pass int or unsigned int
arrays anyway.
> Lemme incorporate this into v4.
Thanks!
> Meanwhile the drivers I left untouched, it might be separate changes
> to convert from int to const unsigned int.
Sounds fine to me.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 32+ messages in thread
end of thread, other threads:[~2023-11-29 15:34 UTC | newest]
Thread overview: 32+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-28 19:56 [PATCH v3 00/22] pinctrl: Convert struct group_desc to use struct pingroup Andy Shevchenko
2023-11-28 19:56 ` [PATCH v3 01/22] pinctrl: qcom: lpass-lpi: Replace kernel.h with what is being used Andy Shevchenko
2023-11-28 19:56 ` [PATCH v3 02/22] pinctrl: qcom: lpass-lpi: Remove unused member in struct lpi_pingroup Andy Shevchenko
2023-11-28 19:56 ` [PATCH v3 03/22] pinctrl: equilibrium: Unshadow error code of of_property_count_u32_elems() Andy Shevchenko
2023-11-28 19:56 ` [PATCH v3 04/22] pinctrl: equilibrium: Use temporary variable to hold pins Andy Shevchenko
2023-11-28 19:56 ` [PATCH v3 05/22] pinctrl: imx: " Andy Shevchenko
2023-11-28 19:56 ` [PATCH v3 06/22] pinctrl: core: Make pins const in struct group_desc Andy Shevchenko
2023-11-29 11:21 ` Geert Uytterhoeven
2023-11-29 13:41 ` Andy Shevchenko
2023-11-29 14:23 ` Andy Shevchenko
2023-11-29 15:34 ` Geert Uytterhoeven
2023-11-28 19:56 ` [PATCH v3 07/22] pinctrl: equilibrium: Convert to use struct pingroup Andy Shevchenko
2023-11-28 19:56 ` [PATCH v3 08/22] pinctrl: keembay: " Andy Shevchenko
2023-11-28 19:56 ` [PATCH v3 09/22] pinctrl: nuvoton: Convert to use struct pingroup and PINCTRL_PINGROUP() Andy Shevchenko
2023-11-28 19:56 ` [PATCH v3 10/22] pinctrl: core: Add a convenient define PINCTRL_GROUP_DESC() Andy Shevchenko
2023-11-29 11:12 ` Geert Uytterhoeven
2023-11-28 19:57 ` [PATCH v3 11/22] pinctrl: ingenic: Make use of PINCTRL_GROUP_DESC() Andy Shevchenko
2023-11-29 12:40 ` Paul Cercueil
2023-11-28 19:57 ` [PATCH v3 12/22] pinctrl: mediatek: " Andy Shevchenko
2023-11-28 19:57 ` [PATCH v3 13/22] pinctrl: core: Embed struct pingroup into struct group_desc Andy Shevchenko
2023-11-29 11:14 ` Geert Uytterhoeven
2023-11-28 19:57 ` [PATCH v3 14/22] pinctrl: bcm: Convert to use grp member Andy Shevchenko
2023-11-28 19:57 ` [PATCH v3 15/22] pinctrl: equilibrium: " Andy Shevchenko
2023-11-28 19:57 ` [PATCH v3 16/22] pinctrl: imx: " Andy Shevchenko
2023-11-28 19:57 ` [PATCH v3 17/22] pinctrl: ingenic: " Andy Shevchenko
2023-11-28 19:57 ` [PATCH v3 18/22] pinctrl: keembay: " Andy Shevchenko
2023-11-28 19:57 ` [PATCH v3 19/22] pinctrl: mediatek: " Andy Shevchenko
2023-11-28 19:57 ` [PATCH v3 20/22] pinctrl: renesas: " Andy Shevchenko
2023-11-29 11:10 ` Geert Uytterhoeven
2023-11-28 19:57 ` [PATCH v3 21/22] pinctrl: starfive: " Andy Shevchenko
2023-11-28 19:57 ` [PATCH v3 22/22] pinctrl: core: Remove unused members from struct group_desc Andy Shevchenko
2023-11-29 11:14 ` Geert Uytterhoeven
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).