lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240703180111.GA1245093-robh@kernel.org>
Date: Wed, 3 Jul 2024 12:01:11 -0600
From: Rob Herring <robh@...nel.org>
To: Luca Ceresoli <luca.ceresoli@...tlin.com>
Cc: Miguel Ojeda <ojeda@...nel.org>, Saravana Kannan <saravanak@...gle.com>,
	Nathan Chancellor <nathan@...nel.org>,
	Michael Turquette <mturquette@...libre.com>,
	Stephen Boyd <sboyd@...nel.org>, Tony Lindgren <tony@...mide.com>,
	Bjorn Andersson <andersson@...nel.org>,
	Emilio López <emilio@...pez.com.ar>,
	Chen-Yu Tsai <wens@...e.org>,
	Jernej Skrabec <jernej.skrabec@...il.com>,
	Samuel Holland <samuel@...lland.org>,
	Krzysztof Kozlowski <krzk@...nel.org>,
	Daniel Lezcano <daniel.lezcano@...aro.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Florian Fainelli <florian.fainelli@...adcom.com>,
	Broadcom internal kernel review list <bcm-kernel-feedback-list@...adcom.com>,
	Linus Walleij <linus.walleij@...aro.org>,
	Bartosz Golaszewski <brgl@...ev.pl>,
	Jonathan Cameron <jic23@...nel.org>, Lee Jones <lee@...nel.org>,
	Shawn Guo <shawnguo@...nel.org>,
	Pengutronix Kernel Team <kernel@...gutronix.de>,
	Uwe Kleine-König <ukleinek@...nel.org>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Jiri Slaby <jirislaby@...nel.org>,
	Richard Leitner <richard.leitner@...ux.dev>,
	Liam Girdwood <lgirdwood@...il.com>,
	Mark Brown <broonie@...nel.org>,
	Nicolas Ferre <nicolas.ferre@...rochip.com>,
	Michael Ellerman <mpe@...erman.id.au>,
	Nicholas Piggin <npiggin@...il.com>,
	Christophe Leroy <christophe.leroy@...roup.eu>,
	"Naveen N. Rao" <naveen.n.rao@...ux.ibm.com>,
	Damien Le Moal <dlemoal@...nel.org>,
	"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
Subject: Re: [PATCH 20/20] of: deprecate and rename of_property_for_each_u32()

On Wed, Jul 03, 2024 at 12:37:04PM +0200, Luca Ceresoli wrote:
> of_property_for_each_u32() is meant to disappear. All the call sites not
> using the 3rd and 4th arguments have already been replaced by
> of_property_for_each_u32_new().
> 
> Deprecate the old macro. Also rename it to minimize the number of new
> usages and encourage conversion to the of_property_for_each_u32_new() macro
> in not(-yet)-upstream code.
> 
> Signed-off-by: Luca Ceresoli <luca.ceresoli@...tlin.com>
> 
> ---
> 
> Notes:
> 
>  * The following files have not been build-tested simply because I haven't
>    managed to have a config that enables them so far:
> 
>      drivers/irqchip/irq-pic32-evic.c
>      drivers/pinctrl/pinctrl-k210.c
> 
>  * These have not been converted yet as they are not trivial, and they will
>    need to use a more specific function that does the lookup they need and
>    returns the result:
> 
>      drivers/clk/clk-si5351.c

I would do something like this:

	sz = of_property_read_variable_u32_array(np, "silabs,pll-source", array, 2, 4);
	if (sz >= 2)
		pdata->pll_src[array[0]] = val_to_src(array[1]);
	if (sz >= 4)
		pdata->pll_src[array[2]] = val_to_src(array[3]);


>      drivers/clk/clk.c

Wouldn't this work:

8<------------------------------------------------------

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 8cca52be993f..33a8cc193556 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -5371,6 +5371,7 @@ const char *of_clk_get_parent_name(const struct device_node *np, int index)
        int rc;
        int count;
        struct clk *clk;
+       bool found = false;
 
        rc = of_parse_phandle_with_args(np, "clocks", "#clock-cells", index,
                                        &clkspec);
@@ -5383,15 +5384,16 @@ const char *of_clk_get_parent_name(const struct device_node *np, int index)
        /* if there is an indices property, use it to transfer the index
         * specified into an array offset for the clock-output-names property.
         */
-       of_property_for_each_u32(clkspec.np, "clock-indices", prop, vp, pv) {
+       of_property_for_each_u32_new(clkspec.np, "clock-indices", pv) {
                if (index == pv) {
                        index = count;
+                       found = true;
                        break;
                }
                count++;
        }
        /* We went off the end of 'clock-indices' without finding it */
-       if (prop && !vp)
+       if (of_property_present(clkspec.np, "clock-indices") && !found)
                return NULL;
 
        if (of_property_read_string_index(clkspec.np, "clock-output-names",

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