linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/20] Simplify of_property_for_each_u32()
@ 2024-07-03 10:36 Luca Ceresoli
  2024-07-03 10:36 ` [PATCH 01/20] of: add of_property_for_each_u32_new() Luca Ceresoli
                   ` (20 more replies)
  0 siblings, 21 replies; 34+ messages in thread
From: Luca Ceresoli @ 2024-07-03 10:36 UTC (permalink / raw)
  To: Miguel Ojeda, Rob Herring, Saravana Kannan, Nathan Chancellor,
	Michael Turquette, Stephen Boyd, Tony Lindgren, Bjorn Andersson,
	Emilio López, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Krzysztof Kozlowski, Daniel Lezcano, Thomas Gleixner,
	Florian Fainelli, Broadcom internal kernel review list,
	Linus Walleij, Bartosz Golaszewski, Jonathan Cameron, Lee Jones,
	Shawn Guo, Pengutronix Kernel Team, Uwe Kleine-König,
	Greg Kroah-Hartman, Jiri Slaby, Richard Leitner, Liam Girdwood,
	Mark Brown, Nicolas Ferre, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Naveen N. Rao, Damien Le Moal
  Cc: Peng Fan (OSS), Thomas Petazzoni, linux-kernel, devicetree, llvm,
	linux-clk, linux-omap, linux-arm-msm, linux-arm-kernel,
	linux-sunxi, linux-samsung-soc, linux-gpio, linux-iio, linux-pwm,
	linux-serial, linux-usb, patches, linux-sound, linuxppc-dev,
	linux-riscv, Luca Ceresoli

[Note: to reduce the noise I have trimmed the get_maintainers list
manually. Should you want to be removed, or someone else added, to future
versions, just tell me. Sorry for the noise.]

This series aims at simplifying of_property_for_each_u32() as well as
making it more difficult to misuse it in the future.

The long-term goal is changing this pattern:

  struct property *prop;
  const __be32 *p;
  u32 val;
 
  of_property_for_each_u32(np, "xyz", prop, p, val) { ... }

to this:

  u32 val;

  of_property_for_each_u32(np, "xyz", val) { ... }

So, removing the 3rd and 4th arguments which are typically meant to be
internal. Those two parameters used to be unavoidable until the kernel
moved to building with the C11 standard unconditionally. Since then, it is
now possible to get rid of them. However a few users of
of_property_for_each_u32() do actually use those arguments, which
complicates the transition. For this reason this series does the following:

 * Add of_property_for_each_u32_new(), which does not have those two
   arguments (patch 1)
 * Convert _almost_ every usage to of_property_for_each_u32_new()
 * Rename of_property_for_each_u32() to of_property_for_each_u32_old() and
   deprecate it, as a incentive to code not (yet) in mainline to upgrade
   to the *_new() version (last patch)

The plan for the next series is to additionally:

 * Convert the few remaining of_property_for_each_u32_old() instantes to
   of_property_for_each_u32_new()
 * Remove of_property_for_each_u32_old()
 * Rename of_property_for_each_u32_new() to of_property_for_each_u32()

Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
Luca Ceresoli (20):
      of: add of_property_for_each_u32_new()
      clk: convert to of_property_for_each_u32_new()
      clk: qcom: convert to of_property_for_each_u32_new()
      clk: sunxi: clk-simple-gates: convert to of_property_for_each_u32_new()
      clk: sunxi:  clk-sun8i-bus-gates: convert to of_property_for_each_u32_new()
      clocksource/drivers/samsung_pwm: convert to of_property_for_each_u32_new()
      bus: ti-sysc: convert to of_property_for_each_u32_new()
      lk: clk-conf: convert to of_property_for_each_u32_new()
      gpio: brcmstb: convert to of_property_for_each_u32_new()
      pinctrl: s32cc: convert to of_property_for_each_u32_new()
      irqchip/atmel-aic: convert to of_property_for_each_u32_new()
      iio: adc: ti_am335x_adc: convert to of_property_for_each_u32_new()
      pwm: samsung: convert to of_property_for_each_u32_new()
      tty: sysrq: convert to of_property_for_each_u32_new()
      usb: usb251xb: convert to of_property_for_each_u32_new()
      mfd: ti_am335x_tscadc: convert to of_property_for_each_u32_new()
      ASoC: arizona: convert to of_property_for_each_u32_new()
      powerpc/xive: convert to of_property_for_each_u32_new()
      powerpc/xive: convert to of_property_for_each_u32_new()
      of: deprecate and rename of_property_for_each_u32()

 .clang-format                           |  3 ++-
 arch/powerpc/sysdev/xive/native.c       |  4 +---
 arch/powerpc/sysdev/xive/spapr.c        |  3 +--
 drivers/bus/ti-sysc.c                   |  4 +---
 drivers/clk/clk-conf.c                  |  4 +---
 drivers/clk/clk-si5351.c                |  4 ++--
 drivers/clk/clk.c                       |  6 ++----
 drivers/clk/qcom/common.c               |  4 +---
 drivers/clk/sunxi/clk-simple-gates.c    |  4 +---
 drivers/clk/sunxi/clk-sun8i-bus-gates.c |  4 +---
 drivers/clocksource/samsung_pwm_timer.c |  4 +---
 drivers/gpio/gpio-brcmstb.c             |  5 +----
 drivers/iio/adc/ti_am335x_adc.c         |  4 +---
 drivers/irqchip/irq-atmel-aic-common.c  |  4 +---
 drivers/irqchip/irq-pic32-evic.c        |  2 +-
 drivers/mfd/ti_am335x_tscadc.c          |  4 +---
 drivers/pinctrl/nxp/pinctrl-s32cc.c     |  4 +---
 drivers/pinctrl/pinctrl-k210.c          |  2 +-
 drivers/pwm/pwm-samsung.c               |  4 +---
 drivers/tty/sysrq.c                     |  4 +---
 drivers/usb/misc/usb251xb.c             |  4 +---
 include/linux/of.h                      | 14 ++++++++++----
 sound/soc/codecs/arizona.c              | 12 +++++-------
 23 files changed, 39 insertions(+), 68 deletions(-)
---
base-commit: e937d48ed96381e9620d9c81fbc1ce666f5b7358
change-id: 20240701-of_property_for_each_u32-460fd02a5d0c

Best regards,
-- 
Luca Ceresoli <luca.ceresoli@bootlin.com>


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH 01/20] of: add of_property_for_each_u32_new()
  2024-07-03 10:36 [PATCH 00/20] Simplify of_property_for_each_u32() Luca Ceresoli
@ 2024-07-03 10:36 ` Luca Ceresoli
  2024-07-03 10:36 ` [PATCH 02/20] clk: convert to of_property_for_each_u32_new() Luca Ceresoli
                   ` (19 subsequent siblings)
  20 siblings, 0 replies; 34+ messages in thread
From: Luca Ceresoli @ 2024-07-03 10:36 UTC (permalink / raw)
  To: Miguel Ojeda, Rob Herring, Saravana Kannan, Nathan Chancellor,
	Michael Turquette, Stephen Boyd, Tony Lindgren, Bjorn Andersson,
	Emilio López, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Krzysztof Kozlowski, Daniel Lezcano, Thomas Gleixner,
	Florian Fainelli, Broadcom internal kernel review list,
	Linus Walleij, Bartosz Golaszewski, Jonathan Cameron, Lee Jones,
	Shawn Guo, Pengutronix Kernel Team, Uwe Kleine-König,
	Greg Kroah-Hartman, Jiri Slaby, Richard Leitner, Liam Girdwood,
	Mark Brown, Nicolas Ferre, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Naveen N. Rao, Damien Le Moal
  Cc: Peng Fan (OSS), Thomas Petazzoni, linux-kernel, devicetree, llvm,
	linux-clk, linux-omap, linux-arm-msm, linux-arm-kernel,
	linux-sunxi, linux-samsung-soc, linux-gpio, linux-iio, linux-pwm,
	linux-serial, linux-usb, patches, linux-sound, linuxppc-dev,
	linux-riscv, Luca Ceresoli

The of_property_for_each_u32() macro needs five parameters, two of which
are often only used internally by the macro itself (in the for()
clause).

Now that the kernel uses C11 to build these two parameters can be avoided
by declaring them internally. Add a new macro for that, which is meant to
eventually replace the existing one.

Since two variables cannot be declared in the for clause, declare one
struct that contain the two variables we actually need. Since the variables
inside this struct are not meant to be used by users of this macro, give
the struct instance the noticeable name "_it" so it is visible during code
reviews, helping to avoid new code to use it directly.

Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
 .clang-format      |  1 +
 include/linux/of.h | 11 ++++++++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/.clang-format b/.clang-format
index ccc9b93972a9..db25cde2651a 100644
--- a/.clang-format
+++ b/.clang-format
@@ -570,6 +570,7 @@ ForEachMacros:
   - 'of_for_each_phandle'
   - 'of_property_for_each_string'
   - 'of_property_for_each_u32'
+  - 'of_property_for_each_u32_new'
   - 'pci_bus_for_each_resource'
   - 'pci_dev_for_each_resource'
   - 'pcl_for_each_chunk'
diff --git a/include/linux/of.h b/include/linux/of.h
index a0bedd038a05..756847539384 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -430,11 +430,9 @@ extern int of_detach_node(struct device_node *);
 #define of_match_ptr(_ptr)	(_ptr)
 
 /*
- * struct property *prop;
- * const __be32 *p;
  * u32 u;
  *
- * of_property_for_each_u32(np, "propname", prop, p, u)
+ * of_property_for_each_u32_new(np, "propname", u)
  *         printk("U32 value: %x\n", u);
  */
 const __be32 *of_prop_next_u32(struct property *prop, const __be32 *cur,
@@ -1437,6 +1435,13 @@ static inline int of_property_read_s32(const struct device_node *np,
 		p;						\
 		p = of_prop_next_u32(prop, p, &u))
 
+#define of_property_for_each_u32_new(np, propname, u)			\
+	for (struct {struct property *prop; const __be32 *item; } _it =	\
+		{of_find_property(np, propname, NULL),			\
+		 of_prop_next_u32(_it.prop, NULL, &u)};			\
+	     _it.item;							\
+	     _it.item = of_prop_next_u32(_it.prop, _it.item, &u))
+
 #define of_property_for_each_string(np, propname, prop, s)	\
 	for (prop = of_find_property(np, propname, NULL),	\
 		s = of_prop_next_string(prop, NULL);		\

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 02/20] clk: convert to of_property_for_each_u32_new()
  2024-07-03 10:36 [PATCH 00/20] Simplify of_property_for_each_u32() Luca Ceresoli
  2024-07-03 10:36 ` [PATCH 01/20] of: add of_property_for_each_u32_new() Luca Ceresoli
@ 2024-07-03 10:36 ` Luca Ceresoli
  2024-07-03 10:36 ` [PATCH 03/20] clk: qcom: " Luca Ceresoli
                   ` (18 subsequent siblings)
  20 siblings, 0 replies; 34+ messages in thread
From: Luca Ceresoli @ 2024-07-03 10:36 UTC (permalink / raw)
  To: Miguel Ojeda, Rob Herring, Saravana Kannan, Nathan Chancellor,
	Michael Turquette, Stephen Boyd, Tony Lindgren, Bjorn Andersson,
	Emilio López, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Krzysztof Kozlowski, Daniel Lezcano, Thomas Gleixner,
	Florian Fainelli, Broadcom internal kernel review list,
	Linus Walleij, Bartosz Golaszewski, Jonathan Cameron, Lee Jones,
	Shawn Guo, Pengutronix Kernel Team, Uwe Kleine-König,
	Greg Kroah-Hartman, Jiri Slaby, Richard Leitner, Liam Girdwood,
	Mark Brown, Nicolas Ferre, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Naveen N. Rao, Damien Le Moal
  Cc: Peng Fan (OSS), Thomas Petazzoni, linux-kernel, devicetree, llvm,
	linux-clk, linux-omap, linux-arm-msm, linux-arm-kernel,
	linux-sunxi, linux-samsung-soc, linux-gpio, linux-iio, linux-pwm,
	linux-serial, linux-usb, patches, linux-sound, linuxppc-dev,
	linux-riscv, Luca Ceresoli

Simplify code using of_property_for_each_u32_new() as the two additional
parameters in of_property_for_each_u32() are not used here.

Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
 drivers/clk/clk.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 8cca52be993f..8ea168c00997 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -5504,14 +5504,12 @@ static int parent_ready(struct device_node *np)
 int of_clk_detect_critical(struct device_node *np, int index,
 			   unsigned long *flags)
 {
-	struct property *prop;
-	const __be32 *cur;
 	uint32_t idx;
 
 	if (!np || !flags)
 		return -EINVAL;
 
-	of_property_for_each_u32(np, "clock-critical", prop, cur, idx)
+	of_property_for_each_u32_new(np, "clock-critical", idx)
 		if (index == idx)
 			*flags |= CLK_IS_CRITICAL;
 

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 03/20] clk: qcom: convert to of_property_for_each_u32_new()
  2024-07-03 10:36 [PATCH 00/20] Simplify of_property_for_each_u32() Luca Ceresoli
  2024-07-03 10:36 ` [PATCH 01/20] of: add of_property_for_each_u32_new() Luca Ceresoli
  2024-07-03 10:36 ` [PATCH 02/20] clk: convert to of_property_for_each_u32_new() Luca Ceresoli
@ 2024-07-03 10:36 ` Luca Ceresoli
  2024-07-03 10:36 ` [PATCH 04/20] clk: sunxi: clk-simple-gates: " Luca Ceresoli
                   ` (17 subsequent siblings)
  20 siblings, 0 replies; 34+ messages in thread
