[PATCH 20/20] of: deprecate and rename of_property_for_each_u32()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx>

---

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





[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux