From: Stephen Boyd <sboyd@kernel.org>
To: "Aaro Koskinen" <aaro.koskinen@iki.fi>,
"Alexandre Belloni" <alexandre.belloni@bootlin.com>,
"Alim Akhtar" <alim.akhtar@samsung.com>,
"Andreas Kemnade" <andreas@kemnade.info>,
"Bartosz Golaszewski" <brgl@bgdev.pl>,
"Bjorn Andersson" <andersson@kernel.org>,
"Broadcom internal kernel review list"
<bcm-kernel-feedback-list@broadcom.com>,
"Chen-Yu Tsai" <wens@csie.org>,
"Chester Lin" <chester62515@gmail.com>,
"Christophe Leroy" <christophe.leroy@csgroup.eu>,
"Claudiu Beznea" <claudiu.beznea@tuxon.dev>,
"Damien Le Moal" <dlemoal@kernel.org>,
"Daniel Lezcano" <daniel.lezcano@linaro.org>,
"Dong Aisheng" <aisheng.dong@nxp.com>,
"Doug Berger" <opendmb@gmail.com>,
"Emilio López" <emilio@elopez.com.ar>,
"Fabio Estevam" <festevam@gmail.com>,
"Florian Fainelli" <florian.fainelli@broadcom.com>,
"Ghennadi Procopciuc" <ghennadi.procopciuc@oss.nxp.com>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Jacky Bai" <ping.bai@nxp.com>,
"Jaroslav Kysela" <perex@perex.cz>,
"Jernej Skrabec" <jernej.skrabec@gmail.com>,
"Jiri Slaby" <jirislaby@kernel.org>,
"Jonathan Cameron" <jic23@kernel.org>,
"Kevin Hilman" <khilman@baylibre.com>,
"Krzysztof Kozlowski" <krzk@kernel.org>,
"Lars-Peter Clausen" <lars@metafoo.de>,
"Lee Jones" <lee@kernel.org>,
"Liam Girdwood" <lgirdwood@gmail.com>,
"Linus Walleij" <linus.walleij@linaro.org>,
"Luca Ceresoli" <luca.ceresoli@bootlin.com>,
"Mark Brown" <broonie@kernel.org>,
"Matthias Brugger" <mbrugger@suse.com>,
"Michael Ellerman" <mpe@ellerman.id.au>,
"Michael Turquette" <mturquette@baylibre.com>,
"Miguel Ojeda" <ojeda@kernel.org>,
"Nathan Chancellor" <nathan@kernel.org>,
"Naveen N. Rao" <naveen.n.rao@linux.ibm.com>,
"Nicholas Piggin" <npiggin@gmail.com>,
"Nicolas Ferre" <nicolas.ferre@microchip.com>,
"Pengutronix Kernel Team" <kernel@pengutronix.de>,
"Richard Leitner" <richard.leitner@linux.dev>,
"Rob Herring" <robh@kernel.org>,
"Roger Quadros" <rogerq@kernel.org>,
"Samuel Holland" <samuel@sholland.org>,
"Saravana Kannan" <saravanak@google.com>,
"Shawn Guo" <shawnguo@kernel.org>,
"Takashi Iwai" <tiwai@suse.com>,
"Thomas Gleixner" <tglx@linutronix.de>,
"Tony Lindgren" <tony@atomide.com>,
"Uwe Kleine-König" <ukleinek@kernel.org>
Cc: "Peng Fan" <peng.fan@oss.nxp.com>,
"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
llvm@lists.linux.dev, linux-clk@vger.kernel.org,
linux-omap@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-sunxi@lists.linux.dev, linux-samsung-soc@vger.kernel.org,
linux-gpio@vger.kernel.org, linux-iio@vger.kernel.org,
linux-pwm@vger.kernel.org, linux-serial@vger.kernel.org,
linux-usb@vger.kernel.org, patches@opensource.cirrus.com,
linux-sound@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
linux-riscv@lists.infradead.org,
"Luca Ceresoli" <luca.ceresoli@bootlin.com>,
"Andre Przywara" <andre.przywara@arm.com>,
"Bartosz Golaszewski" <bartosz.golaszewski@linaro.org>,
"Jonathan Cameron" <Jonathan.Cameron@huawei.com>,
"Uwe Kleine-König" <u.kleine-koenig@baylibre.com>,
"Richard Fitzgerald" <rf@opensource.cirrus.com>
Subject: Re: [PATCH v2] of: remove internal arguments from of_property_for_each_u32()
Date: Wed, 17 Jul 2024 16:33:34 -0700 [thread overview]
Message-ID: <1e36b1ba8af3584128550822a70cb072.sboyd@kernel.org> (raw)
In-Reply-To: <20240717-of_property_for_each_u32-v2-1-4060990f49c9@bootlin.com>
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@kernel.org> # clk
next prev parent reply other threads:[~2024-07-17 23:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-17 16:16 [PATCH v2] of: remove internal arguments from of_property_for_each_u32() Luca Ceresoli
2024-07-17 23:33 ` Stephen Boyd [this message]
2024-07-18 6:56 ` Luca Ceresoli
2024-07-24 13:53 ` Rob Herring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1e36b1ba8af3584128550822a70cb072.sboyd@kernel.org \
--to=sboyd@kernel.org \
--cc=Jonathan.Cameron@huawei.com \
--cc=aaro.koskinen@iki.fi \
--cc=aisheng.dong@nxp.com \
--cc=alexandre.belloni@bootlin.com \
--cc=alim.akhtar@samsung.com \
--cc=andersson@kernel.org \
--cc=andre.przywara@arm.com \
--cc=andreas@kemnade.info \
--cc=bartosz.golaszewski@linaro.org \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=brgl@bgdev.pl \
--cc=broonie@kernel.org \
--cc=chester62515@gmail.com \
--cc=christophe.leroy@csgroup.eu \
--cc=claudiu.beznea@tuxon.dev \
--cc=daniel.lezcano@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=dlemoal@kernel.org \
--cc=emilio@elopez.com.ar \
--cc=festevam@gmail.com \
--cc=florian.fainelli@broadcom.com \
--cc=ghennadi.procopciuc@oss.nxp.com \
--cc=gregkh@linuxfoundation.org \
--cc=jernej.skrabec@gmail.com \
--cc=jic23@kernel.org \
--cc=jirislaby@kernel.org \
--cc=kernel@pengutronix.de \
--cc=khilman@baylibre.com \
--cc=krzk@kernel.org \
--cc=lars@metafoo.de \
--cc=lee@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=linux-sunxi@lists.linux.dev \
--cc=linux-usb@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=llvm@lists.linux.dev \
--cc=luca.ceresoli@bootlin.com \
--cc=mbrugger@suse.com \
--cc=mpe@ellerman.id.au \
--cc=mturquette@baylibre.com \
--cc=nathan@kernel.org \
--cc=naveen.n.rao@linux.ibm.com \
--cc=nicolas.ferre@microchip.com \
--cc=npiggin@gmail.com \
--cc=ojeda@kernel.org \
--cc=opendmb@gmail.com \
--cc=patches@opensource.cirrus.com \
--cc=peng.fan@oss.nxp.com \
--cc=perex@perex.cz \
--cc=ping.bai@nxp.com \
--cc=rf@opensource.cirrus.com \
--cc=richard.leitner@linux.dev \
--cc=robh@kernel.org \
--cc=rogerq@kernel.org \
--cc=samuel@sholland.org \
--cc=saravanak@google.com \
--cc=shawnguo@kernel.org \
--cc=tglx@linutronix.de \
--cc=thomas.petazzoni@bootlin.com \
--cc=tiwai@suse.com \
--cc=tony@atomide.com \
--cc=u.kleine-koenig@baylibre.com \
--cc=ukleinek@kernel.org \
--cc=wens@csie.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).