Skip to content

Commit 5626b47

Browse files
geertugregkh
authored andcommitted
ASoC: soc-core: Stop using of_property_read_bool() for non-boolean properties
[ Upstream commit 6eab7034579917f207ca6d8e3f4e11e85e0ab7d5 ] On R-Car: OF: /sound: Read of boolean property 'simple-audio-card,bitclock-master' with a value. OF: /sound: Read of boolean property 'simple-audio-card,frame-master' with a value. or: OF: /soc/sound@ec500000/ports/port@0/endpoint: Read of boolean property 'bitclock-master' with a value. OF: /soc/sound@ec500000/ports/port@0/endpoint: Read of boolean property 'frame-master' with a value. The use of of_property_read_bool() for non-boolean properties is deprecated in favor of of_property_present() when testing for property presence. Replace testing for presence before calling of_property_read_u32() by testing for an -EINVAL return value from the latter, to simplify the code. Signed-off-by: Geert Uytterhoeven <[email protected]> Link: https://patch.msgid.link/db10e96fbda121e7456d70e97a013cbfc9755f4d.1737533954.git.geert+renesas@glider.be Signed-off-by: Mark Brown <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 79ff5e2 commit 5626b47

File tree

1 file changed

+13
-19
lines changed

1 file changed

+13
-19
lines changed

sound/soc/soc-core.c

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2837,7 +2837,7 @@ int snd_soc_of_parse_pin_switches(struct snd_soc_card *card, const char *prop)
28372837
unsigned int i, nb_controls;
28382838
int ret;
28392839

2840-
if (!of_property_read_bool(dev->of_node, prop))
2840+
if (!of_property_present(dev->of_node, prop))
28412841
return 0;
28422842

28432843
strings = devm_kcalloc(dev, nb_controls_max,
@@ -2911,23 +2911,17 @@ int snd_soc_of_parse_tdm_slot(struct device_node *np,
29112911
if (rx_mask)
29122912
snd_soc_of_get_slot_mask(np, "dai-tdm-slot-rx-mask", rx_mask);
29132913

2914-
if (of_property_read_bool(np, "dai-tdm-slot-num")) {
2915-
ret = of_property_read_u32(np, "dai-tdm-slot-num", &val);
2916-
if (ret)
2917-
return ret;
2918-
2919-
if (slots)
2920-
*slots = val;
2921-
}
2922-
2923-
if (of_property_read_bool(np, "dai-tdm-slot-width")) {
2924-
ret = of_property_read_u32(np, "dai-tdm-slot-width", &val);
2925-
if (ret)
2926-
return ret;
2914+
ret = of_property_read_u32(np, "dai-tdm-slot-num", &val);
2915+
if (ret && ret != -EINVAL)
2916+
return ret;
2917+
if (!ret && slots)
2918+
*slots = val;
29272919

2928-
if (slot_width)
2929-
*slot_width = val;
2930-
}
2920+
ret = of_property_read_u32(np, "dai-tdm-slot-width", &val);
2921+
if (ret && ret != -EINVAL)
2922+
return ret;
2923+
if (!ret && slot_width)
2924+
*slot_width = val;
29312925

29322926
return 0;
29332927
}
@@ -3183,12 +3177,12 @@ unsigned int snd_soc_daifmt_parse_clock_provider_raw(struct device_node *np,
31833177
* check "[prefix]frame-master"
31843178
*/
31853179
snprintf(prop, sizeof(prop), "%sbitclock-master", prefix);
3186-
bit = of_property_read_bool(np, prop);
3180+
bit = of_property_present(np, prop);
31873181
if (bit && bitclkmaster)
31883182
*bitclkmaster = of_parse_phandle(np, prop, 0);
31893183

31903184
snprintf(prop, sizeof(prop), "%sframe-master", prefix);
3191-
frame = of_property_read_bool(np, prop);
3185+
frame = of_property_present(np, prop);
31923186
if (frame && framemaster)
31933187
*framemaster = of_parse_phandle(np, prop, 0);
31943188

0 commit comments

Comments
 (0)