From: Luca Ceresoli @ 2024-07-03 10:36 UTC (permalink / raw)
  To: Miguel Ojeda, Rob Herring, Saravana Kannan, Nathan Chancellor,
	Michael Turquette, Stephen Boyd, Tony Lindgren, Bjorn Andersson,
	Emilio López, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Krzysztof Kozlowski, Daniel Lezcano, Thomas Gleixner,
	Florian Fainelli, Broadcom internal kernel review list,
	Linus Walleij, Bartosz Golaszewski, Jonathan Cameron, Lee Jones,
	Shawn Guo, Pengutronix Kernel Team, Uwe Kleine-König,
	Greg Kroah-Hartman, Jiri Slaby, Richard Leitner, Liam Girdwood,
	Mark Brown, Nicolas Ferre, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Naveen N. Rao, Damien Le Moal
  Cc: Peng Fan (OSS), Thomas Petazzoni, linux-kernel, devicetree, llvm,
	linux-clk, linux-omap, linux-arm-msm, linux-arm-kernel,
	linux-sunxi, linux-samsung-soc, linux-gpio, linux-iio, linux-pwm,
	linux-serial, linux-usb, patches, linux-sound, linuxppc-dev,
	linux-riscv, Luca Ceresoli

Simplify code using of_property_for_each_u32_new() as the two additional
parameters in of_property_for_each_u32() are not used here.

Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
 drivers/clk/qcom/common.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/clk/qcom/common.c b/drivers/clk/qcom/common.c
