Message ID | 20240703-of_property_for_each_u32-v1-17-42c1fc0b82aa@bootlin.com |
---|---|
State | New |
Headers | show |
Series | Simplify of_property_for_each_u32() | expand |
On 03/07/2024 11:37, Luca Ceresoli wrote: > Simplify code using of_property_for_each_u32_new() as the two additional > parameters in of_property_for_each_u32() are not used here. > > Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com> > --- > sound/soc/codecs/arizona.c | 12 +++++------- > 1 file changed, 5 insertions(+), 7 deletions(-) > > diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c > index 7434aeeda292..1a64b9815809 100644 > --- a/sound/soc/codecs/arizona.c > +++ b/sound/soc/codecs/arizona.c > @@ -2786,15 +2786,13 @@ int arizona_of_get_audio_pdata(struct arizona *arizona) > { > struct arizona_pdata *pdata = &arizona->pdata; > struct device_node *np = arizona->dev->of_node; > - struct property *prop; > - const __be32 *cur; > u32 val; > u32 pdm_val[ARIZONA_MAX_PDM_SPK]; > int ret; > int count = 0; > > count = 0; > - of_property_for_each_u32(np, "wlf,inmode", prop, cur, val) { > + of_property_for_each_u32_new(np, "wlf,inmode", val) { > if (count == ARRAY_SIZE(pdata->inmode)) > break; > > @@ -2803,7 +2801,7 @@ int arizona_of_get_audio_pdata(struct arizona *arizona) > } > > count = 0; > - of_property_for_each_u32(np, "wlf,dmic-ref", prop, cur, val) { > + of_property_for_each_u32_new(np, "wlf,dmic-ref", val) { > if (count == ARRAY_SIZE(pdata->dmic_ref)) > break; > > @@ -2812,7 +2810,7 @@ int arizona_of_get_audio_pdata(struct arizona *arizona) > } > > count = 0; > - of_property_for_each_u32(np, "wlf,out-mono", prop, cur, val) { > + of_property_for_each_u32_new(np, "wlf,out-mono", val) { > if (count == ARRAY_SIZE(pdata->out_mono)) > break; > > @@ -2821,7 +2819,7 @@ int arizona_of_get_audio_pdata(struct arizona *arizona) > } > > count = 0; > - of_property_for_each_u32(np, "wlf,max-channels-clocked", prop, cur, val) { > + of_property_for_each_u32_new(np, "wlf,max-channels-clocked", val) { > if (count == ARRAY_SIZE(pdata->max_channels_clocked)) > break; > > @@ -2830,7 +2828,7 @@ int arizona_of_get_audio_pdata(struct arizona *arizona) > } > > count = 0; > - of_property_for_each_u32(np, "wlf,out-volume-limit", prop, cur, val) { > + of_property_for_each_u32_new(np, "wlf,out-volume-limit", val) { > if (count == ARRAY_SIZE(pdata->out_vol_limit)) > break; > > Reviewed-by: Richard Fitzgerald <rf@opensource.cirrus.com>
On Wed, Jul 03, 2024 at 12:37:01PM +0200, Luca Ceresoli wrote: > Simplify code using of_property_for_each_u32_new() as the two additional > parameters in of_property_for_each_u32() are not used here. Acked-by: Mark Brown <broonie@kernel.org>
diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c index 7434aeeda292..1a64b9815809 100644 --- a/sound/soc/codecs/arizona.c +++ b/sound/soc/codecs/arizona.c @@ -2786,15 +2786,13 @@ int arizona_of_get_audio_pdata(struct arizona *arizona) { struct arizona_pdata *pdata = &arizona->pdata; struct device_node *np = arizona->dev->of_node; - struct property *prop; - const __be32 *cur; u32 val; u32 pdm_val[ARIZONA_MAX_PDM_SPK]; int ret; int count = 0; count = 0; - of_property_for_each_u32(np, "wlf,inmode", prop, cur, val) { + of_property_for_each_u32_new(np, "wlf,inmode", val) { if (count == ARRAY_SIZE(pdata->inmode)) break; @@ -2803,7 +2801,7 @@ int arizona_of_get_audio_pdata(struct arizona *arizona) } count = 0; - of_property_for_each_u32(np, "wlf,dmic-ref", prop, cur, val) { + of_property_for_each_u32_new(np, "wlf,dmic-ref", val) { if (count == ARRAY_SIZE(pdata->dmic_ref)) break; @@ -2812,7 +2810,7 @@ int arizona_of_get_audio_pdata(struct arizona *arizona) } count = 0; - of_property_for_each_u32(np, "wlf,out-mono", prop, cur, val) { + of_property_for_each_u32_new(np, "wlf,out-mono", val) { if (count == ARRAY_SIZE(pdata->out_mono)) break; @@ -2821,7 +2819,7 @@ int arizona_of_get_audio_pdata(struct arizona *arizona) } count = 0; - of_property_for_each_u32(np, "wlf,max-channels-clocked", prop, cur, val) { + of_property_for_each_u32_new(np, "wlf,max-channels-clocked", val) { if (count == ARRAY_SIZE(pdata->max_channels_clocked)) break; @@ -2830,7 +2828,7 @@ int arizona_of_get_audio_pdata(struct arizona *arizona) } count = 0; - of_property_for_each_u32(np, "wlf,out-volume-limit", prop, cur, val) { + of_property_for_each_u32_new(np, "wlf,out-volume-limit", val) { if (count == ARRAY_SIZE(pdata->out_vol_limit)) break;
Simplify code using of_property_for_each_u32_new() as the two additional parameters in of_property_for_each_u32() are not used here. Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com> --- sound/soc/codecs/arizona.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)