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

Configure Feed

Select the types of activity you want to include in your feed.

ASoC: soc-core: Stop using of_property_read_bool() for non-boolean properties

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 <geert+renesas@glider.be>
Link: https://patch.msgid.link/db10e96fbda121e7456d70e97a013cbfc9755f4d.1737533954.git.geert+renesas@glider.be
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Geert Uytterhoeven and committed by
Mark Brown
6eab7034 1a4a5a75

+13 -19
+13 -19
sound/soc/soc-core.c
··· 3046 3046 unsigned int i, nb_controls; 3047 3047 int ret; 3048 3048 3049 - if (!of_property_read_bool(dev->of_node, prop)) 3049 + if (!of_property_present(dev->of_node, prop)) 3050 3050 return 0; 3051 3051 3052 3052 strings = devm_kcalloc(dev, nb_controls_max, ··· 3120 3120 if (rx_mask) 3121 3121 snd_soc_of_get_slot_mask(np, "dai-tdm-slot-rx-mask", rx_mask); 3122 3122 3123 - if (of_property_read_bool(np, "dai-tdm-slot-num")) { 3124 - ret = of_property_read_u32(np, "dai-tdm-slot-num", &val); 3125 - if (ret) 3126 - return ret; 3123 + ret = of_property_read_u32(np, "dai-tdm-slot-num", &val); 3124 + if (ret && ret != -EINVAL) 3125 + return ret; 3126 + if (!ret && slots) 3127 + *slots = val; 3127 3128 3128 - if (slots) 3129 - *slots = val; 3130 - } 3131 - 3132 - if (of_property_read_bool(np, "dai-tdm-slot-width")) { 3133 - ret = of_property_read_u32(np, "dai-tdm-slot-width", &val); 3134 - if (ret) 3135 - return ret; 3136 - 3137 - if (slot_width) 3138 - *slot_width = val; 3139 - } 3129 + ret = of_property_read_u32(np, "dai-tdm-slot-width", &val); 3130 + if (ret && ret != -EINVAL) 3131 + return ret; 3132 + if (!ret && slot_width) 3133 + *slot_width = val; 3140 3134 3141 3135 return 0; 3142 3136 } ··· 3397 3403 * check "[prefix]frame-master" 3398 3404 */ 3399 3405 snprintf(prop, sizeof(prop), "%sbitclock-master", prefix); 3400 - bit = of_property_read_bool(np, prop); 3406 + bit = of_property_present(np, prop); 3401 3407 if (bit && bitclkmaster) 3402 3408 *bitclkmaster = of_parse_phandle(np, prop, 0); 3403 3409 3404 3410 snprintf(prop, sizeof(prop), "%sframe-master", prefix); 3405 - frame = of_property_read_bool(np, prop); 3411 + frame = of_property_present(np, prop); 3406 3412 if (frame && framemaster) 3407 3413 *framemaster = of_parse_phandle(np, prop, 0); 3408 3414