[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1e36b1ba8af3584128550822a70cb072.sboyd@kernel.org>
Date: Wed, 17 Jul 2024 16:33:34 -0700
From: Stephen Boyd <sboyd@...nel.org>
To: Aaro Koskinen <aaro.koskinen@....fi>, Alexandre Belloni <alexandre.belloni@...tlin.com>, Alim Akhtar <alim.akhtar@...sung.com>, Andreas Kemnade <andreas@...nade.info>, Bartosz Golaszewski <brgl@...ev.pl>, Bjorn Andersson <andersson@...nel.org>, Broadcom internal kernel review list <bcm-kernel-feedback-list@...adcom.com>, Chen-Yu Tsai <wens@...e.org>, Chester Lin <chester62515@...il.com>, Christophe Leroy <christophe.leroy@...roup.eu>, Claudiu Beznea <claudiu.beznea@...on.dev>, Damien Le Moal <dlemoal@...nel.org>, Daniel Lezcano <daniel.lezcano@...aro.org>, Dong Aisheng <aisheng.dong@....com>, Doug Berger <opendmb@...il.com>, Emilio López <emilio@...pez.com.ar>, Fabio Estevam <festevam@...il.com>, Florian Fainelli <florian.fainelli@...adcom.com>, Ghennadi Procopciuc <ghennadi.procopciuc@....nxp.com>, Greg Kroah-Hartman <gregkh@...uxfoundation.org>, Jacky Bai <ping.bai@....com>, Jaroslav Kysela <perex@...ex.cz>, Jernej Skrabec <jernej.skrabec@...il.com>, Jiri Slaby
<jirislaby@...nel.org>, Jonathan Cameron <jic23@...nel.org>, Kevin Hilman <khilman@...libre.com>, Krzysztof Kozlowski <krzk@...nel.org>, Lars-Peter Clausen <lars@...afoo.de>, Lee Jones <lee@...nel.org>, Liam Girdwood <lgirdwood@...il.com>, Linus Walleij <linus.walleij@...aro.org>, Luca Ceresoli <luca.ceresoli@...tlin.com>, Mark Brown <broonie@...nel.org>, Matthias Brugger <mbrugger@...e.com>, Michael Ellerman <mpe@...erman.id.au>, Michael Turquette <mturquette@...libre.com>, Miguel Ojeda <ojeda@...nel.org>, Nathan Chancellor <nathan@...nel.org>, Naveen N. Rao <naveen.n.rao@...ux.ibm.com>, Nicholas Piggin <npiggin@...il.com>, Nicolas Ferre <nicolas.ferre@...rochip.com>, Pengutronix Kernel Team <kernel@...gutronix.de>, Richard Leitner <richard.leitner@...ux.dev>, Rob Herring <robh@...nel.org>, Roger Quadros <rogerq@...nel.org>, Samuel Holland <samuel@...lland.org>, Saravana Kannan <saravanak@...gle.com>, Shawn Guo <shawnguo@...nel.org>, Takashi Iwai <tiwai@...e.com>, Thomas Gleixner
<tglx@...utronix.de>, Tony Lindgren <tony@...mide.com>, Uwe Kleine-König <ukleinek@...nel.org>
Cc: Peng Fan (OSS) <peng.fan@....nxp.com>, Thomas Petazzoni <thomas.petazzoni@...tlin.com>, linux-kernel@...r.kernel.org, devicetree@...r.kernel.org, llvm@...ts.linux.dev, linux-clk@...r.kernel.org, linux-omap@...r.kernel.org, linux-arm-msm@...r.kernel.org, linux-arm-kernel@...ts.infradead.org, linux-sunxi@...ts.linux.dev, linux-samsung-soc@...r.kernel.org, linux-gpio@...r.kernel.org, linux-iio@...r.kernel.org, linux-pwm@...r.kernel.org, linux-serial@...r.kernel.org, linux-usb@...r.kernel.org, patches@...nsource.cirrus.com, linux-sound@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org, linux-riscv@...ts.infradead.org, Luca Ceresoli <luca.ceresoli@...tlin.com>, Andre Przywara <andre.przywara@....com>, Bartosz Golaszewski <bartosz.golaszewski@...aro.org>, Jonathan Cameron <Jonathan.Cameron@...wei.com>, Uwe Kleine-König <u.kleine-koenig@...libre.com>, Richard Fitzgerald <rf@...nsource.cirrus.com>
Subject: Re: [PATCH v2] of: remove internal arguments from of_property_for_each_u32()
Quoting Luca Ceresoli (2024-07-17 09:16:32)
> diff --git a/drivers/clk/clk-si5351.c b/drivers/clk/clk-si5351.c
> index 4ce83c5265b8..d4904f59f83f 100644
> --- a/drivers/clk/clk-si5351.c
> +++ b/drivers/clk/clk-si5351.c
> @@ -1175,8 +1175,8 @@ static int si5351_dt_parse(struct i2c_client *client,
> {
> struct device_node *child, *np = client->dev.of_node;
> struct si5351_platform_data *pdata;
> - struct property *prop;
> - const __be32 *p;
> + u32 array[4];
> + int sz, i;
> int num = 0;
> u32 val;
>
> @@ -1191,20 +1191,24 @@ static int si5351_dt_parse(struct i2c_client *client,
> * property silabs,pll-source : <num src>, [<..>]
> * allow to selectively set pll source
> */
> - of_property_for_each_u32(np, "silabs,pll-source", prop, p, num) {
> + sz = of_property_read_variable_u32_array(np, "silabs,pll-source", array, 2, 4);
> + sz = (sz == -EINVAL) ? 0 : sz; /* Missing property is OK */
> + if (sz < 0)
> + return dev_err_probe(&client->dev, sz, "invalid pll-source");
Needs a newline on the printk message.
> + if (sz % 2)
> + return dev_err_probe(&client->dev, -EINVAL,
> + "missing pll-source for pll %d\n", array[sz - 1]);
> +
> + for (i = 0; i < sz; i += 2) {
> + num = array[i];
> + val = array[i + 1];
> +
> if (num >= 2) {
> dev_err(&client->dev,
> "invalid pll %d on pll-source prop\n", num);
> return -EINVAL;
> }
>
> - p = of_prop_next_u32(prop, p, &val);
> - if (!p) {
> - dev_err(&client->dev,
> - "missing pll-source for pll %d\n", num);
> - return -EINVAL;
> - }
> -
> switch (val) {
> case 0:
> pdata->pll_src[num] = SI5351_PLL_SRC_XTAL;
> @@ -1232,19 +1236,24 @@ static int si5351_dt_parse(struct i2c_client *client,
> pdata->pll_reset[0] = true;
> pdata->pll_reset[1] = true;
>
> - of_property_for_each_u32(np, "silabs,pll-reset-mode", prop, p, num) {
> + sz = of_property_read_variable_u32_array(np, "silabs,pll-reset-mode", array, 2, 4);
> + sz = (sz == -EINVAL) ? 0 : sz; /* Missing property is OK */
> + if (sz < 0)
> + return dev_err_probe(&client->dev, sz, "invalid pll-reset-mode");
Needs a newline on the printk message.
> + if (sz % 2)
> + return dev_err_probe(&client->dev, -EINVAL,
> + "missing pll-reset-mode for pll %d\n", array[sz - 1]);
> +
With those fixed
Acked-by: Stephen Boyd <sboyd@...nel.org> # clk
Powered by blists - more mailing lists