Skip to content

Commit bf80f13

Browse files
committed
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
2 parents b465ed2 + 6dc5526 commit bf80f13

File tree

24 files changed

+64
-96
lines changed

24 files changed

+64
-96
lines changed

Documentation/devicetree/bindings/iio/adc/adi,ad7192.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,8 @@ patternProperties:
120120
description:
121121
Positive input can be connected to pins AIN1 to AIN16 by choosing the
122122
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
126125

127126
oneOf:
128127
- required:

Documentation/devicetree/bindings/watchdog/amlogic,meson-gxbb-wdt.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ properties:
2121
- amlogic,t7-wdt
2222
- items:
2323
- enum:
24+
- amlogic,a4-wdt
2425
- amlogic,c3-wdt
2526
- amlogic,s4-wdt
2627
- const: amlogic,t7-wdt

arch/powerpc/sysdev/xive/native.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -559,9 +559,7 @@ bool __init xive_native_init(void)
559559
struct device_node *np;
560560
struct resource r;
561561
void __iomem *tima;
562-
struct property *prop;
563562
u8 max_prio = 7;
564-
const __be32 *p;
565563
u32 val, cpu;
566564
s64 rc;
567565

@@ -592,7 +590,7 @@ bool __init xive_native_init(void)
592590
max_prio = val - 1;
593591