index 48f81e3a5e80..43e4918dc4e9 100644
--- a/drivers/clk/qcom/common.c
+++ b/drivers/clk/qcom/common.c
@@ -226,11 +226,9 @@ EXPORT_SYMBOL_GPL(qcom_cc_register_sleep_clk);
 static void qcom_cc_drop_protected(struct device *dev, struct qcom_cc *cc)
 {
 	struct device_node *np = dev->of_node;
-	struct property *prop;
-	const __be32 *p;
 	u32 i;
 
-	of_property_for_each_u32(np, "protected-clocks", prop, p, i) {
+	of_property_for_each_u32_new(np, "protected-clocks", i) {
 		if (i >= cc->num_rclks)
 			continue;
 

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 04/20] clk: sunxi: clk-simple-gates: convert to of_property_for_each_u32_new()
  2024-07-03 10:36 [PATCH 00/20] Simplify of_property_for_each_u32() Luca Ceresoli
                   ` (2 preceding siblings ...)
  2024-07-03 10:36 ` [PATCH 03/20] clk: qcom: " Luca Ceresoli
@ 2024-07-03 10:36 ` Luca Ceresoli
  2024-07-03 12:21   ` Andre Przywara
  2024-07-03 10:36 ` [PATCH 05/20] clk: sunxi: clk-sun8i-bus-gates: " Luca Ceresoli
                   ` (16 subsequent siblings)
  20 siblings, 1 reply; 34+ messages in thread
From: Luca Ceresoli @ 2024-07-03 10:36 UTC (permalink / raw)
  To: Miguel Ojeda, Rob Herring, Saravana Kannan, Nathan Chancellor,
	Michael Turquette, Stephen Boyd, Tony Lindgren, Bjorn Andersson,
	Emilio López, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Krzysztof Kozlowski, Daniel Lezcano, Thomas Gleixner,
	Florian Fainelli, Broadcom internal kernel review list,
	Linus Walleij, Bartosz Golaszewski, Jonathan Cameron, Lee Jones,
	Shawn Guo, Pengutronix Kernel Team, Uwe Kleine-König,
	Greg Kroah-Hartman, Jiri Slaby, Richard Leitner, Liam Girdwood,
	Mark Brown, Nicolas Ferre, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Naveen N. Rao, Damien Le Moal
  Cc: Peng Fan (OSS), Thomas Petazzoni, linux-kernel, devicetree, llvm,
	linux-clk, linux-omap, linux-arm-msm, linux-arm-kernel,
	linux-sunxi, linux-samsung-soc, linux-gpio, linux-iio, linux-pwm,
	linux-serial, linux-usb, patches, linux-sound, linuxppc-dev,
	linux-riscv, Luca Ceresoli

Simplify code using of_property_for_each_u32_new() as the two additional
parameters in of_property_for_each_u32() are not used here.

Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
 drivers/clk/sunxi/clk-simple-gates.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/clk/sunxi/clk-simple-gates.c b/drivers/clk/sunxi/clk-simple-gates.c
index 0399627c226a..a30d14937e0b 100644
--- a/drivers/clk/sunxi/clk-simple-gates.c
+++ b/drivers/clk/sunxi/clk-simple-gates.c
@@ -21,11 +21,9 @@ static void __init sunxi_simple_gates_setup(struct device_node *node,
 {
 	struct clk_onecell_data *clk_data;
 	const char *clk_parent, *clk_name;
-	struct property *prop;
 	struct resource res;
 	void __iomem *clk_reg;
 	void __iomem *reg;
-	const __be32 *p;
 	int number, i = 0, j;
 	u8 clk_bit;
 	u32 index;
@@ -47,7 +45,7 @@ static void __init sunxi_simple_gates_setup(struct device_node *node,
 	if (!clk_data->clks)
 		goto err_free_data;
 
-	of_property_for_each_u32(node, "clock-indices", prop, p, index) {
+	of_property_for_each_u32_new(node, "clock-indices", index) {
 		of_property_read_string_index(node, "clock-output-names",
 					      i, &clk_name);
 

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 05/20] clk: sunxi: clk-sun8i-bus-gates: convert to of_property_for_each_u32_new()
  2024-07-03 10:36 [PATCH 00/20] Simplify of_property_for_each_u32() Luca Ceresoli
                   ` (3 preceding siblings ...)
  2024-07-03 10:36 ` [PATCH 04/20] clk: sunxi: clk-simple-gates: " Luca Ceresoli
@ 2024-07-03 10:36 ` Luca Ceresoli
  2024-07-03 12:19   ` Andre Przywara
  2024-07-03 10:36 ` [PATCH 06/20] clocksource/drivers/samsung_pwm: " Luca Ceresoli
                   ` (15 subsequent siblings)
  20 siblings, 1 reply; 34+ messages in thread
From: Luca Ceresoli @ 2024-07-03 10:36 UTC (permalink / raw)
  To: Miguel Ojeda, Rob Herring, Saravana Kannan, Nathan Chancellor,
	Michael Turquette, Stephen Boyd, Tony Lindgren, Bjorn Andersson,
	Emilio López, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Krzysztof Kozlowski, Daniel Lezcano, Thomas Gleixner,
	Florian Fainelli, Broadcom internal kernel review list,
	Linus Walleij, Bartosz Golaszewski, Jonathan Cameron, Lee Jones,
	Shawn Guo, Pengutronix Kernel Team, Uwe Kleine-König,
	Greg Kroah-Hartman, Jiri Slaby, Richard Leitner, Liam Girdwood,
	Mark Brown, Nicolas Ferre, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Naveen N. Rao, Damien Le Moal
  Cc: Peng Fan (OSS), Thomas Petazzoni, linux-kernel, devicetree, llvm,
	linux-clk, linux-omap, linux-arm-msm, linux-arm-kernel,
	linux-sunxi, linux-samsung-soc, linux-gpio, linux-iio, linux-pwm,
	linux-serial, linux-usb, patches, linux-sound, linuxppc-dev,
	linux-riscv, Luca Ceresoli

Simplify code using of_property_for_each_u32_new() as the two additional
parameters in of_property_for_each_u32() are not used here.

Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
 drivers/clk/sunxi/clk-sun8i-bus-gates.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/clk/sunxi/clk-sun8i-bus-gates.c b/drivers/clk/sunxi/clk-sun8i-bus-gates.c
index b87f331f63c9..21f036457a86 100644
--- a/drivers/clk/sunxi/clk-sun8i-bus-gates.c
+++ b/drivers/clk/sunxi/clk-sun8i-bus-gates.c
@@ -24,11 +24,9 @@ static void __init sun8i_h3_bus_gates_init(struct device_node *node)
 	const char *parents[PARENT_MAX];
 	struct clk_onecell_data *clk_data;
 	const char *clk_name;
-	struct property *prop;
 	struct resource res;
 	void __iomem *clk_reg;
 	void __iomem *reg;
-	const __be32 *p;
 	int number, i;
 	u8 clk_bit;
 	int index;
@@ -58,7 +56,7 @@ static void __init sun8i_h3_bus_gates_init(struct device_node *node)
 		goto err_free_data;
 
 	i = 0;
-	of_property_for_each_u32(node, "clock-indices", prop, p, index) {
+	of_property_for_each_u32_new(node, "clock-indices", index) {
 		of_property_read_string_index(node, "clock-output-names",
 					      i, &clk_name);
 

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 06/20] clocksource/drivers/samsung_pwm: convert to of_property_for_each_u32_new()
  2024-07-03 10:36 [PATCH 00/20] Simplify of_property_for_each_u32() Luca Ceresoli
                   ` (4 preceding siblings ...)
  2024-07-03 10:36 ` [PATCH 05/20] clk: sunxi: clk-sun8i-bus-gates: " Luca Ceresoli
@ 2024-07-03 10:36 ` Luca Ceresoli
  2024-07-03 10:36 ` [PATCH 07/20] bus: ti-sysc: " Luca Ceresoli
                   ` (14 subsequent siblings)
  20 siblings, 0 replies; 34+ messages in thread
From: Luca Ceresoli @ 2024-07-03 10:36 UTC (permalink / raw)
  To: Miguel Ojeda, Rob Herring, Saravana Kannan, Nathan Chancellor,
	Michael Turquette, Stephen Boyd, Tony Lindgren, Bjorn Andersson,
	Emilio López, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Krzysztof Kozlowski, Daniel Lezcano, Thomas Gleixner,
	Florian Fainelli, Broadcom internal kernel review list,
	Linus Walleij, Bartosz Golaszewski, Jonathan Cameron, Lee Jones,
	Shawn Guo, Pengutronix Kernel Team, Uwe Kleine-König,
	Greg Kroah-Hartman, Jiri Slaby, Richard Leitner, Liam Girdwood,
	Mark Brown, Nicolas Ferre, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Naveen N. Rao, Damien Le Moal
  Cc: Peng Fan (OSS), Thomas Petazzoni, linux-kernel, devicetree, llvm,
	linux-clk, linux-omap, linux-arm-msm, linux-arm-kernel,
	linux-sunxi, linux-samsung-soc, linux-gpio, linux-iio, linux-pwm,
	linux-serial, linux-usb, patches, linux-sound, linuxppc-dev,
	linux-riscv, Luca Ceresoli

Simplify code using of_property_for_each_u32_new() as the two additional
parameters in of_property_for_each_u32() are not used here.

Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
 drivers/clocksource/samsung_pwm_timer.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/clocksource/samsung_pwm_timer.c b/drivers/clocksource/samsung_pwm_timer.c
index 6e46781bc9ac..b5ae411bc077 100644
--- a/drivers/clocksource/samsung_pwm_timer.c
+++ b/drivers/clocksource/samsung_pwm_timer.c
@@ -418,8 +418,6 @@ void __init samsung_pwm_clocksource_init(void __iomem *base,
 static int __init samsung_pwm_alloc(struct device_node *np,
 				    const struct samsung_pwm_variant *variant)
 {
-	struct property *prop;
-	const __be32 *cur;
 	u32 val;
 	int i, ret;
 
@@ -427,7 +425,7 @@ static int __init samsung_pwm_alloc(struct device_node *np,
 	for (i = 0; i < SAMSUNG_PWM_NUM; ++i)
 		pwm.irq[i] = irq_of_parse_and_map(np, i);
 
-	of_property_for_each_u32(np, "samsung,pwm-outputs", prop, cur, val) {
+	of_property_for_each_u32_new(np, "samsung,pwm-outputs", val) {
 		if (val >= SAMSUNG_PWM_NUM) {
 			pr_warn("%s: invalid channel index in samsung,pwm-outputs property\n", __func__);
 			continue;

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 07/20] bus: ti-sysc: convert to of_property_for_each_u32_new()
  2024-07-03 10:36 [PATCH 00/20] Simplify of_property_for_each_u32() Luca Ceresoli
                   ` (5 preceding siblings ...)
  2024-07-03 10:36 ` [PATCH 06/20] clocksource/drivers/samsung_pwm: " Luca Ceresoli
@ 2024-07-03 10:36 ` Luca Ceresoli
  2024-07-03 10:36 ` [PATCH 08/20] lk: clk-conf: " Luca Ceresoli
                   ` (13 subsequent siblings)
  20 siblings, 0 replies; 34+ messages in thread
From: Luca Ceresoli @ 2024-07-03 10:36 UTC (permalink / raw)
  To: Miguel Ojeda, Rob Herring, Saravana Kannan, Nathan Chancellor,
	Michael Turquette, Stephen Boyd, Tony Lindgren, Bjorn Andersson,
	Emilio López, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Krzysztof Kozlowski, Daniel Lezcano, Thomas Gleixner,
	Florian Fainelli, Broadcom internal kernel review list,
	Linus Walleij, Bartosz Golaszewski, Jonathan Cameron, Lee Jones,
	Shawn Guo, Pengutronix Kernel Team, Uwe Kleine-König,
	Greg Kroah-Hartman, Jiri Slaby, Richard Leitner, Liam Girdwood,
	Mark Brown, Nicolas Ferre, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Naveen N. Rao, Damien Le Moal
  Cc: Peng Fan (OSS), Thomas Petazzoni, linux-kernel, devicetree, llvm,
	linux-clk, linux-omap, linux-arm-msm, linux-arm-kernel,
	linux-sunxi, linux-samsung-soc, linux-gpio, linux-iio, linux-pwm,
	linux-serial, linux-usb, patches, linux-sound, linuxppc-dev,
	linux-riscv, Luca Ceresoli

Simplify code using of_property_for_each_u32_new() as the two additional
parameters in of_property_for_each_u32() are not used here.

Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
 drivers/bus/ti-sysc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c
index 8767e04d6c89..3d19777f1e31 100644
--- a/drivers/bus/ti-sysc.c
+++ b/drivers/bus/ti-sysc.c
@@ -2291,11 +2291,9 @@ static int sysc_init_idlemode(struct sysc *ddata, u8 *idlemodes,
 			      const char *name)
 {
 	struct device_node *np = ddata->dev->of_node;
-	struct property *prop;
-	const __be32 *p;
 	u32 val;
 
-	of_property_for_each_u32(np, name, prop, p, val) {
+	of_property_for_each_u32_new(np, name, val) {
 		if (val >= SYSC_NR_IDLEMODES) {
 			dev_err(ddata->dev, "invalid idlemode: %i\n", val);
 			return -EINVAL;

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 08/20] lk: clk-conf: convert to of_property_for_each_u32_new()
  2024-07-03 10:36 [PATCH 00/20] Simplify of_property_for_each_u32() Luca Ceresoli
                   ` (6 preceding siblings ...)
  2024-07-03 10:36 ` [PATCH 07/20] bus: ti-sysc: " Luca Ceresoli
@ 2024-07-03 10:36 ` Luca Ceresoli
  2024-07-03 10:36 ` [PATCH 09/20] gpio: brcmstb: " Luca Ceresoli
                   ` (12 subsequent siblings)
  20 siblings, 0 replies; 34+ messages in thread
From: Luca Ceresoli @ 2024-07-03 10:36 UTC (permalink / raw)
  To: Miguel Ojeda, Rob Herring, Saravana Kannan, Nathan Chancellor,
	Michael Turquette, Stephen Boyd, Tony Lindgren, Bjorn Andersson,
	Emilio López, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Krzysztof Kozlowski, Daniel Lezcano, Thomas Gleixner,
	Florian Fainelli, Broadcom internal kernel review list,
	Linus Walleij, Bartosz Golaszewski, Jonathan Cameron, Lee Jones,
	Shawn Guo, Pengutronix Kernel Team, Uwe Kleine-König,
	Greg Kroah-Hartman, Jiri Slaby, Richard Leitner, Liam Girdwood,
	Mark Brown, Nicolas Ferre, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Naveen N. Rao, Damien Le Moal
  Cc: Peng Fan (OSS), Thomas Petazzoni, linux-kernel, devicetree, llvm,
	linux-clk, linux-omap, linux-arm-msm, linux-arm-kernel,
	linux-sunxi, linux-samsung-soc, linux-gpio, linux-iio, linux-pwm,
	linux-serial, linux-usb, patches, linux-sound, linuxppc-dev,
	linux-riscv, Luca Ceresoli

Simplify code using of_property_for_each_u32_new() as the two additional
parameters in of_property_for_each_u32() are not used here.

Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
 drivers/clk/clk-conf.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/clk/clk-conf.c b/drivers/clk/clk-conf.c
index 1a4e6340f95c..290dd1230bad 100644
--- a/drivers/clk/clk-conf.c
+++ b/drivers/clk/clk-conf.c
@@ -81,13 +81,11 @@ static int __set_clk_parents(struct device_node *node, bool clk_supplier)
 static int __set_clk_rates(struct device_node *node, bool clk_supplier)
 {
 	struct of_phandle_args clkspec;
-	struct property	*prop;
-	const __be32 *cur;
 	int rc, index = 0;
 	struct clk *clk;
 	u32 rate;
 
-	of_property_for_each_u32(node, "assigned-clock-rates", prop, cur, rate) {
+	of_property_for_each_u32_new(node, "assigned-clock-rates", rate) {
 		if (rate) {
 			rc = of_parse_phandle_with_args(node, "assigned-clocks",
 					"#clock-cells",	index, &clkspec);

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 09/20] gpio: brcmstb: convert to of_property_for_each_u32_new()
  2024-07-03 10:36 [PATCH 00/20] Simplify of_property_for_each_u32() Luca Ceresoli
                   ` (7 preceding siblings ...)
  2024-07-03 10:36 ` [PATCH 08/20] lk: clk-conf: " Luca Ceresoli
@ 2024-07-03 10:36 ` Luca Ceresoli
  2024-07-03 11:33   ` Bartosz Golaszewski
  2024-07-03 10:36 ` [PATCH 10/20] pinctrl: s32cc: " Luca Ceresoli
                   ` (11 subsequent siblings)
  20 siblings, 1 reply; 34+ messages in thread
From: Luca Ceresoli @ 2024-07-03 10:36 UTC (permalink / raw)
  To: Miguel Ojeda, Rob Herring, Saravana Kannan, Nathan Chancellor,
	Michael Turquette, Stephen Boyd, Tony Lindgren, Bjorn Andersson,
	Emilio López, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Krzysztof Kozlowski, Daniel Lezcano, Thomas Gleixner,
	Florian Fainelli, Broadcom internal kernel review list,
	Linus Walleij, Bartosz Golaszewski, Jonathan Cameron, Lee Jones,
	Shawn Guo, Pengutronix Kernel Team, Uwe Kleine-König,
	Greg Kroah-Hartman, Jiri Slaby, Richard Leitner, Liam Girdwood,
	Mark Brown, Nicolas Ferre, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Naveen N. Rao, Damien Le Moal
  Cc: Peng Fan (OSS), Thomas Petazzoni, linux-kernel, devicetree, llvm,
	linux-clk, linux-omap, linux-arm-msm, linux-arm-kernel,
	linux-sunxi, linux-samsung-soc, linux-gpio, linux-iio, linux-pwm,
	linux-serial, linux-usb, patches, linux-sound, linuxppc-dev,
	linux-riscv, Luca Ceresoli

Simplify code using of_property_for_each_u32_new() as the two additional
parameters in of_property_for_each_u32() are not used here.

Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
 drivers/gpio/gpio-brcmstb.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/gpio/gpio-brcmstb.c b/drivers/gpio/gpio-brcmstb.c
index 8dce78ea7139..77557bc596cd 100644
--- a/drivers/gpio/gpio-brcmstb.c
+++ b/drivers/gpio/gpio-brcmstb.c
@@ -591,8 +591,6 @@ static int brcmstb_gpio_probe(struct platform_device *pdev)
 	void __iomem *reg_base;
 	struct brcmstb_gpio_priv *priv;
 	struct resource *res;
-	struct property *prop;
-	const __be32 *p;
 	u32 bank_width;
 	int num_banks = 0;
 	int num_gpios = 0;
@@ -636,8 +634,7 @@ static int brcmstb_gpio_probe(struct platform_device *pdev)
 	flags = BGPIOF_BIG_ENDIAN_BYTE_ORDER;
 #endif
 
-	of_property_for_each_u32(np, "brcm,gpio-bank-widths", prop, p,
-			bank_width) {
+	of_property_for_each_u32_new(np, "brcm,gpio-bank-widths", bank_width) {
 		struct brcmstb_gpio_bank *bank;
 		struct gpio_chip *gc;
 

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 10/20] pinctrl: s32cc: convert to of_property_for_each_u32_new()
  2024-07-03 10:36 [PATCH 00/20] Simplify of_property_for_each_u32() Luca Ceresoli
                   ` (8 preceding siblings ...)
  2024-07-03 10:36 ` [PATCH 09/20] gpio: brcmstb: " Luca Ceresoli
@ 2024-07-03 10:36 ` Luca Ceresoli
  2024-07-03 10:36 ` [PATCH 11/20] irqchip/atmel-aic: " Luca Ceresoli
                   ` (10 subsequent siblings)
  20 siblings, 0 replies; 34+ messages in thread
From: Luca Ceresoli @ 2024-07-03 10:36 UTC (permalink / raw)
  To: Miguel Ojeda, Rob Herring, Saravana Kannan, Nathan Chancellor,
	Michael Turquette, Stephen Boyd, Tony Lindgren, Bjorn Andersson,
	Emilio López, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Krzysztof Kozlowski, Daniel Lezcano, Thomas Gleixner,
	Florian Fainelli, Broadcom internal kernel review list,
	Linus Walleij, Bartosz Golaszewski, Jonathan Cameron, Lee Jones,
	Shawn Guo, Pengutronix Kernel Team, Uwe Kleine-König,
	Greg Kroah-Hartman, Jiri Slaby, Richard Leitner, Liam Girdwood,
	Mark Brown, Nicolas Ferre, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Naveen N. Rao, Damien Le Moal
  Cc: Peng Fan (OSS), Thomas Petazzoni, linux-kernel, devicetree, llvm,
	linux-clk, linux-omap, linux-arm-msm, linux-arm-kernel,
	linux-sunxi, linux-samsung-soc, linux-gpio, linux-iio, linux-pwm,
	linux-serial, linux-usb, patches, linux-sound, linuxppc-dev,
	linux-riscv, Luca Ceresoli

Simplify code using of_property_for_each_u32_new() as the two additional
parameters in of_property_for_each_u32() are not used here.

Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
 drivers/pinctrl/nxp/pinctrl-s32cc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/pinctrl/nxp/pinctrl-s32cc.c b/drivers/pinctrl/nxp/pinctrl-s32cc.c
index f0cad2c501f7..6aeb93af77ed 100644
--- a/drivers/pinctrl/nxp/pinctrl-s32cc.c
+++ b/drivers/pinctrl/nxp/pinctrl-s32cc.c
@@ -735,9 +735,7 @@ static int s32_pinctrl_parse_groups(struct device_node *np,
 				     struct s32_pin_group *grp,
 				     struct s32_pinctrl_soc_info *info)
 {
-	const __be32 *p;
 	struct device *dev;
-	struct property *prop;
 	unsigned int *pins, *sss;
 	int i, npins;
 	u32 pinmux;
@@ -768,7 +766,7 @@ static int s32_pinctrl_parse_groups(struct device_node *np,
 		return -ENOMEM;
 
 	i = 0;
-	of_property_for_each_u32(np, "pinmux", prop, p, pinmux) {
+	of_property_for_each_u32_new(np, "pinmux", pinmux) {
 		pins[i] = get_pin_no(pinmux);
 		sss[i] = get_pin_func(pinmux);
 

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 11/20] irqchip/atmel-aic: convert to of_property_for_each_u32_new()
  2024-07-03 10:36 [PATCH 00/20] Simplify of_property_for_each_u32() Luca Ceresoli
                   ` (9 preceding siblings ...)
  2024-07-03 10:36 ` [PATCH 10/20] pinctrl: s32cc: " Luca Ceresoli
@ 2024-07-03 10:36 ` Luca Ceresoli
  2024-07-03 13:09   ` Nicolas Ferre
  2024-07-03 10:36 ` [PATCH 12/20] iio: adc: ti_am335x_adc: " Luca Ceresoli
                   ` (9 subsequent siblings)
  20 siblings, 1 reply; 34+ messages in thread
From: Luca Ceresoli @ 2024-07-03 10:36 UTC (permalink / raw)
  To: Miguel Ojeda, Rob Herring, Saravana Kannan, Nathan Chancellor,
	Michael Turquette, Stephen Boyd, Tony Lindgren, Bjorn Andersson,
	Emilio López, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Krzysztof Kozlowski, Daniel Lezcano, Thomas Gleixner,
	Florian Fainelli, Broadcom internal kernel review list,
	Linus Walleij, Bartosz Golaszewski, Jonathan Cameron, Lee Jones,
	Shawn Guo, Pengutronix Kernel Team, Uwe Kleine-König,
	Greg Kroah-Hartman, Jiri Slaby, Richard Leitner, Liam Girdwood,
	Mark Brown, Nicolas Ferre, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Naveen N. Rao, Damien Le Moal
  Cc: Peng Fan (OSS), Thomas Petazzoni, linux-kernel, devicetree, llvm,
	linux-clk, linux-omap, linux-arm-msm, linux-arm-kernel,
	linux-sunxi, linux-samsung-soc, linux-gpio, linux-iio, linux-pwm,
	linux-serial, linux-usb, patches, linux-sound, linuxppc-dev,
	linux-riscv, Luca Ceresoli

Simplify code using of_property_for_each_u32_new() as the two additional
parameters in of_property_for_each_u32() are not used here.

Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
 drivers/irqchip/irq-atmel-aic-common.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/irqchip/irq-atmel-aic-common.c b/drivers/irqchip/irq-atmel-aic-common.c
index 072bd227b6c6..543ea249df53 100644
--- a/drivers/irqchip/irq-atmel-aic-common.c
+++ b/drivers/irqchip/irq-atmel-aic-common.c
@@ -111,8 +111,6 @@ static void __init aic_common_ext_irq_of_init(struct irq_domain *domain)
 	struct device_node *node = irq_domain_get_of_node(domain);
 	struct irq_chip_generic *gc;
 	struct aic_chip_data *aic;
-	struct property *prop;
-	const __be32 *p;
 	u32 hwirq;
 
 	gc = irq_get_domain_generic_chip(domain, 0);
@@ -120,7 +118,7 @@ static void __init aic_common_ext_irq_of_init(struct irq_domain *domain)
 	aic = gc->private;
 	aic->ext_irqs |= 1;
 
-	of_property_for_each_u32(node, "atmel,external-irqs", prop, p, hwirq) {
+	of_property_for_each_u32_new(node, "atmel,external-irqs", hwirq) {
 		gc = irq_get_domain_generic_chip(domain, hwirq);
 		if (!gc) {
 			pr_warn("AIC: external irq %d >= %d skip it\n",

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 12/20] iio: adc: ti_am335x_adc: convert to of_property_for_each_u32_new()
  2024-07-03 10:36 [PATCH 00/20] Simplify of_property_for_each_u32() Luca Ceresoli
                   ` (10 preceding siblings ...)
  2024-07-03 10:36 ` [PATCH 11/20] irqchip/atmel-aic: " Luca Ceresoli
@ 2024-07-03 10:36 ` Luca Ceresoli
  2024-07-03 15:34   ` Jonathan Cameron
  2024-07-03 10:36 ` [PATCH 13/20] pwm: samsung: " Luca Ceresoli
                   ` (8 subsequent siblings)
  20 siblings, 1 reply; 34+ messages in thread
From: Luca Ceresoli @ 2024-07-03 10:36 UTC (permalink / raw)
  To: Miguel Ojeda, Rob Herring, Saravana Kannan, Nathan Chancellor,
	Michael Turquette, Stephen Boyd, Tony Lindgren, Bjorn Andersson,
	Emilio López, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Krzysztof Kozlowski, Daniel Lezcano, Thomas Gleixner,
	Florian Fainelli, Broadcom internal kernel review list,
	Linus Walleij, Bartosz Golaszewski, Jonathan Cameron, Lee Jones,
	Shawn Guo, Pengutronix Kernel Team, Uwe Kleine-König,
	Greg Kroah-Hartman, Jiri Slaby, Richard Leitner, Liam Girdwood,
	Mark Brown, Nicolas Ferre, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Naveen N. Rao, Damien Le Moal
  Cc: Peng Fan (OSS), Thomas Petazzoni, linux-kernel, devicetree, llvm,
	linux-clk, linux-omap, linux-arm-msm, linux-arm-kernel,
	linux-sunxi, linux-samsung-soc, linux-gpio, linux-iio, linux-pwm,
	linux-serial, linux-usb, patches, linux-sound, linuxppc-dev,
	linux-riscv, Luca Ceresoli

Simplify code using of_property_for_each_u32_new() as the two additional
parameters in of_property_for_each_u32() are not used here.

Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
 drivers/iio/adc/ti_am335x_adc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c
index 95fa857e8aad..ca0f542ebc77 100644
--- a/drivers/iio/adc/ti_am335x_adc.c
+++ b/drivers/iio/adc/ti_am335x_adc.c
@@ -564,13 +564,11 @@ static int tiadc_parse_dt(struct platform_device *pdev,
 			  struct tiadc_device *adc_dev)
 {
 	struct device_node *node = pdev->dev.of_node;
-	struct property *prop;
-	const __be32 *cur;
 	int channels = 0;
 	u32 val;
 	int i;
 
-	of_property_for_each_u32(node, "ti,adc-channels", prop, cur, val) {
+	of_property_for_each_u32_new(node, "ti,adc-channels", val) {
 		adc_dev->channel_line[channels] = val;
 
 		/* Set Default values for optional DT parameters */

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 13/20] pwm: samsung: convert to of_property_for_each_u32_new()
  2024-07-03 10:36 [PATCH 00/20] Simplify of_property_for_each_u32() Luca Ceresoli
                   ` (11 preceding siblings ...)
  2024-07-03 10:36 ` [PATCH 12/20] iio: adc: ti_am335x_adc: " Luca Ceresoli
@ 2024-07-03 10:36 ` Luca Ceresoli
  2024-07-03 21:23   ` Uwe Kleine-König
  2024-07-03 10:36 ` [PATCH 14/20] tty: sysrq: " Luca Ceresoli
                   ` (7 subsequent siblings)
  20 siblings, 1 reply; 34+ messages in thread
From: Luca Ceresoli @ 2024-07-03 10:36 UTC (permalink / raw)
  To: Miguel Ojeda, Rob Herring, Saravana Kannan, Nathan Chancellor,
	Michael Turquette, Stephen Boyd, Tony Lindgren, Bjorn Andersson,
	Emilio López, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Krzysztof Kozlowski, Daniel Lezcano, Thomas Gleixner,
	Florian Fainelli, Broadcom internal kernel review list,
	Linus Walleij, Bartosz Golaszewski, Jonathan Cameron, Lee Jones,
	Shawn Guo, Pengutronix Kernel Team, Uwe Kleine-König,
	Greg Kroah-Hartman, Jiri Slaby, Richard Leitner, Liam Girdwood,
	Mark Brown, Nicolas Ferre, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Naveen N. Rao, Damien Le Moal
  Cc: Peng Fan (OSS), Thomas Petazzoni, linux-kernel, devicetree, llvm,
	linux-clk, linux-omap, linux-arm-msm, linux-arm-kernel,
	linux-sunxi, linux-samsung-soc, linux-gpio, linux-iio, linux-pwm,
	linux-serial, linux-usb, patches, linux-sound, linuxppc-dev,
	linux-riscv, Luca Ceresoli

Simplify code using of_property_for_each_u32_new() as the two additional
parameters in of_property_for_each_u32() are not used here.

Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
 drivers/pwm/pwm-samsung.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/pwm/pwm-samsung.c b/drivers/pwm/pwm-samsung.c
index efb60c9f0cb3..fef02a0b023e 100644
--- a/drivers/pwm/pwm-samsung.c
+++ b/drivers/pwm/pwm-samsung.c
@@ -510,8 +510,6 @@ static int pwm_samsung_parse_dt(struct pwm_chip *chip)
 	struct samsung_pwm_chip *our_chip = to_samsung_pwm_chip(chip);
 	struct device_node *np = pwmchip_parent(chip)->of_node;
 	const struct of_device_id *match;
-	struct property *prop;
-	const __be32 *cur;
 	u32 val;
 
 	match = of_match_node(samsung_pwm_matches, np);
@@ -520,7 +518,7 @@ static int pwm_samsung_parse_dt(struct pwm_chip *chip)
 
 	memcpy(&our_chip->variant, match->data, sizeof(our_chip->variant));
 
-	of_property_for_each_u32(np, "samsung,pwm-outputs", prop, cur, val) {
+	of_property_for_each_u32_new(np, "samsung,pwm-outputs", val) {
 		if (val >= SAMSUNG_PWM_NUM) {
 			dev_err(pwmchip_parent(chip),
 				"%s: invalid channel index in samsung,pwm-outputs property\n",

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 14/20] tty: sysrq: convert to of_property_for_each_u32_new()
  2024-07-03 10:36 [PATCH 00/20] Simplify of_property_for_each_u32() Luca Ceresoli
                   ` (12 preceding siblings ...)
  2024-07-03 10:36 ` [PATCH 13/20] pwm: samsung: " Luca Ceresoli
@ 2024-07-03 10:36 ` Luca Ceresoli
  2024-07-03 10:36 ` [PATCH 15/20] usb: usb251xb: " Luca Ceresoli
                   ` (6 subsequent siblings)
  20 siblings, 0 replies; 34+ messages in thread
From: Luca Ceresoli @ 2024-07-03 10:36 UTC (permalink / raw)
  To: Miguel Ojeda, Rob Herring, Saravana Kannan, Nathan Chancellor,
	Michael Turquette, Stephen Boyd, Tony Lindgren, Bjorn Andersson,
	Emilio López, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Krzysztof Kozlowski, Daniel Lezcano, Thomas Gleixner,
	Florian Fainelli, Broadcom internal kernel review list,
	Linus Walleij, Bartosz Golaszewski, Jonathan Cameron, Lee Jones,
	Shawn Guo, Pengutronix Kernel Team, Uwe Kleine-König,
	Greg Kroah-Hartman, Jiri Slaby, Richard Leitner, Liam Girdwood,
	Mark Brown, Nicolas Ferre, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Naveen N. Rao, Damien Le Moal
  Cc: Peng Fan (OSS), Thomas Petazzoni, linux-kernel, devicetree, llvm,
	linux-clk, linux-omap, linux-arm-msm, linux-arm-kernel,
	linux-sunxi, linux-samsung-soc, linux-gpio, linux-iio, linux-pwm,
	linux-serial, linux-usb, patches, linux-sound, linuxppc-dev,
	linux-riscv, Luca Ceresoli

Simplify code using of_property_for_each_u32_new() as the two additional
parameters in of_property_for_each_u32() are not used here.

Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
 drivers/tty/sysrq.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
index e5974b8239c9..719376dda5c1 100644
--- a/drivers/tty/sysrq.c
+++ b/drivers/tty/sysrq.c
@@ -770,8 +770,6 @@ static void sysrq_of_get_keyreset_config(void)
 {
 	u32 key;
 	struct device_node *np;
-	struct property *prop;
-	const __be32 *p;
 
 	np = of_find_node_by_path("/chosen/linux,sysrq-reset-seq");
 	if (!np) {
@@ -782,7 +780,7 @@ static void sysrq_of_get_keyreset_config(void)
 	/* Reset in case a __weak definition was present */
 	sysrq_reset_seq_len = 0;
 
-	of_property_for_each_u32(np, "keyset", prop, p, key) {
+	of_property_for_each_u32_new(np, "keyset", key) {
 		if (key == KEY_RESERVED || key > KEY_MAX ||
 		    sysrq_reset_seq_len == SYSRQ_KEY_RESET_MAX)
 			break;

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 15/20] usb: usb251xb: convert to of_property_for_each_u32_new()
  2024-07-03 10:36 [PATCH 00/20] Simplify of_property_for_each_u32() Luca Ceresoli
                   ` (13 preceding siblings ...)
  2024-07-03 10:36 ` [PATCH 14/20] tty: sysrq: " Luca Ceresoli
@ 2024-07-03 10:36 ` Luca Ceresoli
  2024-07-08  7:45   ` Richard Leitner
  2024-07-03 10:37 ` [PATCH 16/20] mfd: ti_am335x_tscadc: " Luca Ceresoli
                   ` (5 subsequent siblings)
  20 siblings, 1 reply; 34+ messages in thread
From: Luca Ceresoli @ 2024-07-03 10:36 UTC (permalink / raw)
  To: Miguel Ojeda, Rob Herring, Saravana Kannan, Nathan Chancellor,
	Michael Turquette, Stephen Boyd, Tony Lindgren, Bjorn Andersson,
	Emilio López, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Krzysztof Kozlowski, Daniel Lezcano, Thomas Gleixner,
	Florian Fainelli, Broadcom internal kernel review list,
	Linus Walleij, Bartosz Golaszewski, Jonathan Cameron, Lee Jones,
	Shawn Guo, Pengutronix Kernel Team, Uwe Kleine-König,
	Greg Kroah-Hartman, Jiri Slaby, Richard Leitner, Liam Girdwood,
	Mark Brown, Nicolas Ferre, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Naveen N. Rao, Damien Le Moal
  Cc: Peng Fan (OSS), Thomas Petazzoni, linux-kernel, devicetree, llvm,
	linux-clk, linux-omap, linux-arm-msm, linux-arm-kernel,
	linux-sunxi, linux-samsung-soc, linux-gpio, linux-iio, linux-pwm,
	linux-serial, linux-usb, patches, linux-sound, linuxppc-dev,
	linux-riscv, Luca Ceresoli

Simplify code using of_property_for_each_u32_new() as the two additional
parameters in of_property_for_each_u32() are not used here.

Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
 drivers/usb/misc/usb251xb.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/usb/misc/usb251xb.c b/drivers/usb/misc/usb251xb.c
index 7da404f55a6d..490004dbb9d8 100644
--- a/drivers/usb/misc/usb251xb.c
+++ b/drivers/usb/misc/usb251xb.c
@@ -382,11 +382,9 @@ static void usb251xb_get_ports_field(struct usb251xb *hub,
 				    bool ds_only, u8 *fld)
 {
 	struct device *dev = hub->dev;
-	struct property *prop;
-	const __be32 *p;
 	u32 port;
 
-	of_property_for_each_u32(dev->of_node, prop_name, prop, p, port) {
+	of_property_for_each_u32_new(dev->of_node, prop_name, port) {
 		if ((port >= ds_only ? 1 : 0) && (port <= port_cnt))
 			*fld |= BIT(port);
 		else

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 16/20] mfd: ti_am335x_tscadc: convert to of_property_for_each_u32_new()
  2024-07-03 10:36 [PATCH 00/20] Simplify of_property_for_each_u32() Luca Ceresoli
                   ` (14 preceding siblings ...)
  2024-07-03 10:36 ` [PATCH 15/20] usb: usb251xb: " Luca Ceresoli
@ 2024-07-03 10:37 ` Luca Ceresoli
  2024-07-03 10:37 ` [PATCH 17/20] ASoC: arizona: " Luca Ceresoli
                   ` (4 subsequent siblings)
  20 siblings, 0 replies; 34+ messages in thread
From: Luca Ceresoli @ 2024-07-03 10:37 UTC (permalink / raw)
  To: Miguel Ojeda, Rob Herring, Saravana Kannan, Nathan Chancellor,
	Michael Turquette, Stephen Boyd, Tony Lindgren, Bjorn Andersson,
	Emilio López, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Krzysztof Kozlowski, Daniel Lezcano, Thomas Gleixner,
	Florian Fainelli, Broadcom internal kernel review list,
	Linus Walleij, Bartosz Golaszewski, Jonathan Cameron, Lee Jones,
	Shawn Guo, Pengutronix Kernel Team, Uwe Kleine-König,
	Greg Kroah-Hartman, Jiri Slaby, Richard Leitner, Liam Girdwood,
	Mark Brown, Nicolas Ferre, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Naveen N. Rao, Damien Le Moal
  Cc: Peng Fan (OSS), Thomas Petazzoni, linux-kernel, devicetree, llvm,
	linux-clk, linux-omap, linux-arm-msm, linux-arm-kernel,
	linux-sunxi, linux-samsung-soc, linux-gpio, linux-iio, linux-pwm,
	linux-serial, linux-usb, patches, linux-sound, linuxppc-dev,
	linux-riscv, Luca Ceresoli

Simplify code using of_property_for_each_u32_new() as the two additional
parameters in of_property_for_each_u32() are not used here.

Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
 drivers/mfd/ti_am335x_tscadc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c
index 4bbd542d753e..a2e6112f885f 100644
--- a/drivers/mfd/ti_am335x_tscadc.c
+++ b/drivers/mfd/ti_am335x_tscadc.c
@@ -119,8 +119,6 @@ static	int ti_tscadc_probe(struct platform_device *pdev)
 	struct clk *clk;
 	struct device_node *node;
 	struct mfd_cell *cell;
-	struct property *prop;
-	const __be32 *cur;
 	bool use_tsc = false, use_mag = false;
 	u32 val;
 	int err;
@@ -167,7 +165,7 @@ static	int ti_tscadc_probe(struct platform_device *pdev)
 	}
 
 	node = of_get_child_by_name(pdev->dev.of_node, "adc");
-	of_property_for_each_u32(node, "ti,adc-channels", prop, cur, val) {
+	of_property_for_each_u32_new(node, "ti,adc-channels", val) {
 		adc_channels++;
 		if (val > 7) {
 			dev_err(&pdev->dev, " PIN numbers are 0..7 (not %d)\n",

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 17/20] ASoC: arizona: convert to of_property_for_each_u32_new()
  2024-07-03 10:36 [PATCH 00/20] Simplify of_property_for_each_u32() Luca Ceresoli
                   ` (15 preceding siblings ...)
  2024-07-03 10:37 ` [PATCH 16/20] mfd: ti_am335x_tscadc: " Luca Ceresoli
@ 2024-07-03 10:37 ` Luca Ceresoli
  2024-07-03 11:31   ` Richard Fitzgerald
  2024-07-03 12:18   ` Mark Brown
  2024-07-03 10:37 ` [PATCH 18/20] powerpc/xive: " Luca Ceresoli
                   ` (3 subsequent siblings)
  20 siblings, 2 replies; 34+ messages in thread
From: Luca Ceresoli @ 2024-07-03 10:37 UTC (permalink / raw)
  To: Miguel Ojeda, Rob Herring, Saravana Kannan, Nathan Chancellor,
	Michael Turquette, Stephen Boyd, Tony Lindgren, Bjorn Andersson,
	Emilio López, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Krzysztof Kozlowski, Daniel Lezcano, Thomas Gleixner,
	Florian Fainelli, Broadcom internal kernel review list,
	Linus Walleij, Bartosz Golaszewski, Jonathan Cameron, Lee Jones,
	Shawn Guo, Pengutronix Kernel Team, Uwe Kleine-König,
	Greg Kroah-Hartman, Jiri Slaby, Richard Leitner, Liam Girdwood,
	Mark Brown, Nicolas Ferre, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Naveen N. Rao, Damien Le Moal
  Cc: Peng Fan (OSS), Thomas Petazzoni, linux-kernel, devicetree, llvm,
	linux-clk, linux-omap, linux-arm-msm, linux-arm-kernel,
	linux-sunxi, linux-samsung-soc, linux-gpio, linux-iio, linux-pwm,
	linux-serial, linux-usb, patches, linux-sound, linuxppc-dev,
	linux-riscv, Luca Ceresoli

Simplify code using of_property_for_each_u32_new() as the two additional
parameters in of_property_for_each_u32() are not used here.

Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
 sound/soc/codecs/arizona.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c
index 7434aeeda292..1a64b9815809 100644
--- a/sound/soc/codecs/arizona.c
+++ b/sound/soc/codecs/arizona.c
@@ -2786,15 +2786,13 @@ int arizona_of_get_audio_pdata(struct arizona *arizona)
 {
 	struct arizona_pdata *pdata = &arizona->pdata;
 	struct device_node *np = arizona->dev->of_node;
-	struct property *prop;
-	const __be32 *cur;
 	u32 val;
 	u32 pdm_val[ARIZONA_MAX_PDM_SPK];
 	int ret;
 	int count = 0;
 
 	count = 0;
-	of_property_for_each_u32(np, "wlf,inmode", prop, cur, val) {
+	of_property_for_each_u32_new(np, "wlf,inmode", val) {
 		if (count == ARRAY_SIZE(pdata->inmode))
 			break;
 
@@ -2803,7 +2801,7 @@ int arizona_of_get_audio_pdata(struct arizona *arizona)
 	}
 
 	count = 0;
-	of_property_for_each_u32(np, "wlf,dmic-ref", prop, cur, val) {
+	of_property_for_each_u32_new(np, "wlf,dmic-ref", val) {
 		if (count == ARRAY_SIZE(pdata->dmic_ref))
 			break;
 
@@ -2812,7 +2810,7 @@ int arizona_of_get_audio_pdata(struct arizona *arizona)
 	}
 
 	count = 0;
-	of_property_for_each_u32(np, "wlf,out-mono", prop, cur, val) {
+	of_property_for_each_u32_new(np, "wlf,out-mono", val) {
 		if (count == ARRAY_SIZE(pdata->out_mono))
 			break;
 
@@ -2821,7 +2819,7 @@ int arizona_of_get_audio_pdata(struct arizona *arizona)
 	}
 
 	count = 0;
-	of_property_for_each_u32(np, "wlf,max-channels-clocked", prop, cur, val) {
+	of_property_for_each_u32_new(np, "wlf,max-channels-clocked", val) {
 		if (count == ARRAY_SIZE(pdata->max_channels_clocked))
 			break;
 
@@ -2830,7 +2828,7 @@ int arizona_of_get_audio_pdata(struct arizona *arizona)
 	}
 
 	count = 0;
-	of_property_for_each_u32(np, "wlf,out-volume-limit", prop, cur, val) {
+	of_property_for_each_u32_new(np, "wlf,out-volume-limit", val) {
 		if (count == ARRAY_SIZE(pdata->out_vol_limit))
 			break;
 

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 18/20] powerpc/xive: convert to of_property_for_each_u32_new()
  2024-07-03 10:36 [PATCH 00/20] Simplify of_property_for_each_u32() Luca Ceresoli
                   ` (16 preceding siblings ...)
  2024-07-03 10:37 ` [PATCH 17/20] ASoC: arizona: " Luca Ceresoli
@ 2024-07-03 10:37 ` Luca Ceresoli
  2024-07-03 10:37 ` [PATCH 19/20] " Luca Ceresoli
                   ` (2 subsequent siblings)
  20 siblings, 0 replies; 34+ messages in thread
From: Luca Ceresoli @ 2024-07-03 10:37 UTC (permalink / raw)
  To: Miguel Ojeda, Rob Herring, Saravana Kannan, Nathan Chancellor,
	Michael Turquette, Stephen Boyd, Tony Lindgren, Bjorn Andersson,
	Emilio López, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Krzysztof Kozlowski, Daniel Lezcano, Thomas Gleixner,
	Florian Fainelli, Broadcom internal kernel review list,
	Linus Walleij, Bartosz Golaszewski, Jonathan Cameron, Lee Jones,
	Shawn Guo, Pengutronix Kernel Team, Uwe Kleine-König,
	Greg Kroah-Hartman, Jiri Slaby, Richard Leitner, Liam Girdwood,
	Mark Brown, Nicolas Ferre, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Naveen N. Rao, Damien Le Moal
  Cc: Peng Fan (OSS), Thomas Petazzoni, linux-kernel, devicetree, llvm,
	linux-clk, linux-omap, linux-arm-msm, linux-arm-kernel,
	linux-sunxi, linux-samsung-soc, linux-gpio, linux-iio, linux-pwm,
	linux-serial, linux-usb, patches, linux-sound, linuxppc-dev,
	linux-riscv, Luca Ceresoli

Simplify code using of_property_for_each_u32_new() as the two additional
parameters in of_property_for_each_u32() are not used here.

Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
 arch/powerpc/sysdev/xive/native.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/powerpc/sysdev/xive/native.c b/arch/powerpc/sysdev/xive/native.c
index 517b963e3e6a..de31a1588303 100644
--- a/arch/powerpc/sysdev/xive/native.c
+++ b/arch/powerpc/sysdev/xive/native.c
@@ -559,9 +559,7 @@ bool __init xive_native_init(void)
 	struct device_node *np;
 	struct resource r;
 	void __iomem *tima;
-	struct property *prop;
 	u8 max_prio = 7;
-	const __be32 *p;
 	u32 val, cpu;
 	s64 rc;
 
@@ -592,7 +590,7 @@ bool __init xive_native_init(void)
 		max_prio = val - 1;
 
 	/* Iterate the EQ sizes and pick one */
-	of_property_for_each_u32(np, "ibm,xive-eq-sizes", prop, p, val) {
+	of_property_for_each_u32_new(np, "ibm,xive-eq-sizes", val) {
 		xive_queue_shift = val;
 		if (val == PAGE_SHIFT)
 			break;

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 19/20] powerpc/xive: convert to of_property_for_each_u32_new()
  2024-07-03 10:36 [PATCH 00/20] Simplify of_property_for_each_u32() Luca Ceresoli
                   ` (17 preceding siblings ...)
  2024-07-03 10:37 ` [PATCH 18/20] powerpc/xive: " Luca Ceresoli
@ 2024-07-03 10:37 ` Luca Ceresoli
  2024-07-03 10:37 ` [PATCH 20/20] of: deprecate and rename of_property_for_each_u32() Luca Ceresoli
  2024-07-03 18:07 ` [PATCH 00/20] Simplify of_property_for_each_u32() Rob Herring
  20 siblings, 0 replies; 34+ messages in thread
From: Luca Ceresoli @ 2024-07-03 10:37 UTC (permalink / raw)
  To: Miguel Ojeda, Rob Herring, Saravana Kannan, Nathan Chancellor,
	Michael Turquette, Stephen Boyd, Tony Lindgren, Bjorn Andersson,
	Emilio López, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Krzysztof Kozlowski, Daniel Lezcano, Thomas Gleixner,
	Florian Fainelli, Broadcom internal kernel review list,
	Linus Walleij, Bartosz Golaszewski, Jonathan Cameron, Lee Jones,
	Shawn Guo, Pengutronix Kernel Team, Uwe Kleine-König,
	Greg Kroah-Hartman, Jiri Slaby, Richard Leitner, Liam Girdwood,
	Mark Brown, Nicolas Ferre, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Naveen N. Rao, Damien Le Moal
  Cc: Peng Fan (OSS), Thomas Petazzoni, linux-kernel, devicetree, llvm,
	linux-clk, linux-omap, linux-arm-msm, linux-arm-kernel,
	linux-sunxi, linux-samsung-soc, linux-gpio, linux-iio, linux-pwm,
	linux-serial, linux-usb, patches, linux-sound, linuxppc-dev,
	linux-riscv, Luca Ceresoli

Simplify code using of_property_for_each_u32_new() as the two additional
parameters in of_property_for_each_u32() are not used here.

In this case only the 'prop' variable can be removed and not 'reg',
because 'reg' is used in _previous_ lines of the same function. There
is no side effect because the of_property_for_each_u32() macro being
removed would anyway write 'reg' bwfore reading its value, and 'reg'
is not used in _following_ lines.

Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
 arch/powerpc/sysdev/xive/spapr.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/powerpc/sysdev/xive/spapr.c b/arch/powerpc/sysdev/xive/spapr.c
index e45419264391..ffa6ca5db183 100644
--- a/arch/powerpc/sysdev/xive/spapr.c
+++ b/arch/powerpc/sysdev/xive/spapr.c
@@ -814,7 +814,6 @@ bool __init xive_spapr_init(void)
 	struct device_node *np;
 	struct resource r;
 	void __iomem *tima;
-	struct property *prop;
 	u8 max_prio;
 	u32 val;
 	u32 len;
@@ -866,7 +865,7 @@ bool __init xive_spapr_init(void)
 	}
 
 	/* Iterate the EQ sizes and pick one */
-	of_property_for_each_u32(np, "ibm,xive-eq-sizes", prop, reg, val) {
+	of_property_for_each_u32_new(np, "ibm,xive-eq-sizes", val) {
 		xive_queue_shift = val;
 		if (val == PAGE_SHIFT)
 			break;

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 20/20] of: deprecate and rename of_property_for_each_u32()
  2024-07-03 10:36 [PATCH 00/20] Simplify of_property_for_each_u32() Luca Ceresoli
                   ` (18 preceding siblings ...)
  2024-07-03 10:37 ` [PATCH 19/20] " Luca Ceresoli
@ 2024-07-03 10:37 ` Luca Ceresoli
  2024-07-03 18:01   ` Rob Herring
  2024-07-03 18:07 ` [PATCH 00/20] Simplify of_property_for_each_u32() Rob Herring
  20 siblings, 1 reply; 34+ messages in thread
From: Luca Ceresoli @ 2024-07-03 10:37 UTC (permalink / raw)
  To: Miguel Ojeda, Rob Herring, Saravana Kannan, Nathan Chancellor,
	Michael Turquette, Stephen Boyd, Tony Lindgren, Bjorn Andersson,
	Emilio López, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Krzysztof Kozlowski, Daniel Lezcano, Thomas Gleixner,
	Florian Fainelli, Broadcom internal kernel review list,
	Linus Walleij, Bartosz Golaszewski, Jonathan Cameron, Lee Jones,
	Shawn Guo, Pengutronix Kernel Team, Uwe Kleine-König,
	Greg Kroah-Hartman, Jiri Slaby, Richard Leitner, Liam Girdwood,
	Mark Brown, Nicolas Ferre, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Naveen N. Rao, Damien Le Moal
  Cc: Peng Fan (OSS), Thomas Petazzoni, linux-kernel, devicetree, llvm,
	linux-clk, linux-omap, linux-arm-msm, linux-arm-kernel,
	linux-sunxi, linux-samsung-soc, linux-gpio, linux-iio, linux-pwm,
	linux-serial, linux-usb, patches, linux-sound, linuxppc-dev,
	linux-riscv, Luca Ceresoli

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@bootlin.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


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* Re: [PATCH 17/20] ASoC: arizona: convert to of_property_for_each_u32_new()
  2024-07-03 10:37 ` [PATCH 17/20] ASoC: arizona: " Luca Ceresoli
@ 2024-07-03 11:31   ` Richard Fitzgerald
  2024-07-03 12:18   ` Mark Brown
  1 sibling, 0 replies; 34+ messages in thread
From: Richard Fitzgerald @ 2024-07-03 11:31 UTC (permalink / raw)
  To: Luca Ceresoli, Miguel Ojeda, Rob Herring, Saravana Kannan,
	Nathan Chancellor, Michael Turquette, Stephen Boyd, Tony Lindgren,
	Bjorn Andersson, Emilio López, Chen-Yu Tsai, Jernej Skrabec,
	Samuel Holland, Krzysztof Kozlowski, Daniel Lezcano,
	Thomas Gleixner, Florian Fainelli,
	Broadcom internal kernel review list, Linus Walleij,
	Bartosz Golaszewski, Jonathan Cameron, Lee Jones, Shawn Guo,
	Pengutronix Kernel Team, Uwe Kleine-König,
	Greg Kroah-Hartman, Jiri Slaby, Richard Leitner, Liam Girdwood,
	Mark Brown, Nicolas Ferre, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Naveen N. Rao, Damien Le Moal
  Cc: Peng Fan (OSS), Thomas Petazzoni, linux-kernel, devicetree, llvm,
	linux-clk, linux-omap, linux-arm-msm, linux-arm-kernel,
	linux-sunxi, linux-samsung-soc, linux-gpio, linux-iio, linux-pwm,
	linux-serial, linux-usb, patches, linux-sound, linuxppc-dev,
	linux-riscv

On 03/07/2024 11:37, Luca Ceresoli wrote:
> Simplify code using of_property_for_each_u32_new() as the two additional
> parameters in of_property_for_each_u32() are not used here.
> 
> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
> ---
>   sound/soc/codecs/arizona.c | 12 +++++-------
>   1 file changed, 5 insertions(+), 7 deletions(-)
> 
> diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c
> index 7434aeeda292..1a64b9815809 100644
> --- a/sound/soc/codecs/arizona.c
> +++ b/sound/soc/codecs/arizona.c
> @@ -2786,15 +2786,13 @@ int arizona_of_get_audio_pdata(struct arizona *arizona)
>   {
>   	struct arizona_pdata *pdata = &arizona->pdata;
>   	struct device_node *np = arizona->dev->of_node;
> -	struct property *prop;
> -	const __be32 *cur;
>   	u32 val;
>   	u32 pdm_val[ARIZONA_MAX_PDM_SPK];
>   	int ret;
>   	int count = 0;
>   
>   	count = 0;
> -	of_property_for_each_u32(np, "wlf,inmode", prop, cur, val) {
> +	of_property_for_each_u32_new(np, "wlf,inmode", val) {
>   		if (count == ARRAY_SIZE(pdata->inmode))
>   			break;
>   
> @@ -2803,7 +2801,7 @@ int arizona_of_get_audio_pdata(struct arizona *arizona)
>   	}
>   
>   	count = 0;
> -	of_property_for_each_u32(np, "wlf,dmic-ref", prop, cur, val) {
> +	of_property_for_each_u32_new(np, "wlf,dmic-ref", val) {
>   		if (count == ARRAY_SIZE(pdata->dmic_ref))
>   			break;
>   
> @@ -2812,7 +2810,7 @@ int arizona_of_get_audio_pdata(struct arizona *arizona)
>   	}
>   
>   	count = 0;
> -	of_property_for_each_u32(np, "wlf,out-mono", prop, cur, val) {
> +	of_property_for_each_u32_new(np, "wlf,out-mono", val) {
>   		if (count == ARRAY_SIZE(pdata->out_mono))
>   			break;
>   
> @@ -2821,7 +2819,7 @@ int arizona_of_get_audio_pdata(struct arizona *arizona)
>   	}
>   
>   	count = 0;
> -	of_property_for_each_u32(np, "wlf,max-channels-clocked", prop, cur, val) {
> +	of_property_for_each_u32_new(np, "wlf,max-channels-clocked", val) {
>   		if (count == ARRAY_SIZE(pdata->max_channels_clocked))
>   			break;
>   
> @@ -2830,7 +2828,7 @@ int arizona_of_get_audio_pdata(struct arizona *arizona)
>   	}
>   
>   	count = 0;
> -	of_property_for_each_u32(np, "wlf,out-volume-limit", prop, cur, val) {
> +	of_property_for_each_u32_new(np, "wlf,out-volume-limit", val) {
>   		if (count == ARRAY_SIZE(pdata->out_vol_limit))
>   			break;
>   
> 
Reviewed-by: Richard Fitzgerald <rf@opensource.cirrus.com>

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 09/20] gpio: brcmstb: convert to of_property_for_each_u32_new()
  2024-07-03 10:36 ` [PATCH 09/20] gpio: brcmstb: " Luca Ceresoli
@ 2024-07-03 11:33   ` Bartosz Golaszewski
  0 siblings, 0 replies; 34+ messages in thread
From: Bartosz Golaszewski @ 2024-07-03 11:33 UTC (permalink / raw)
  To: Luca Ceresoli
  Cc: Miguel Ojeda, Rob Herring, Saravana Kannan, Nathan Chancellor,
	Michael Turquette, Stephen Boyd, Tony Lindgren, Bjorn Andersson,
	Emilio López, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Krzysztof Kozlowski, Daniel Lezcano, Thomas Gleixner,
	Florian Fainelli, Broadcom internal kernel review list,
	Linus Walleij, Jonathan Cameron, Lee Jones, Shawn Guo,
	Pengutronix Kernel Team, Uwe Kleine-König,
	Greg Kroah-Hartman, Jiri Slaby, Richard Leitner, Liam Girdwood,
	Mark Brown, Nicolas Ferre, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Naveen N. Rao, Damien Le Moal, Peng Fan (OSS),
	Thomas Petazzoni, linux-kernel, devicetree, llvm, linux-clk,
	linux-omap, linux-arm-msm, linux-arm-kernel, linux-sunxi,
	linux-samsung-soc, linux-gpio, linux-iio, linux-pwm, linux-serial,
	linux-usb, patches, linux-sound, linuxppc-dev, linux-riscv

On Wed, Jul 3, 2024 at 12:38 PM Luca Ceresoli <luca.ceresoli@bootlin.com> wrote:
>
> Simplify code using of_property_for_each_u32_new() as the two additional
> parameters in of_property_for_each_u32() are not used here.
>
> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
> ---
>  drivers/gpio/gpio-brcmstb.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/gpio/gpio-brcmstb.c b/drivers/gpio/gpio-brcmstb.c
> index 8dce78ea7139..77557bc596cd 100644
> --- a/drivers/gpio/gpio-brcmstb.c
> +++ b/drivers/gpio/gpio-brcmstb.c
> @@ -591,8 +591,6 @@ static int brcmstb_gpio_probe(struct platform_device *pdev)
>         void __iomem *reg_base;
>         struct brcmstb_gpio_priv *priv;
>         struct resource *res;
> -       struct property *prop;
> -       const __be32 *p;
>         u32 bank_width;
>         int num_banks = 0;
>         int num_gpios = 0;
> @@ -636,8 +634,7 @@ static int brcmstb_gpio_probe(struct platform_device *pdev)
>         flags = BGPIOF_BIG_ENDIAN_BYTE_ORDER;
>  #endif
>
> -       of_property_for_each_u32(np, "brcm,gpio-bank-widths", prop, p,
> -                       bank_width) {
> +       of_property_for_each_u32_new(np, "brcm,gpio-bank-widths", bank_width) {
>                 struct brcmstb_gpio_bank *bank;
>                 struct gpio_chip *gc;
>
>
> --
> 2.34.1
>

Acked-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 17/20] ASoC: arizona: convert to of_property_for_each_u32_new()
  2024-07-03 10:37 ` [PATCH 17/20] ASoC: arizona: " Luca Ceresoli
  2024-07-03 11:31   ` Richard Fitzgerald
@ 2024-07-03 12:18   ` Mark Brown
  1 sibling, 0 replies; 34+ messages in thread
From: Mark Brown @ 2024-07-03 12:18 UTC (permalink / raw)
  To: Luca Ceresoli
  Cc: Miguel Ojeda, Rob Herring, Saravana Kannan, Nathan Chancellor,
	Michael Turquette, Stephen Boyd, Tony Lindgren, Bjorn Andersson,
	Emilio López, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Krzysztof Kozlowski, Daniel Lezcano, Thomas Gleixner,
	Florian Fainelli, Broadcom internal kernel review list,
	Linus Walleij, Bartosz Golaszewski, Jonathan Cameron, Lee Jones,
	Shawn Guo, Pengutronix Kernel Team, Uwe Kleine-König,
	Greg Kroah-Hartman, Jiri Slaby, Richard Leitner, Liam Girdwood,
	Nicolas Ferre, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Naveen N. Rao, Damien Le Moal, Peng Fan (OSS),
	Thomas Petazzoni, linux-kernel, devicetree, llvm, linux-clk,
	linux-omap, linux-arm-msm, linux-arm-kernel, linux-sunxi,
	linux-samsung-soc, linux-gpio, linux-iio, linux-pwm, linux-serial,
	linux-usb, patches, linux-sound, linuxppc-dev, linux-riscv

[-- Attachment #1: Type: text/plain, Size: 243 bytes --]

On Wed, Jul 03, 2024 at 12:37:01PM +0200, Luca Ceresoli wrote:
> Simplify code using of_property_for_each_u32_new() as the two additional
> parameters in of_property_for_each_u32() are not used here.

Acked-by: Mark Brown <broonie@kernel.org>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 05/20] clk: sunxi: clk-sun8i-bus-gates: convert to of_property_for_each_u32_new()
  2024-07-03 10:36 ` [PATCH 05/20] clk: sunxi: clk-sun8i-bus-gates: " Luca Ceresoli
@ 2024-07-03 12:19   ` Andre Przywara
  0 siblings, 0 replies; 34+ messages in thread
From: Andre Przywara @ 2024-07-03 12:19 UTC (permalink / raw)
  To: Luca Ceresoli
  Cc: Miguel Ojeda, Rob Herring, Saravana Kannan, Nathan Chancellor,
	Michael Turquette, Stephen Boyd, Tony Lindgren, Bjorn Andersson,
	Emilio López, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Krzysztof Kozlowski, Daniel Lezcano, Thomas Gleixner,
	Florian Fainelli, Broadcom internal kernel review list,
	Linus Walleij, Bartosz Golaszewski, Jonathan Cameron, Lee Jones,
	Shawn Guo, Pengutronix Kernel Team, Uwe Kleine-König,
	Greg Kroah-Hartman, Jiri Slaby, Richard Leitner, Liam Girdwood,
	Mark Brown, Nicolas Ferre, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Naveen N. Rao, Damien Le Moal, Peng Fan (OSS),
	Thomas Petazzoni, linux-kernel, devicetree, llvm, linux-clk,
	linux-omap, linux-arm-msm, linux-arm-kernel, linux-sunxi,
	linux-samsung-soc, linux-gpio, linux-iio, linux-pwm, linux-serial,
	linux-usb, patches, linux-sound, linuxppc-dev, linux-riscv

On Wed, 03 Jul 2024 12:36:49 +0200
Luca Ceresoli <luca.ceresoli@bootlin.com> wrote:

> Simplify code using of_property_for_each_u32_new() as the two additional
> parameters in of_property_for_each_u32() are not used here.
> 
> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>

Reviewed-by: Andre Przywara <andre.przywara@arm.com>

Cheers,
Andre

> ---
>  drivers/clk/sunxi/clk-sun8i-bus-gates.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/clk/sunxi/clk-sun8i-bus-gates.c b/drivers/clk/sunxi/clk-sun8i-bus-gates.c
> index b87f331f63c9..21f036457a86 100644
> --- a/drivers/clk/sunxi/clk-sun8i-bus-gates.c
> +++ b/drivers/clk/sunxi/clk-sun8i-bus-gates.c
> @@ -24,11 +24,9 @@ static void __init sun8i_h3_bus_gates_init(struct device_node *node)
>  	const char *parents[PARENT_MAX];
>  	struct clk_onecell_data *clk_data;
>  	const char *clk_name;
> -	struct property *prop;
>  	struct resource res;
>  	void __iomem *clk_reg;
>  	void __iomem *reg;
> -	const __be32 *p;
>  	int number, i;
>  	u8 clk_bit;
>  	int index;
> @@ -58,7 +56,7 @@ static void __init sun8i_h3_bus_gates_init(struct device_node *node)
>  		goto err_free_data;
>  
>  	i = 0;
> -	of_property_for_each_u32(node, "clock-indices", prop, p, index) {
> +	of_property_for_each_u32_new(node, "clock-indices", index) {
>  		of_property_read_string_index(node, "clock-output-names",
>  					      i, &clk_name);
>  
> 


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 04/20] clk: sunxi: clk-simple-gates: convert to of_property_for_each_u32_new()
  2024-07-03 10:36 ` [PATCH 04/20] clk: sunxi: clk-simple-gates: " Luca Ceresoli
@ 2024-07-03 12:21   ` Andre Przywara
  0 siblings, 0 replies; 34+ messages in thread
From: Andre Przywara @ 2024-07-03 12:21 UTC (permalink / raw)
  To: Luca Ceresoli
  Cc: Miguel Ojeda, Rob Herring, Saravana Kannan, Nathan Chancellor,
	Michael Turquette, Stephen Boyd, Tony Lindgren, Bjorn Andersson,
	Emilio López, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Krzysztof Kozlowski, Daniel Lezcano, Thomas Gleixner,
	Florian Fainelli, Broadcom internal kernel review list,
	Linus Walleij, Bartosz Golaszewski, Jonathan Cameron, Lee Jones,
	Shawn Guo, Pengutronix Kernel Team, Uwe Kleine-König,
	Greg Kroah-Hartman, Jiri Slaby, Richard Leitner, Liam Girdwood,
	Mark Brown, Nicolas Ferre, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Naveen N. Rao, Damien Le Moal, Peng Fan (OSS),
	Thomas Petazzoni, linux-kernel, devicetree, llvm, linux-clk,
	linux-omap, linux-arm-msm, linux-arm-kernel, linux-sunxi,
	linux-samsung-soc, linux-gpio, linux-iio, linux-pwm, linux-serial,
	linux-usb, patches, linux-sound, linuxppc-dev, linux-riscv

On Wed, 03 Jul 2024 12:36:48 +0200
Luca Ceresoli <luca.ceresoli@bootlin.com> wrote:

> Simplify code using of_property_for_each_u32_new() as the two additional
> parameters in of_property_for_each_u32() are not used here.
> 
> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>

Reviewed-by: Andre Przywara <andre.przywara@arm.com>

Cheers,
Andre

> ---
>  drivers/clk/sunxi/clk-simple-gates.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/clk/sunxi/clk-simple-gates.c b/drivers/clk/sunxi/clk-simple-gates.c
> index 0399627c226a..a30d14937e0b 100644
> --- a/drivers/clk/sunxi/clk-simple-gates.c
> +++ b/drivers/clk/sunxi/clk-simple-gates.c
> @@ -21,11 +21,9 @@ static void __init sunxi_simple_gates_setup(struct device_node *node,
>  {
>  	struct clk_onecell_data *clk_data;
>  	const char *clk_parent, *clk_name;
> -	struct property *prop;
>  	struct resource res;
>  	void __iomem *clk_reg;
>  	void __iomem *reg;
> -	const __be32 *p;
>  	int number, i = 0, j;
>  	u8 clk_bit;
>  	u32 index;
> @@ -47,7 +45,7 @@ static void __init sunxi_simple_gates_setup(struct device_node *node,
>  	if (!clk_data->clks)
>  		goto err_free_data;
>  
> -	of_property_for_each_u32(node, "clock-indices", prop, p, index) {
> +	of_property_for_each_u32_new(node, "clock-indices", index) {
>  		of_property_read_string_index(node, "clock-output-names",
>  					      i, &clk_name);
>  
> 


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 11/20] irqchip/atmel-aic: convert to of_property_for_each_u32_new()
  2024-07-03 10:36 ` [PATCH 11/20] irqchip/atmel-aic: " Luca Ceresoli
@ 2024-07-03 13:09   ` Nicolas Ferre
  0 siblings, 0 replies; 34+ messages in thread
From: Nicolas Ferre @ 2024-07-03 13:09 UTC (permalink / raw)
  To: Luca Ceresoli, Miguel Ojeda, Rob Herring, Saravana Kannan,
	Nathan Chancellor, Michael Turquette, Stephen Boyd, Tony Lindgren,
	Bjorn Andersson, Emilio López, Chen-Yu Tsai, Jernej Skrabec,
	Samuel Holland, Krzysztof Kozlowski, Daniel Lezcano,
	Thomas Gleixner, Florian Fainelli,
	Broadcom internal kernel review list, Linus Walleij,
	Bartosz Golaszewski, Jonathan Cameron, Lee Jones, Shawn Guo,
	Pengutronix Kernel Team, Uwe Kleine-König,
	Greg Kroah-Hartman, Jiri Slaby, Richard Leitner, Liam Girdwood,
	Mark Brown, Michael Ellerman, Nicholas Piggin, Christophe Leroy,
	Naveen N. Rao, Damien Le Moal
  Cc: Peng Fan (OSS), Thomas Petazzoni, linux-kernel, devicetree, llvm,
	linux-clk, linux-omap, linux-arm-msm, linux-arm-kernel,
	linux-sunxi, linux-samsung-soc, linux-gpio, linux-iio, linux-pwm,
	linux-serial, linux-usb, patches, linux-sound, linuxppc-dev,
	linux-riscv

On 03/07/2024 at 12:36, Luca Ceresoli wrote:
> Simplify code using of_property_for_each_u32_new() as the two additional
> parameters in of_property_for_each_u32() are not used here.
> 
> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>

Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>

> ---
>   drivers/irqchip/irq-atmel-aic-common.c | 4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/irqchip/irq-atmel-aic-common.c b/drivers/irqchip/irq-atmel-aic-common.c
> index 072bd227b6c6..543ea249df53 100644
> --- a/drivers/irqchip/irq-atmel-aic-common.c
> +++ b/drivers/irqchip/irq-atmel-aic-common.c
> @@ -111,8 +111,6 @@ static void __init aic_common_ext_irq_of_init(struct irq_domain *domain)
>          struct device_node *node = irq_domain_get_of_node(domain);
>          struct irq_chip_generic *gc;
>          struct aic_chip_data *aic;
> -       struct property *prop;
> -       const __be32 *p;
>          u32 hwirq;
> 
>          gc = irq_get_domain_generic_chip(domain, 0);
> @@ -120,7 +118,7 @@ static void __init aic_common_ext_irq_of_init(struct irq_domain *domain)
>          aic = gc->private;
>          aic->ext_irqs |= 1;
> 
> -       of_property_for_each_u32(node, "atmel,external-irqs", prop, p, hwirq) {
> +       of_property_for_each_u32_new(node, "atmel,external-irqs", hwirq) {
>                  gc = irq_get_domain_generic_chip(domain, hwirq);
>                  if (!gc) {
>                          pr_warn("AIC: external irq %d >= %d skip it\n",
> 
> --
> 2.34.1
> 


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 12/20] iio: adc: ti_am335x_adc: convert to of_property_for_each_u32_new()
  2024-07-03 10:36 ` [PATCH 12/20] iio: adc: ti_am335x_adc: " Luca Ceresoli
@ 2024-07-03 15:34   ` Jonathan Cameron
  0 siblings, 0 replies; 34+ messages in thread
From: Jonathan Cameron @ 2024-07-03 15:34 UTC (permalink / raw)
  To: Luca Ceresoli
  Cc: Miguel Ojeda, Rob Herring, Saravana Kannan, Nathan Chancellor,
	Michael Turquette, Stephen Boyd, Tony Lindgren, Bjorn Andersson,
	Emilio López, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Krzysztof Kozlowski, Daniel Lezcano, Thomas Gleixner,
	Florian Fainelli, Broadcom internal kernel review list,
	Linus Walleij, Bartosz Golaszewski, Jonathan Cameron, Lee Jones,
	Shawn Guo, Pengutronix Kernel Team, Uwe Kleine-König,
	Greg Kroah-Hartman, Jiri Slaby, Richard Leitner, Liam Girdwood,
	Mark Brown, Nicolas Ferre, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Naveen N. Rao, Damien Le Moal, Peng Fan (OSS),
	Thomas Petazzoni, linux-kernel, devicetree, llvm, linux-clk,
	linux-omap, linux-arm-msm, linux-arm-kernel, linux-sunxi,
	linux-samsung-soc, linux-gpio, linux-iio, linux-pwm, linux-serial,
	linux-usb, patches, linux-sound, linuxppc-dev, linux-riscv

On Wed, 03 Jul 2024 12:36:56 +0200
Luca Ceresoli <luca.ceresoli@bootlin.com> wrote:

> Simplify code using of_property_for_each_u32_new() as the two additional
> parameters in of_property_for_each_u32() are not used here.
> 
> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 20/20] of: deprecate and rename of_property_for_each_u32()
  2024-07-03 10:37 ` [PATCH 20/20] of: deprecate and rename of_property_for_each_u32() Luca Ceresoli
@ 2024-07-03 18:01   ` Rob Herring
  2024-07-04 21:33     ` Luca Ceresoli
  0 siblings, 1 reply; 34+ messages in thread
From: Rob Herring @ 2024-07-03 18:01 UTC (permalink / raw)
  To: Luca Ceresoli
  Cc: Miguel Ojeda, Saravana Kannan, Nathan Chancellor,
	Michael Turquette, Stephen Boyd, Tony Lindgren, Bjorn Andersson,
	Emilio López, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Krzysztof Kozlowski, Daniel Lezcano, Thomas Gleixner,
	Florian Fainelli, Broadcom internal kernel review list,
	Linus Walleij, Bartosz Golaszewski, Jonathan Cameron, Lee Jones,
	Shawn Guo, Pengutronix Kernel Team, Uwe Kleine-König,
	Greg Kroah-Hartman, Jiri Slaby, Richard Leitner, Liam Girdwood,
	Mark Brown, Nicolas Ferre, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Naveen N. Rao, Damien Le Moal, Peng Fan (OSS),
	Thomas Petazzoni, linux-kernel, devicetree, llvm, linux-clk,
	linux-omap, linux-arm-msm, linux-arm-kernel, linux-sunxi,
	linux-samsung-soc, linux-gpio, linux-iio, linux-pwm, linux-serial,
	linux-usb, patches, linux-sound, linuxppc-dev, linux-riscv

On Wed, Jul 03, 2024 at 12:37:04PM +0200, Luca Ceresoli wrote:
> 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@bootlin.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

I would do something like this:

	sz = of_property_read_variable_u32_array(np, "silabs,pll-source", array, 2, 4);
	if (sz >= 2)
		pdata->pll_src[array[0]] = val_to_src(array[1]);
	if (sz >= 4)
		pdata->pll_src[array[2]] = val_to_src(array[3]);


>      drivers/clk/clk.c

Wouldn't this work:

8<------------------------------------------------------

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 8cca52be993f..33a8cc193556 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -5371,6 +5371,7 @@ const char *of_clk_get_parent_name(const struct device_node *np, int index)
        int rc;
        int count;
        struct clk *clk;
+       bool found = false;
 
        rc = of_parse_phandle_with_args(np, "clocks", "#clock-cells", index,
                                        &clkspec);
@@ -5383,15 +5384,16 @@ 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_new(clkspec.np, "clock-indices", pv) {
                if (index == pv) {
                        index = count;
+                       found = true;
                        break;
                }
                count++;
        }
        /* We went off the end of 'clock-indices' without finding it */
-       if (prop && !vp)
+       if (of_property_present(clkspec.np, "clock-indices") && !found)
                return NULL;
 
        if (of_property_read_string_index(clkspec.np, "clock-output-names",

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* Re: [PATCH 00/20] Simplify of_property_for_each_u32()
  2024-07-03 10:36 [PATCH 00/20] Simplify of_property_for_each_u32() Luca Ceresoli
                   ` (19 preceding siblings ...)
  2024-07-03 10:37 ` [PATCH 20/20] of: deprecate and rename of_property_for_each_u32() Luca Ceresoli
@ 2024-07-03 18:07 ` Rob Herring
  2024-07-04 21:31   ` Luca Ceresoli
  20 siblings, 1 reply; 34+ messages in thread
From: Rob Herring @ 2024-07-03 18:07 UTC (permalink / raw)
  To: Luca Ceresoli
  Cc: Miguel Ojeda, Saravana Kannan, Nathan Chancellor,
	Michael Turquette, Stephen Boyd, Tony Lindgren, Bjorn Andersson,
	Emilio López, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Krzysztof Kozlowski, Daniel Lezcano, Thomas Gleixner,
	Florian Fainelli, Broadcom internal kernel review list,
	Linus Walleij, Bartosz Golaszewski, Jonathan Cameron, Lee Jones,
	Shawn Guo, Pengutronix Kernel Team, Uwe Kleine-König,
	Greg Kroah-Hartman, Jiri Slaby, Richard Leitner, Liam Girdwood,
	Mark Brown, Nicolas Ferre, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Naveen N. Rao, Damien Le Moal, Peng Fan (OSS),
	Thomas Petazzoni, linux-kernel, devicetree, llvm, linux-clk,
	linux-omap, linux-arm-msm, linux-arm-kernel, linux-sunxi,
	linux-samsung-soc, linux-gpio, linux-iio, linux-pwm, linux-serial,
	linux-usb, patches, linux-sound, linuxppc-dev, linux-riscv

On Wed, Jul 03, 2024 at 12:36:44PM +0200, Luca Ceresoli wrote:
> [Note: to reduce the noise I have trimmed the get_maintainers list
> manually. Should you want to be removed, or someone else added, to future
> versions, just tell me. Sorry for the noise.]
> 
> This series aims at simplifying of_property_for_each_u32() as well as
> making it more difficult to misuse it in the future.
> 
> The long-term goal is changing this pattern:
> 
>   struct property *prop;
>   const __be32 *p;
>   u32 val;
>  
>   of_property_for_each_u32(np, "xyz", prop, p, val) { ... }
> 
> to this:
> 
>   u32 val;
> 
>   of_property_for_each_u32(np, "xyz", val) { ... }
> 
> So, removing the 3rd and 4th arguments which are typically meant to be
> internal. Those two parameters used to be unavoidable until the kernel
> moved to building with the C11 standard unconditionally. Since then, it is
> now possible to get rid of them. However a few users of
> of_property_for_each_u32() do actually use those arguments, which
> complicates the transition. For this reason this series does the following:
> 
>  * Add of_property_for_each_u32_new(), which does not have those two
>    arguments (patch 1)
>  * Convert _almost_ every usage to of_property_for_each_u32_new()
>  * Rename of_property_for_each_u32() to of_property_for_each_u32_old() and
>    deprecate it, as a incentive to code not (yet) in mainline to upgrade
>    to the *_new() version (last patch)

I don't really see the point of introducing the _old variant. Let's get 
this done in one step.

> 
> The plan for the next series is to additionally:
> 
>  * Convert the few remaining of_property_for_each_u32_old() instantes to
>    of_property_for_each_u32_new()
>  * Remove of_property_for_each_u32_old()
>  * Rename of_property_for_each_u32_new() to of_property_for_each_u32()

Honestly, I think there's few enough users we could just convert the 
whole thing in one patch. It's all got to go thru 1 tree anyways. If 
there's new cases in -next, then I'd be happy to send it to Linus at the 
end of the merge window.

Rob

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 13/20] pwm: samsung: convert to of_property_for_each_u32_new()
  2024-07-03 10:36 ` [PATCH 13/20] pwm: samsung: " Luca Ceresoli
@ 2024-07-03 21:23   ` Uwe Kleine-König
  0 siblings, 0 replies; 34+ messages in thread
From: Uwe Kleine-König @ 2024-07-03 21:23 UTC (permalink / raw)
  To: Luca Ceresoli
  Cc: Miguel Ojeda, Rob Herring, Saravana Kannan, Nathan Chancellor,
	Michael Turquette, Stephen Boyd, Tony Lindgren, Bjorn Andersson,
	Emilio López, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Krzysztof Kozlowski, Daniel Lezcano, Thomas Gleixner,
	Florian Fainelli, Broadcom internal kernel review list,
	Linus Walleij, Bartosz Golaszewski, Jonathan Cameron, Lee Jones,
	Shawn Guo, Pengutronix Kernel Team, Greg Kroah-Hartman,
	Jiri Slaby, Richard Leitner, Liam Girdwood, Mark Brown,
	Nicolas Ferre, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Naveen N. Rao, Damien Le Moal, Peng Fan (OSS),
	Thomas Petazzoni, linux-kernel, devicetree, llvm, linux-clk,
	linux-omap, linux-arm-msm, linux-arm-kernel, linux-sunxi,
	linux-samsung-soc, linux-gpio, linux-iio, linux-pwm, linux-serial,
	linux-usb, patches, linux-sound, linuxppc-dev, linux-riscv

[-- Attachment #1: Type: text/plain, Size: 1539 bytes --]

Hello,

On Wed, Jul 03, 2024 at 12:36:57PM +0200, Luca Ceresoli wrote:
> Simplify code using of_property_for_each_u32_new() as the two additional
> parameters in of_property_for_each_u32() are not used here.
> 
> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
> ---
>  drivers/pwm/pwm-samsung.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/pwm/pwm-samsung.c b/drivers/pwm/pwm-samsung.c
> index efb60c9f0cb3..fef02a0b023e 100644
> --- a/drivers/pwm/pwm-samsung.c
> +++ b/drivers/pwm/pwm-samsung.c
> @@ -510,8 +510,6 @@ static int pwm_samsung_parse_dt(struct pwm_chip *chip)
>  	struct samsung_pwm_chip *our_chip = to_samsung_pwm_chip(chip);
>  	struct device_node *np = pwmchip_parent(chip)->of_node;
>  	const struct of_device_id *match;
> -	struct property *prop;
> -	const __be32 *cur;
>  	u32 val;
>  
>  	match = of_match_node(samsung_pwm_matches, np);
> @@ -520,7 +518,7 @@ static int pwm_samsung_parse_dt(struct pwm_chip *chip)
>  
>  	memcpy(&our_chip->variant, match->data, sizeof(our_chip->variant));
>  
> -	of_property_for_each_u32(np, "samsung,pwm-outputs", prop, cur, val) {
> +	of_property_for_each_u32_new(np, "samsung,pwm-outputs", val) {
>  		if (val >= SAMSUNG_PWM_NUM) {
>  			dev_err(pwmchip_parent(chip),
>  				"%s: invalid channel index in samsung,pwm-outputs property\n",
> 

Acked-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>

Feel free to merge this together with the change from the first patch.

Best regards
Uwe

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 00/20] Simplify of_property_for_each_u32()
  2024-07-03 18:07 ` [PATCH 00/20] Simplify of_property_for_each_u32() Rob Herring
@ 2024-07-04 21:31   ` Luca Ceresoli
  0 siblings, 0 replies; 34+ messages in thread
From: Luca Ceresoli @ 2024-07-04 21:31 UTC (permalink / raw)
  To: Rob Herring
  Cc: Miguel Ojeda, Saravana Kannan, Nathan Chancellor,
	Michael Turquette, Stephen Boyd, Tony Lindgren, Bjorn Andersson,
	Emilio López, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Krzysztof Kozlowski, Daniel Lezcano, Thomas Gleixner,
	Florian Fainelli, Broadcom internal kernel review list,
	Linus Walleij, Bartosz Golaszewski, Jonathan Cameron, Lee Jones,
	Shawn Guo, Pengutronix Kernel Team, Uwe Kleine-König,
	Greg Kroah-Hartman, Jiri Slaby, Richard Leitner, Liam Girdwood,
	Mark Brown, Nicolas Ferre, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Naveen N. Rao, Damien Le Moal, Peng Fan (OSS),
	Thomas Petazzoni, linux-kernel, devicetree, llvm, linux-clk,
	linux-omap, linux-arm-msm, linux-arm-kernel, linux-sunxi,
	linux-samsung-soc, linux-gpio, linux-iio, linux-pwm, linux-serial,
	linux-usb, patches, linux-sound, linuxppc-dev, linux-riscv

Hello Rob,

On Wed, 3 Jul 2024 12:07:42 -0600
Rob Herring <robh@kernel.org> wrote:

> On Wed, Jul 03, 2024 at 12:36:44PM +0200, Luca Ceresoli wrote:
> > [Note: to reduce the noise I have trimmed the get_maintainers list
> > manually. Should you want to be removed, or someone else added, to future
> > versions, just tell me. Sorry for the noise.]
> > 
> > This series aims at simplifying of_property_for_each_u32() as well as
> > making it more difficult to misuse it in the future.
> > 
> > The long-term goal is changing this pattern:
> > 
> >   struct property *prop;
> >   const __be32 *p;
> >   u32 val;
> >  
> >   of_property_for_each_u32(np, "xyz", prop, p, val) { ... }
> > 
> > to this:
> > 
> >   u32 val;
> > 
> >   of_property_for_each_u32(np, "xyz", val) { ... }
> > 
> > So, removing the 3rd and 4th arguments which are typically meant to be
> > internal. Those two parameters used to be unavoidable until the kernel
> > moved to building with the C11 standard unconditionally. Since then, it is
> > now possible to get rid of them. However a few users of
> > of_property_for_each_u32() do actually use those arguments, which
> > complicates the transition. For this reason this series does the following:
> > 
> >  * Add of_property_for_each_u32_new(), which does not have those two
> >    arguments (patch 1)
> >  * Convert _almost_ every usage to of_property_for_each_u32_new()
> >  * Rename of_property_for_each_u32() to of_property_for_each_u32_old() and
> >    deprecate it, as a incentive to code not (yet) in mainline to upgrade
> >    to the *_new() version (last patch)  
> 
> I don't really see the point of introducing the _old variant. Let's get 
> this done in one step.
> 
> > 
> > The plan for the next series is to additionally:
> > 
> >  * Convert the few remaining of_property_for_each_u32_old() instantes to
> >    of_property_for_each_u32_new()
> >  * Remove of_property_for_each_u32_old()
> >  * Rename of_property_for_each_u32_new() to of_property_for_each_u32()  
> 
> Honestly, I think there's few enough users we could just convert the 
> whole thing in one patch. It's all got to go thru 1 tree anyways. If 
> there's new cases in -next, then I'd be happy to send it to Linus at the 
> end of the merge window.

Sure, make sense. I'll need to convert the few remaining users, then
I'm sending a squashed v2.

Luca

-- 
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 20/20] of: deprecate and rename of_property_for_each_u32()
  2024-07-03 18:01   ` Rob Herring
@ 2024-07-04 21:33     ` Luca Ceresoli
  0 siblings, 0 replies; 34+ messages in thread
From: Luca Ceresoli @ 2024-07-04 21:33 UTC (permalink / raw)
  To: Rob Herring
  Cc: Miguel Ojeda, Saravana Kannan, Nathan Chancellor,
	Michael Turquette, Stephen Boyd, Tony Lindgren, Bjorn Andersson,
	Emilio López, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Krzysztof Kozlowski, Daniel Lezcano, Thomas Gleixner,
	Florian Fainelli, Broadcom internal kernel review list,
	Linus Walleij, Bartosz Golaszewski, Jonathan Cameron, Lee Jones,
	Shawn Guo, Pengutronix Kernel Team, Uwe Kleine-König,
	Greg Kroah-Hartman, Jiri Slaby, Richard Leitner, Liam Girdwood,
	Mark Brown, Nicolas Ferre, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Naveen N. Rao, Damien Le Moal, Peng Fan (OSS),
	Thomas Petazzoni, linux-kernel, devicetree, llvm, linux-clk,
	linux-omap, linux-arm-msm, linux-arm-kernel, linux-sunxi,
	linux-samsung-soc, linux-gpio, linux-iio, linux-pwm, linux-serial,
	linux-usb, patches, linux-sound, linuxppc-dev, linux-riscv

Hello Rob,

On Wed, 3 Jul 2024 12:01:11 -0600
Rob Herring <robh@kernel.org> wrote:

> On Wed, Jul 03, 2024 at 12:37:04PM +0200, Luca Ceresoli wrote:
> > 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@bootlin.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  
> 
> I would do something like this:

Thanks for the suggestions.

I literally did not even try to look at what the code does in these few
places, and still haven't, simply due to time availability. But I wanted
to get a first series out as soon as possible as it would probably be
useful to Peng [0]. Yours will be a good starting point for when I
tackle those few remaining usages of the "old" macro. Thanks.

[0] https://lore.kernel.org/all/20240628161617.6bc9ca3c@booty/

Luca

-- 
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 15/20] usb: usb251xb: convert to of_property_for_each_u32_new()
  2024-07-03 10:36 ` [PATCH 15/20] usb: usb251xb: " Luca Ceresoli
@ 2024-07-08  7:45   ` Richard Leitner
  0 siblings, 0 replies; 34+ messages in thread
From: Richard Leitner @ 2024-07-08  7:45 UTC (permalink / raw)
  To: Luca Ceresoli
  Cc: Miguel Ojeda, Rob Herring, Saravana Kannan, Nathan Chancellor,
	Michael Turquette, Stephen Boyd, Tony Lindgren, Bjorn Andersson,
	Emilio López, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Krzysztof Kozlowski, Daniel Lezcano, Thomas Gleixner,
	Florian Fainelli, Broadcom internal kernel review list,
	Linus Walleij, Bartosz Golaszewski, Jonathan Cameron, Lee Jones,
	Shawn Guo, Pengutronix Kernel Team, Uwe Kleine-König,
	Greg Kroah-Hartman, Jiri Slaby, Liam Girdwood, Mark Brown,
	Nicolas Ferre, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Naveen N. Rao, Damien Le Moal, Peng Fan (OSS),
	Thomas Petazzoni, linux-kernel, devicetree, llvm, linux-clk,
	linux-omap, linux-arm-msm, linux-arm-kernel, linux-sunxi,
	linux-samsung-soc, linux-gpio, linux-iio, linux-pwm, linux-serial,
	linux-usb, patches, linux-sound, linuxppc-dev, linux-riscv

Hi Luca,

On Wed, Jul 03, 2024 at 12:36:59PM GMT, Luca Ceresoli wrote:
> Simplify code using of_property_for_each_u32_new() as the two additional
> parameters in of_property_for_each_u32() are not used here.
> 
> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>

please feel free to add:

Acked-by: Richard Leitner <richard.leitner@linux.dev>

> ---
>  drivers/usb/misc/usb251xb.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/misc/usb251xb.c b/drivers/usb/misc/usb251xb.c
> index 7da404f55a6d..490004dbb9d8 100644
> --- a/drivers/usb/misc/usb251xb.c
> +++ b/drivers/usb/misc/usb251xb.c
> @@ -382,11 +382,9 @@ static void usb251xb_get_ports_field(struct usb251xb *hub,
>  				    bool ds_only, u8 *fld)
>  {
>  	struct device *dev = hub->dev;
> -	struct property *prop;
> -	const __be32 *p;
>  	u32 port;
>  
> -	of_property_for_each_u32(dev->of_node, prop_name, prop, p, port) {
> +	of_property_for_each_u32_new(dev->of_node, prop_name, port) {
>  		if ((port >= ds_only ? 1 : 0) && (port <= port_cnt))
>  			*fld |= BIT(port);
>  		else
> 
> -- 
> 2.34.1


^ permalink raw reply	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2024-07-08  7:45 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-03 10:36 [PATCH 00/20] Simplify of_property_for_each_u32() Luca Ceresoli
2024-07-03 10:36 ` [PATCH 01/20] of: add of_property_for_each_u32_new() Luca Ceresoli
2024-07-03 10:36 ` [PATCH 02/20] clk: convert to of_property_for_each_u32_new() Luca Ceresoli
2024-07-03 10:36 ` [PATCH 03/20] clk: qcom: " Luca Ceresoli
2024-07-03 10:36 ` [PATCH 04/20] clk: sunxi: clk-simple-gates: " Luca Ceresoli
2024-07-03 12:21   ` Andre Przywara
2024-07-03 10:36 ` [PATCH 05/20] clk: sunxi: clk-sun8i-bus-gates: " Luca Ceresoli
2024-07-03 12:19   ` Andre Przywara
2024-07-03 10:36 ` [PATCH 06/20] clocksource/drivers/samsung_pwm: " Luca Ceresoli
2024-07-03 10:36 ` [PATCH 07/20] bus: ti-sysc: " Luca Ceresoli
2024-07-03 10:36 ` [PATCH 08/20] lk: clk-conf: " Luca Ceresoli
2024-07-03 10:36 ` [PATCH 09/20] gpio: brcmstb: " Luca Ceresoli
2024-07-03 11:33   ` Bartosz Golaszewski
2024-07-03 10:36 ` [PATCH 10/20] pinctrl: s32cc: " Luca Ceresoli
2024-07-03 10:36 ` [PATCH 11/20] irqchip/atmel-aic: " Luca Ceresoli
2024-07-03 13:09   ` Nicolas Ferre
2024-07-03 10:36 ` [PATCH 12/20] iio: adc: ti_am335x_adc: " Luca Ceresoli
2024-07-03 15:34   ` Jonathan Cameron
2024-07-03 10:36 ` [PATCH 13/20] pwm: samsung: " Luca Ceresoli
2024-07-03 21:23   ` Uwe Kleine-König
2024-07-03 10:36 ` [PATCH 14/20] tty: sysrq: " Luca Ceresoli
2024-07-03 10:36 ` [PATCH 15/20] usb: usb251xb: " Luca Ceresoli
2024-07-08  7:45   ` Richard Leitner
2024-07-03 10:37 ` [PATCH 16/20] mfd: ti_am335x_tscadc: " Luca Ceresoli
2024-07-03 10:37 ` [PATCH 17/20] ASoC: arizona: " Luca Ceresoli
2024-07-03 11:31   ` Richard Fitzgerald
2024-07-03 12:18   ` Mark Brown
2024-07-03 10:37 ` [PATCH 18/20] powerpc/xive: " Luca Ceresoli
2024-07-03 10:37 ` [PATCH 19/20] " Luca Ceresoli
2024-07-03 10:37 ` [PATCH 20/20] of: deprecate and rename of_property_for_each_u32() Luca Ceresoli
2024-07-03 18:01   ` Rob Herring
2024-07-04 21:33     ` Luca Ceresoli
2024-07-03 18:07 ` [PATCH 00/20] Simplify of_property_for_each_u32() Rob Herring
2024-07-04 21:31   ` Luca Ceresoli

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).