Hi everyone,
I recently came across a difference in behaviour of OF phandle parsing and
ACPI reference parsing, both of which can soon be accessed using
fwnode_property_get_reference_args.
The main change in this proposal touches OF, and specifically the change
is about using -ENODATA to tell that the phandle reference list entry that
was accessed does not exist. -ENOENT was used previously, but the same
error code was also used to tell that a phandle was empty, making it
impossible for the caller to figure out which of the two was the case.
I'm sending the set as RFC. In my limited testing I have found no ill
effects.
These patches are on top of linux-next.
Comments on the approach and the changes themselves would be most welcome.
For what it's worth, fwnode_property_get_reference_args is in Rafael's
tree (as well as in linux-next) and hasn't reached mainline yet. It will
be used in the near future for parsing references to external devices in
the V4L2 framework.
These patches can be found here:
<URL:https://git.linuxtv.org/sailus/media_tree.git/log/?h=fwnode-parse>
Regards,
- Sakari
Sakari Ailus (5):
clk: Increment assigned-clocks index for empty phandles
of: Return -ENODATA on accessing out of bounds indices in phandle
parsing
of: Return total number of entries in of_count_phandle_with_args
ACPI: align acpi_fwnode_get_reference_args with OF counterpart
device property: Document fwnode_property_get_reference_args better
drivers/acpi/property.c | 3 +++
drivers/base/power/domain.c | 2 +-
drivers/base/property.c | 5 +++++
drivers/clk/clk-conf.c | 8 +++++---
drivers/clk/clkdev.c | 2 +-
drivers/gpio/gpiolib-of.c | 2 +-
drivers/gpio/gpiolib.c | 2 +-
drivers/gpu/host1x/mipi.c | 2 +-
drivers/hwspinlock/hwspinlock_core.c | 2 +-
drivers/iio/inkern.c | 2 +-
drivers/of/base.c | 37 ++++++++++++++++++++++++------------
drivers/pwm/core.c | 2 +-
drivers/regulator/gpio-regulator.c | 2 +-
drivers/reset/core.c | 3 ++-
drivers/spi/spi.c | 2 +-
15 files changed, 50 insertions(+), 26 deletions(-)
--
2.11.0