Re: [PATCH 04/10] regulator: of: switch to using class_find_device_by_fwnode()

From
Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date
2026-03-23 22:48:47
Also in
driver-core, linux-fpga, linux-leds, linux-phy, linux-spi, lkml
Reply to
Andrew Lunn, 2026-03-23
On Mon, Mar 23, 2026 at 11:39:03PM +0100, Andrew Lunn wrote:
quoted
If there is a deprecated property you can do:

	error = device_property_read_u32(dev, "prop", &val);
	if (error == -ENOENT)
		error = device_property_read_u32(dev, "deprecated-prop", &val);
It is not as simple as that. There are a lot of optional
properties. Say "prop" is optional? And not present. So -ENOENT. We
then look for this deprecated property. That should not happen.
Why? That is exactly what you want: you favor new one if it is present
and fall back to deprecated one if it is absent. And then you decide
whether to continue or abort.

Or you are saying that new property is optional but old one was
mandatory? Not sure...
Using of_property_read_u32(np, "deprecated-prop", &val) actually makes
it stand out, it is special somehow, which is good, because it is
special.
If you only have of_property_read_u32() then it will not stand out. If
you advocate of using device_property_read_u32() normally but
of_property_read_u32() for deprecated only - that is a possibility, but
I do not know if anyone does this.

Thanks.

-- 
Dmitry
Thread (42 messages) 42 messages, 7 authors, last reply 2026-05-10
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help