594592
/* Iterate the EQ sizes and pick one */
595-
of_property_for_each_u32(np, "ibm,xive-eq-sizes", prop, p, val) {
593+
of_property_for_each_u32(np, "ibm,xive-eq-sizes", val) {
596594
xive_queue_shift = val;
597595
if (val == PAGE_SHIFT)
598596
break;

arch/powerpc/sysdev/xive/spapr.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,6 @@ bool __init xive_spapr_init(void)
814814
struct device_node *np;
815815
struct resource r;
816816
void __iomem *tima;
817-
struct property *prop;
818817
u8 max_prio;
819818
u32 val;
820819
u32 len;
@@ -866,7 +865,7 @@ bool __init xive_spapr_init(void)
866865
}
867866

868867
/* Iterate the EQ sizes and pick one */
869-
of_property_for_each_u32(np, "ibm,xive-eq-sizes", prop, reg, val) {
868+
of_property_for_each_u32(np, "ibm,xive-eq-sizes", val) {
870869
xive_queue_shift = val;
871870
if (val == PAGE_SHIFT)
872871
break;

drivers/bus/ti-sysc.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2291,11 +2291,9 @@ static int sysc_init_idlemode(struct sysc *ddata, u8 *idlemodes,
22912291
const char *name)
22922292
{
22932293
struct device_node *np = ddata->dev->of_node;
2294-
struct property *prop;
2295-
const __be32 *p;
22962294
u32 val;
22972295

2298-
of_property_for_each_u32(np, name, prop, p, val) {
2296+
of_property_for_each_u32(np, name, val) {
22992297
if (val >= SYSC_NR_IDLEMODES) {
23002298
dev_err(ddata->dev, "invalid idlemode: %i\n", val);
23012299
return -EINVAL;

drivers/clk/clk-conf.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,11 @@ static int __set_clk_parents(struct device_node *node, bool clk_supplier)
8181
static int __set_clk_rates(struct device_node *node, bool clk_supplier)
8282
{
8383
struct of_phandle_args clkspec;
84-
struct property *prop;
85-
const __be32 *cur;
8684
int rc, index = 0;
8785
struct clk *clk;
8886
u32 rate;
8987

90-
of_property_for_each_u32(node, "assigned-clock-rates", prop, cur, rate) {
88+
of_property_for_each_u32(node, "assigned-clock-rates", rate) {
9189
if (rate) {
9290
rc = of_parse_phandle_with_args(node, "assigned-clocks",
9391
"#clock-cells", index, &clkspec);

drivers/clk/clk-si5351.c

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,8 +1175,8 @@ static int si5351_dt_parse(struct i2c_client *client,
11751175
{
11761176
struct device_node *child, *np = client->dev.of_node;
11771177
struct si5351_platform_data *pdata;
1178-
struct property *prop;
1179-
const __be32 *p;
1178+
u32 array[4];
1179+
int sz, i;
11801180
int num = 0;
11811181
u32 val;
11821182

@@ -1191,20 +1191,24 @@ static int si5351_dt_parse(struct i2c_client *client,
11911191
* property silabs,pll-source : <num src>, [<..>]
11921192
* allow to selectively set pll source
11931193
*/
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+
11951206
if (num >= 2) {
11961207
dev_err(&client->dev,
11971208
"invalid pll %d on pll-source prop\n", num);
11981209
return -EINVAL;
11991210
}
12001211

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-
return -EINVAL;
1206-
}
1207-
12081212
switch (val) {
12091213
case 0:
12101214
pdata->pll_src[num] = SI5351_PLL_SRC_XTAL;
@@ -1232,19 +1236,24 @@ static int si5351_dt_parse(struct i2c_client *client,
12321236
pdata->pll_reset[0] = true;
12331237
pdata->pll_reset[1] = true;
12341238

1235-
of_property_for_each_u32(np, "silabs,pll-reset-mode", prop, p, num) {
1239+
sz = of_property_read_variable_u32_array(np, "silabs,pll-reset-mode", array, 2, 4);
1240+
sz = (sz == -EINVAL) ? 0 : sz; /* Missing property is OK */
1241+
if (sz < 0)
1242+
return dev_err_probe(&client->dev, sz, "invalid pll-reset-mode\n");
1243+
if (sz % 2)
1244+
return dev_err_probe(&client->dev, -EINVAL,
1245+
"missing pll-reset-mode for pll %d\n", array[sz - 1]);
1246+
1247+
for (i = 0; i < sz; i += 2) {
1248+
num = array[i];
1249+
val = array[i + 1];
1250+
12361251
if (num >= 2) {
12371252
dev_err(&client->dev,
12381253
"invalid pll %d on pll-reset-mode prop\n", num);
12391254
return -EINVAL;
12401255
}
12411256

1242-
p = of_prop_next_u32(prop, p, &val);
1243-
if (!p) {
1244-
dev_err(&client->dev,
1245-
"missing pll-reset-mode for pll %d\n", num);
1246-
return -EINVAL;
1247-
}
12481257

12491258
switch (val) {
12501259
case 0:

drivers/clk/clk.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5364,9 +5364,8 @@ EXPORT_SYMBOL_GPL(of_clk_get_parent_count);
53645364
const char *of_clk_get_parent_name(const struct device_node *np, int index)
53655365
{
53665366
struct of_phandle_args clkspec;
5367-
struct property *prop;
53685367
const char *clk_name;
5369-
const __be32 *vp;
5368+
bool found = false;
53705369
u32 pv;
53715370
int rc;
53725371
int count;
@@ -5383,15 +5382,16 @@ const char *of_clk_get_parent_name(const struct device_node *np, int index)
53835382
/* if there is an indices property, use it to transfer the index
53845383
* specified into an array offset for the clock-output-names property.
53855384
*/
5386-
of_property_for_each_u32(clkspec.np, "clock-indices", prop, vp, pv) {
5385+
of_property_for_each_u32(clkspec.np, "clock-indices", pv) {
53875386
if (index == pv) {
53885387
index = count;
5388+
found = true;
53895389
break;
53905390
}
53915391
count++;
53925392
}
53935393
/* We went off the end of 'clock-indices' without finding it */
5394-
if (prop && !vp)
5394+
if (of_property_present(clkspec.np, "clock-indices") && !found)
53955395
return NULL;
53965396

53975397
if (of_property_read_string_index(clkspec.np, "clock-output-names",
@@ -5504,14 +5504,12 @@ static int parent_ready(struct device_node *np)
55045504
int of_clk_detect_critical(struct device_node *np, int index,
55055505
unsigned long *flags)
55065506
{
5507-
struct property *prop;
5508-
const __be32 *cur;
55095507
uint32_t idx;
55105508

55115509
if (!np || !flags)
55125510
return -EINVAL;
55135511

5514-
of_property_for_each_u32(np, "clock-critical", prop, cur, idx)
5512+
of_property_for_each_u32(np, "clock-critical", idx)
55155513
if (index == idx)
55165514
*flags |= CLK_IS_CRITICAL;
55175515

drivers/clk/qcom/common.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,11 +227,9 @@ EXPORT_SYMBOL_GPL(qcom_cc_register_sleep_clk);
227227
static void qcom_cc_drop_protected(struct device *dev, struct qcom_cc *cc)
228228
{
229229
struct device_node *np = dev->of_node;
230-
struct property *prop;
231-
const __be32 *p;
232230
u32 i;
233231

234-
of_property_for_each_u32(np, "protected-clocks", prop, p, i) {
232+
of_property_for_each_u32(np, "protected-clocks", i) {
235233
if (i >= cc->num_rclks)
236234
continue;
237235

drivers/clk/sunxi/clk-simple-gates.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,9 @@ static void __init sunxi_simple_gates_setup(struct device_node *node,
2121
{
2222
struct clk_onecell_data *clk_data;
2323
const char *clk_parent, *clk_name;
24-
struct property *prop;
2524
struct resource res;
2625
void __iomem *clk_reg;
2726
void __iomem *reg;
28-
const __be32 *p;
2927
int number, i = 0, j;
3028
u8 clk_bit;
3129
u32 index;
@@ -47,7 +45,7 @@ static void __init sunxi_simple_gates_setup(struct device_node *node,
4745
if (!clk_data->clks)
4846
goto err_free_data;
4947

50-
of_property_for_each_u32(node, "clock-indices", prop, p, index) {
48+
of_property_for_each_u32(node, "clock-indices", index) {
5149
of_property_read_string_index(node, "clock-output-names",
5250
i, &clk_name);
5351

0 commit comments

Comments
 (0)