[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240703-of_property_for_each_u32-v1-20-42c1fc0b82aa@bootlin.com>
Date: Wed, 03 Jul 2024 12:37:04 +0200
From: Luca Ceresoli <luca.ceresoli@...tlin.com>
To: Miguel Ojeda <ojeda@...nel.org>, Rob Herring <robh@...nel.org>,
Saravana Kannan <saravanak@...gle.com>,
Nathan Chancellor <nathan@...nel.org>,
Michael Turquette <mturquette@...libre.com>,
Stephen Boyd <sboyd@...nel.org>, Tony Lindgren <tony@...mide.com>,
Bjorn Andersson <andersson@...nel.org>,
Emilio López <emilio@...pez.com.ar>,
Chen-Yu Tsai <wens@...e.org>, Jernej Skrabec <jernej.skrabec@...il.com>,
Samuel Holland <samuel@...lland.org>, Krzysztof Kozlowski <krzk@...nel.org>,
Daniel Lezcano <daniel.lezcano@...aro.org>,
Thomas Gleixner <tglx@...utronix.de>,
Florian Fainelli <florian.fainelli@...adcom.com>,
Broadcom internal kernel review list <bcm-kernel-feedback-list@...adcom.com>,
Linus Walleij <linus.walleij@...aro.org>,
Bartosz Golaszewski <brgl@...ev.pl>, Jonathan Cameron <jic23@...nel.org>,
Lee Jones <lee@...nel.org>, Shawn Guo <shawnguo@...nel.org>,
Pengutronix Kernel Team <kernel@...gutronix.de>,
Uwe Kleine-König <ukleinek@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jiri Slaby <jirislaby@...nel.org>,
Richard Leitner <richard.leitner@...ux.dev>,
Liam Girdwood <lgirdwood@...il.com>, Mark Brown <broonie@...nel.org>,
Nicolas Ferre <nicolas.ferre@...rochip.com>,
Michael Ellerman <mpe@...erman.id.au>, Nicholas Piggin <npiggin@...il.com>,
Christophe Leroy <christophe.leroy@...roup.eu>,
"Naveen N. Rao" <naveen.n.rao@...ux.ibm.com>,
Damien Le Moal <dlemoal@...nel.org>
Cc: "Peng Fan (OSS)" <peng.fan@....nxp.com>,
Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
linux-kernel@...r.kernel.org, devicetree@...r.kernel.org,
llvm@...ts.linux.dev, linux-clk@...r.kernel.org, linux-omap@...r.kernel.org,
linux-arm-msm@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-sunxi@...ts.linux.dev, linux-samsung-soc@...r.kernel.org,
linux-gpio@...r.kernel.org, linux-iio@...r.kernel.org,
linux-pwm@...r.kernel.org, linux-serial@...r.kernel.org,
linux-usb@...r.kernel.org, patches@...nsource.cirrus.com,
linux-sound@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org,
linux-riscv@...ts.infradead.org, Luca Ceresoli <luca.ceresoli@...tlin.com>
Subject: [PATCH 20/20] of: deprecate and rename of_property_for_each_u32()
of_property_for_each_u32() is meant to disappear. All the call sites not
using the 3rd and 4th arguments have already been replaced by
of_property_for_each_u32_new().
Deprecate the old macro. Also rename it to minimize the number of new
usages and encourage conversion to the of_property_for_each_u32_new() macro
in not(-yet)-upstream code.
Signed-off-by: Luca Ceresoli <luca.ceresoli@...tlin.com>
---
Notes:
* The following files have not been build-tested simply because I haven't
managed to have a config that enables them so far:
drivers/irqchip/irq-pic32-evic.c
drivers/pinctrl/pinctrl-k210.c
* These have not been converted yet as they are not trivial, and they will
need to use a more specific function that does the lookup they need and
returns the result:
drivers/clk/clk-si5351.c
drivers/clk/clk.c
---
.clang-format | 2 +-
drivers/clk/clk-si5351.c | 4 ++--
drivers/clk/clk.c | 2 +-
drivers/irqchip/irq-pic32-evic.c | 2 +-
drivers/pinctrl/pinctrl-k210.c | 2 +-
include/linux/of.h | 3 ++-
6 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/.clang-format b/.clang-format
index db25cde2651a..a91b9bb39d9b 100644
--- a/.clang-format
+++ b/.clang-format
@@ -569,8 +569,8 @@ ForEachMacros:
- 'nr_node_for_each_safe'
- 'of_for_each_phandle'
- 'of_property_for_each_string'
- - 'of_property_for_each_u32'
- 'of_property_for_each_u32_new'
+ - 'of_property_for_each_u32_old'
- 'pci_bus_for_each_resource'
- 'pci_dev_for_each_resource'
- 'pcl_for_each_chunk'
diff --git a/drivers/clk/clk-si5351.c b/drivers/clk/clk-si5351.c
index 4ce83c5265b8..ff990b15d616 100644
--- a/drivers/clk/clk-si5351.c
+++ b/drivers/clk/clk-si5351.c
@@ -1191,7 +1191,7 @@ static int si5351_dt_parse(struct i2c_client *client,
* property silabs,pll-source : <num src>, [<..>]
* allow to selectively set pll source
*/
- of_property_for_each_u32(np, "silabs,pll-source", prop, p, num) {
+ of_property_for_each_u32_old(np, "silabs,pll-source", prop, p, num) {
if (num >= 2) {
dev_err(&client->dev,
"invalid pll %d on pll-source prop\n", num);
@@ -1232,7 +1232,7 @@ static int si5351_dt_parse(struct i2c_client *client,
pdata->pll_reset[0] = true;
pdata->pll_reset[1] = true;
- of_property_for_each_u32(np, "silabs,pll-reset-mode", prop, p, num) {
+ of_property_for_each_u32_old(np, "silabs,pll-reset-mode", prop, p, num) {
if (num >= 2) {
dev_err(&client->dev,
"invalid pll %d on pll-reset-mode prop\n", num);
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 8ea168c00997..aae940c18459 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -5383,7 +5383,7 @@ const char *of_clk_get_parent_name(const struct device_node *np, int index)
/* if there is an indices property, use it to transfer the index
* specified into an array offset for the clock-output-names property.
*/
- of_property_for_each_u32(clkspec.np, "clock-indices", prop, vp, pv) {
+ of_property_for_each_u32_old(clkspec.np, "clock-indices", prop, vp, pv) {
if (index == pv) {
index = count;
break;
diff --git a/drivers/irqchip/irq-pic32-evic.c b/drivers/irqchip/irq-pic32-evic.c
index 1d9bb28d13e5..d9aec87f8b59 100644
--- a/drivers/irqchip/irq-pic32-evic.c
+++ b/drivers/irqchip/irq-pic32-evic.c
@@ -196,7 +196,7 @@ static void __init pic32_ext_irq_of_init(struct irq_domain *domain)
int i = 0;
const char *pname = "microchip,external-irqs";
- of_property_for_each_u32(node, pname, prop, p, hwirq) {
+ of_property_for_each_u32_old(node, pname, prop, p, hwirq) {
if (i >= ARRAY_SIZE(priv->ext_irqs)) {
pr_warn("More than %d external irq, skip rest\n",
ARRAY_SIZE(priv->ext_irqs));
diff --git a/drivers/pinctrl/pinctrl-k210.c b/drivers/pinctrl/pinctrl-k210.c
index b6d1ed9ec9a3..03acca8b01ef 100644
--- a/drivers/pinctrl/pinctrl-k210.c
+++ b/drivers/pinctrl/pinctrl-k210.c
@@ -797,7 +797,7 @@ static int k210_pinctrl_dt_subnode_to_map(struct pinctrl_dev *pctldev,
if (ret < 0)
goto exit;
- of_property_for_each_u32(np, "pinmux", prop, p, pinmux_group) {
+ of_property_for_each_u32_old(np, "pinmux", prop, p, pinmux_group) {
const char *group_name, *func_name;
u32 pin = FIELD_GET(K210_PG_PIN, pinmux_group);
u32 func = FIELD_GET(K210_PG_FUNC, pinmux_group);
diff --git a/include/linux/of.h b/include/linux/of.h
index 756847539384..15c291ab6e71 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -1429,7 +1429,8 @@ static inline int of_property_read_s32(const struct device_node *np,
err == 0; \
err = of_phandle_iterator_next(it))
-#define of_property_for_each_u32(np, propname, prop, p, u) \
+/* deprecated - will be removed */
+#define of_property_for_each_u32_old(np, propname, prop, p, u) \
for (prop = of_find_property(np, propname, NULL), \
p = of_prop_next_u32(prop, NULL, &u); \
p; \
--
2.34.1
Powered by blists - more mailing lists