Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'devicetree-fixes-for-6.11-1' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux

Pull more devicetree updates from Rob Herring:
"Most of this is a treewide change to of_property_for_each_u32() which
was small enough to do in one go before rc1 and avoids the need to
create of_property_for_each_u32_some_new_name().

- Treewide conversion of of_property_for_each_u32() to drop internal
arguments making struct property opaque

- Add binding for Amlogic A4 SoC watchdog

- Fix constraints for AD7192 'single-channel' property"

* tag 'devicetree-fixes-for-6.11-1' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux:
dt-bindings: iio: adc: ad7192: Fix 'single-channel' constraints
of: remove internal arguments from of_property_for_each_u32()
dt-bindings: watchdog: add support for Amlogic A4 SoCs

+64 -96
+2 -3
Documentation/devicetree/bindings/iio/adc/adi,ad7192.yaml
··· 120 120 description: 121 121 Positive input can be connected to pins AIN1 to AIN16 by choosing the 122 122 appropriate value from 1 to 16. Negative input is connected to AINCOM. 123 - items: 124 - minimum: 1 125 - maximum: 16 123 + minimum: 1 124 + maximum: 16 126 125 127 126 oneOf: 128 127 - required:
+1
Documentation/devicetree/bindings/watchdog/amlogic,meson-gxbb-wdt.yaml
··· 21 21 - amlogic,t7-wdt 22 22 - items: 23 23 - enum: 24 + - amlogic,a4-wdt 24 25 - amlogic,c3-wdt 25 26 - amlogic,s4-wdt 26 27 - const: amlogic,t7-wdt
+1 -3
arch/powerpc/sysdev/xive/native.c
··· 559 559 struct device_node *np; 560 560 struct resource r; 561 561 void __iomem *tima; 562 - struct property *prop; 563 562 u8 max_prio = 7; 564 - const __be32 *p; 565 563 u32 val, cpu; 566 564 s64 rc; 567 565 ··· 590 592 max_prio = val - 1; 591 593 592 594 /* Iterate the EQ sizes and pick one */ 593 - of_property_for_each_u32(np, "ibm,xive-eq-sizes", prop, p, val) { 595 + of_property_for_each_u32(np, "ibm,xive-eq-sizes", val) { 594 596 xive_queue_shift = val; 595 597 if (val == PAGE_SHIFT) 596 598 break;
+1 -2
arch/powerpc/sysdev/xive/spapr.c
··· 814 814 struct device_node *np; 815 815 struct resource r; 816 816 void __iomem *tima; 817 - struct property *prop; 818 817 u8 max_prio; 819 818 u32 val; 820 819 u32 len; ··· 865 866 } 866 867 867 868 /* Iterate the EQ sizes and pick one */ 868 - of_property_for_each_u32(np, "ibm,xive-eq-sizes", prop, reg, val) { 869 + of_property_for_each_u32(np, "ibm,xive-eq-sizes", val) { 869 870 xive_queue_shift = val; 870 871 if (val == PAGE_SHIFT) 871 872 break;
+1 -3
drivers/bus/ti-sysc.c
··· 2291 2291 const char *name) 2292 2292 { 2293 2293 struct device_node *np = ddata->dev->of_node; 2294 - struct property *prop; 2295 - const __be32 *p; 2296 2294 u32 val; 2297 2295 2298 - of_property_for_each_u32(np, name, prop, p, val) { 2296 + of_property_for_each_u32(np, name, val) { 2299 2297 if (val >= SYSC_NR_IDLEMODES) { 2300 2298 dev_err(ddata->dev, "invalid idlemode: %i\n", val); 2301 2299 return -EINVAL;
+1 -3
drivers/clk/clk-conf.c
··· 81 81 static int __set_clk_rates(struct device_node *node, bool clk_supplier) 82 82 { 83 83 struct of_phandle_args clkspec; 84 - struct property *prop; 85 - const __be32 *cur; 86 84 int rc, index = 0; 87 85 struct clk *clk; 88 86 u32 rate; 89 87 90 - of_property_for_each_u32(node, "assigned-clock-rates", prop, cur, rate) { 88 + of_property_for_each_u32(node, "assigned-clock-rates", rate) { 91 89 if (rate) { 92 90 rc = of_parse_phandle_with_args(node, "assigned-clocks", 93 91 "#clock-cells", index, &clkspec);
+26 -17
drivers/clk/clk-si5351.c
··· 1175 1175 { 1176 1176 struct device_node *child, *np = client->dev.of_node; 1177 1177 struct si5351_platform_data *pdata; 1178 - struct property *prop; 1179 - const __be32 *p; 1178 + u32 array[4]; 1179 + int sz, i; 1180 1180 int num = 0; 1181 1181 u32 val; 1182 1182 ··· 1191 1191 * property silabs,pll-source : <num src>, [<..>] 1192 1192 * allow to selectively set pll source 1193 1193 */ 1194 - of_property_for_each_u32(np, "silabs,pll-source", prop, p, num) { 1194 + sz = of_property_read_variable_u32_array(np, "silabs,pll-source", array, 2, 4); 1195 + sz = (sz == -EINVAL) ? 0 : sz; /* Missing property is OK */ 1196 + if (sz < 0) 1197 + return dev_err_probe(&client->dev, sz, "invalid pll-source\n"); 1198 + if (sz % 2) 1199 + return dev_err_probe(&client->dev, -EINVAL, 1200 + "missing pll-source for pll %d\n", array[sz - 1]); 1201 + 1202 + for (i = 0; i < sz; i += 2) { 1203 + num = array[i]; 1204 + val = array[i + 1]; 1205 + 1195 1206 if (num >= 2) { 1196 1207 dev_err(&client->dev, 1197 1208 "invalid pll %d on pll-source prop\n", num); 1198 - return -EINVAL; 1199 - } 1200 - 1201 - p = of_prop_next_u32(prop, p, &val); 1202 - if (!p) { 1203 - dev_err(&client->dev, 1204 - "missing pll-source for pll %d\n", num); 1205 1209 return -EINVAL; 1206 1210 } 1207 1211 ··· 1236 1232 pdata->pll_reset[0] = true; 1237 1233 pdata->pll_reset[1] = true; 1238 1234 1239 - of_property_for_each_u32(np, "silabs,pll-reset-mode", prop, p, num) { 1235 + sz = of_property_read_variable_u32_array(np, "silabs,pll-reset-mode", array, 2, 4); 1236 + sz = (sz == -EINVAL) ? 0 : sz; /* Missing property is OK */ 1237 + if (sz < 0) 1238 + return dev_err_probe(&client->dev, sz, "invalid pll-reset-mode\n"); 1239 + if (sz % 2) 1240 + return dev_err_probe(&client->dev, -EINVAL, 1241 + "missing pll-reset-mode for pll %d\n", array[sz - 1]); 1242 + 1243 + for (i = 0; i < sz; i += 2) { 1244 + num = array[i]; 1245 + val = array[i + 1]; 1246 + 1240 1247 if (num >= 2) { 1241 1248 dev_err(&client->dev, 1242 1249 "invalid pll %d on pll-reset-mode prop\n", num); 1243 1250 return -EINVAL; 1244 1251 } 1245 1252 1246 - p = of_prop_next_u32(prop, p, &val); 1247 - if (!p) { 1248 - dev_err(&client->dev, 1249 - "missing pll-reset-mode for pll %d\n", num); 1250 - return -EINVAL; 1251 - } 1252 1253 1253 1254 switch (val) { 1254 1255 case 0:
+5 -7
drivers/clk/clk.c
··· 5364 5364 const char *of_clk_get_parent_name(const struct device_node *np, int index) 5365 5365 { 5366 5366 struct of_phandle_args clkspec; 5367 - struct property *prop; 5368 5367 const char *clk_name; 5369 - const __be32 *vp; 5368 + bool found = false; 5370 5369 u32 pv; 5371 5370 int rc; 5372 5371 int count; ··· 5382 5383 /* if there is an indices property, use it to transfer the index 5383 5384 * specified into an array offset for the clock-output-names property. 5384 5385 */ 5385 - of_property_for_each_u32(clkspec.np, "clock-indices", prop, vp, pv) { 5386 + of_property_for_each_u32(clkspec.np, "clock-indices", pv) { 5386 5387 if (index == pv) { 5387 5388 index = count; 5389 + found = true; 5388 5390 break; 5389 5391 } 5390 5392 count++; 5391 5393 } 5392 5394 /* We went off the end of 'clock-indices' without finding it */ 5393 - if (prop && !vp) 5395 + if (of_property_present(clkspec.np, "clock-indices") && !found) 5394 5396 return NULL; 5395 5397 5396 5398 if (of_property_read_string_index(clkspec.np, "clock-output-names", ··· 5504 5504 int of_clk_detect_critical(struct device_node *np, int index, 5505 5505 unsigned long *flags) 5506 5506 { 5507 - struct property *prop; 5508 - const __be32 *cur; 5509 5507 uint32_t idx; 5510 5508 5511 5509 if (!np || !flags) 5512 5510 return -EINVAL; 5513 5511 5514 - of_property_for_each_u32(np, "clock-critical", prop, cur, idx) 5512 + of_property_for_each_u32(np, "clock-critical", idx) 5515 5513 if (index == idx) 5516 5514 *flags |= CLK_IS_CRITICAL; 5517 5515
+1 -3
drivers/clk/qcom/common.c
··· 227 227 static void qcom_cc_drop_protected(struct device *dev, struct qcom_cc *cc) 228 228 { 229 229 struct device_node *np = dev->of_node; 230 - struct property *prop; 231 - const __be32 *p; 232 230 u32 i; 233 231 234 - of_property_for_each_u32(np, "protected-clocks", prop, p, i) { 232 + of_property_for_each_u32(np, "protected-clocks", i) { 235 233 if (i >= cc->num_rclks) 236 234 continue; 237 235
+1 -3
drivers/clk/sunxi/clk-simple-gates.c
··· 21 21 { 22 22 struct clk_onecell_data *clk_data; 23 23 const char *clk_parent, *clk_name; 24 - struct property *prop; 25 24 struct resource res; 26 25 void __iomem *clk_reg; 27 26 void __iomem *reg; 28 - const __be32 *p; 29 27 int number, i = 0, j; 30 28 u8 clk_bit; 31 29 u32 index; ··· 45 47 if (!clk_data->clks) 46 48 goto err_free_data; 47 49 48 - of_property_for_each_u32(node, "clock-indices", prop, p, index) { 50 + of_property_for_each_u32(node, "clock-indices", index) { 49 51 of_property_read_string_index(node, "clock-output-names", 50 52 i, &clk_name); 51 53
+1 -3
drivers/clk/sunxi/clk-sun8i-bus-gates.c
··· 24 24 const char *parents[PARENT_MAX]; 25 25 struct clk_onecell_data *clk_data; 26 26 const char *clk_name; 27 - struct property *prop; 28 27 struct resource res; 29 28 void __iomem *clk_reg; 30 29 void __iomem *reg; 31 - const __be32 *p; 32 30 int number, i; 33 31 u8 clk_bit; 34 32 int index; ··· 56 58 goto err_free_data; 57 59 58 60 i = 0; 59 - of_property_for_each_u32(node, "clock-indices", prop, p, index) { 61 + of_property_for_each_u32(node, "clock-indices", index) { 60 62 of_property_read_string_index(node, "clock-output-names", 61 63 i, &clk_name); 62 64
+1 -3
drivers/clocksource/samsung_pwm_timer.c
··· 418 418 static int __init samsung_pwm_alloc(struct device_node *np, 419 419 const struct samsung_pwm_variant *variant) 420 420 { 421 - struct property *prop; 422 - const __be32 *cur; 423 421 u32 val; 424 422 int i, ret; 425 423 ··· 425 427 for (i = 0; i < SAMSUNG_PWM_NUM; ++i) 426 428 pwm.irq[i] = irq_of_parse_and_map(np, i); 427 429 428 - of_property_for_each_u32(np, "samsung,pwm-outputs", prop, cur, val) { 430 + of_property_for_each_u32(np, "samsung,pwm-outputs", val) { 429 431 if (val >= SAMSUNG_PWM_NUM) { 430 432 pr_warn("%s: invalid channel index in samsung,pwm-outputs property\n", __func__); 431 433 continue;
+1 -4
drivers/gpio/gpio-brcmstb.c
··· 591 591 void __iomem *reg_base; 592 592 struct brcmstb_gpio_priv *priv; 593 593 struct resource *res; 594 - struct property *prop; 595 - const __be32 *p; 596 594 u32 bank_width; 597 595 int num_banks = 0; 598 596 int num_gpios = 0; ··· 634 636 flags = BGPIOF_BIG_ENDIAN_BYTE_ORDER; 635 637 #endif 636 638 637 - of_property_for_each_u32(np, "brcm,gpio-bank-widths", prop, p, 638 - bank_width) { 639 + of_property_for_each_u32(np, "brcm,gpio-bank-widths", bank_width) { 639 640 struct brcmstb_gpio_bank *bank; 640 641 struct gpio_chip *gc; 641 642
+1 -3
drivers/iio/adc/ti_am335x_adc.c
··· 564 564 struct tiadc_device *adc_dev) 565 565 { 566 566 struct device_node *node = pdev->dev.of_node; 567 - struct property *prop; 568 - const __be32 *cur; 569 567 int channels = 0; 570 568 u32 val; 571 569 int i; 572 570 573 - of_property_for_each_u32(node, "ti,adc-channels", prop, cur, val) { 571 + of_property_for_each_u32(node, "ti,adc-channels", val) { 574 572 adc_dev->channel_line[channels] = val; 575 573 576 574 /* Set Default values for optional DT parameters */
+1 -3
drivers/irqchip/irq-atmel-aic-common.c
··· 111 111 struct device_node *node = irq_domain_get_of_node(domain); 112 112 struct irq_chip_generic *gc; 113 113 struct aic_chip_data *aic; 114 - struct property *prop; 115 - const __be32 *p; 116 114 u32 hwirq; 117 115 118 116 gc = irq_get_domain_generic_chip(domain, 0); ··· 118 120 aic = gc->private; 119 121 aic->ext_irqs |= 1; 120 122 121 - of_property_for_each_u32(node, "atmel,external-irqs", prop, p, hwirq) { 123 + of_property_for_each_u32(node, "atmel,external-irqs", hwirq) { 122 124 gc = irq_get_domain_generic_chip(domain, hwirq); 123 125 if (!gc) { 124 126 pr_warn("AIC: external irq %d >= %d skip it\n",
+1 -3
drivers/irqchip/irq-pic32-evic.c
··· 190 190 { 191 191 struct device_node *node = irq_domain_get_of_node(domain); 192 192 struct evic_chip_data *priv = domain->host_data; 193 - struct property *prop; 194 - const __le32 *p; 195 193 u32 hwirq; 196 194 int i = 0; 197 195 const char *pname = "microchip,external-irqs"; 198 196 199 - of_property_for_each_u32(node, pname, prop, p, hwirq) { 197 + of_property_for_each_u32(node, pname, hwirq) { 200 198 if (i >= ARRAY_SIZE(priv->ext_irqs)) { 201 199 pr_warn("More than %d external irq, skip rest\n", 202 200 ARRAY_SIZE(priv->ext_irqs));
+1 -3
drivers/mfd/ti_am335x_tscadc.c
··· 119 119 struct clk *clk; 120 120 struct device_node *node; 121 121 struct mfd_cell *cell; 122 - struct property *prop; 123 - const __be32 *cur; 124 122 bool use_tsc = false, use_mag = false; 125 123 u32 val; 126 124 int err; ··· 165 167 } 166 168 167 169 node = of_get_child_by_name(pdev->dev.of_node, "adc"); 168 - of_property_for_each_u32(node, "ti,adc-channels", prop, cur, val) { 170 + of_property_for_each_u32(node, "ti,adc-channels", val) { 169 171 adc_channels++; 170 172 if (val > 7) { 171 173 dev_err(&pdev->dev, " PIN numbers are 0..7 (not %d)\n",
+1 -3
drivers/pinctrl/nxp/pinctrl-s32cc.c
··· 730 730 struct s32_pin_group *grp, 731 731 struct s32_pinctrl_soc_info *info) 732 732 { 733 - const __be32 *p; 734 733 struct device *dev; 735 - struct property *prop; 736 734 unsigned int *pins, *sss; 737 735 int i, npins; 738 736 u32 pinmux; ··· 761 763 return -ENOMEM; 762 764 763 765 i = 0; 764 - of_property_for_each_u32(np, "pinmux", prop, p, pinmux) { 766 + of_property_for_each_u32(np, "pinmux", pinmux) { 765 767 pins[i] = get_pin_no(pinmux); 766 768 sss[i] = get_pin_func(pinmux); 767 769
+1 -3
drivers/pinctrl/pinctrl-k210.c
··· 763 763 unsigned int *reserved_maps, 764 764 unsigned int *num_maps) 765 765 { 766 - struct property *prop; 767 - const __be32 *p; 768 766 int ret, pinmux_groups; 769 767 u32 pinmux_group; 770 768 unsigned long *configs = NULL; ··· 795 797 if (ret < 0) 796 798 goto exit; 797 799 798 - of_property_for_each_u32(np, "pinmux", prop, p, pinmux_group) { 800 + of_property_for_each_u32(np, "pinmux", pinmux_group) { 799 801 const char *group_name, *func_name; 800 802 u32 pin = FIELD_GET(K210_PG_PIN, pinmux_group); 801 803 u32 func = FIELD_GET(K210_PG_FUNC, pinmux_group);
+1 -3
drivers/pwm/pwm-samsung.c
··· 510 510 struct samsung_pwm_chip *our_chip = to_samsung_pwm_chip(chip); 511 511 struct device_node *np = pwmchip_parent(chip)->of_node; 512 512 const struct of_device_id *match; 513 - struct property *prop; 514 - const __be32 *cur; 515 513 u32 val; 516 514 517 515 match = of_match_node(samsung_pwm_matches, np); ··· 518 520 519 521 memcpy(&our_chip->variant, match->data, sizeof(our_chip->variant)); 520 522 521 - of_property_for_each_u32(np, "samsung,pwm-outputs", prop, cur, val) { 523 + of_property_for_each_u32(np, "samsung,pwm-outputs", val) { 522 524 if (val >= SAMSUNG_PWM_NUM) { 523 525 dev_err(pwmchip_parent(chip), 524 526 "%s: invalid channel index in samsung,pwm-outputs property\n",
+1 -3
drivers/tty/sysrq.c
··· 770 770 { 771 771 u32 key; 772 772 struct device_node *np; 773 - struct property *prop; 774 - const __be32 *p; 775 773 776 774 np = of_find_node_by_path("/chosen/linux,sysrq-reset-seq"); 777 775 if (!np) { ··· 780 782 /* Reset in case a __weak definition was present */ 781 783 sysrq_reset_seq_len = 0; 782 784 783 - of_property_for_each_u32(np, "keyset", prop, p, key) { 785 + of_property_for_each_u32(np, "keyset", key) { 784 786 if (key == KEY_RESERVED || key > KEY_MAX || 785 787 sysrq_reset_seq_len == SYSRQ_KEY_RESET_MAX) 786 788 break;
+1 -3
drivers/usb/misc/usb251xb.c
··· 382 382 bool ds_only, u8 *fld) 383 383 { 384 384 struct device *dev = hub->dev; 385 - struct property *prop; 386 - const __be32 *p; 387 385 u32 port; 388 386 389 - of_property_for_each_u32(dev->of_node, prop_name, prop, p, port) { 387 + of_property_for_each_u32(dev->of_node, prop_name, port) { 390 388 if ((port >= ds_only ? 1 : 0) && (port <= port_cnt)) 391 389 *fld |= BIT(port); 392 390 else
+7 -8
include/linux/of.h
··· 430 430 #define of_match_ptr(_ptr) (_ptr) 431 431 432 432 /* 433 - * struct property *prop; 434 - * const __be32 *p; 435 433 * u32 u; 436 434 * 437 - * of_property_for_each_u32(np, "propname", prop, p, u) 435 + * of_property_for_each_u32(np, "propname", u) 438 436 * printk("U32 value: %x\n", u); 439 437 */ 440 438 const __be32 *of_prop_next_u32(struct property *prop, const __be32 *cur, ··· 1429 1431 err == 0; \ 1430 1432 err = of_phandle_iterator_next(it)) 1431 1433 1432 - #define of_property_for_each_u32(np, propname, prop, p, u) \ 1433 - for (prop = of_find_property(np, propname, NULL), \ 1434 - p = of_prop_next_u32(prop, NULL, &u); \ 1435 - p; \ 1436 - p = of_prop_next_u32(prop, p, &u)) 1434 + #define of_property_for_each_u32(np, propname, u) \ 1435 + for (struct {struct property *prop; const __be32 *item; } _it = \ 1436 + {of_find_property(np, propname, NULL), \ 1437 + of_prop_next_u32(_it.prop, NULL, &u)}; \ 1438 + _it.item; \ 1439 + _it.item = of_prop_next_u32(_it.prop, _it.item, &u)) 1437 1440 1438 1441 #define of_property_for_each_string(np, propname, prop, s) \ 1439 1442 for (prop = of_find_property(np, propname, NULL), \
+5 -7
sound/soc/codecs/arizona.c
··· 2786 2786 { 2787 2787 struct arizona_pdata *pdata = &arizona->pdata; 2788 2788 struct device_node *np = arizona->dev->of_node; 2789 - struct property *prop; 2790 - const __be32 *cur; 2791 2789 u32 val; 2792 2790 u32 pdm_val[ARIZONA_MAX_PDM_SPK]; 2793 2791 int ret; 2794 2792 int count = 0; 2795 2793 2796 2794 count = 0; 2797 - of_property_for_each_u32(np, "wlf,inmode", prop, cur, val) { 2795 + of_property_for_each_u32(np, "wlf,inmode", val) { 2798 2796 if (count == ARRAY_SIZE(pdata->inmode)) 2799 2797 break; 2800 2798 ··· 2801 2803 } 2802 2804 2803 2805 count = 0; 2804 - of_property_for_each_u32(np, "wlf,dmic-ref", prop, cur, val) { 2806 + of_property_for_each_u32(np, "wlf,dmic-ref", val) { 2805 2807 if (count == ARRAY_SIZE(pdata->dmic_ref)) 2806 2808 break; 2807 2809 ··· 2810 2812 } 2811 2813 2812 2814 count = 0; 2813 - of_property_for_each_u32(np, "wlf,out-mono", prop, cur, val) { 2815 + of_property_for_each_u32(np, "wlf,out-mono", val) { 2814 2816 if (count == ARRAY_SIZE(pdata->out_mono)) 2815 2817 break; 2816 2818 ··· 2819 2821 } 2820 2822 2821 2823 count = 0; 2822 - of_property_for_each_u32(np, "wlf,max-channels-clocked", prop, cur, val) { 2824 + of_property_for_each_u32(np, "wlf,max-channels-clocked", val) { 2823 2825 if (count == ARRAY_SIZE(pdata->max_channels_clocked)) 2824 2826 break; 2825 2827 ··· 2828 2830 } 2829 2831 2830 2832 count = 0; 2831 - of_property_for_each_u32(np, "wlf,out-volume-limit", prop, cur, val) { 2833 + of_property_for_each_u32(np, "wlf,out-volume-limit", val) { 2832 2834 if (count == ARRAY_SIZE(pdata->out_vol_limit)) 2833 2835 break; 2834 2836