[PATCH v7 14/24] ACPI: property: Refactor acpi_fwnode_get_reference_args()
Rafael J. Wysocki
rafael at kernel.org
Wed Jul 2 10:01:27 PDT 2025
On Wed, Jul 2, 2025 at 4:45 PM Sunil V L <sunilvl at ventanamicro.com> wrote:
>
> On Wed, Jul 02, 2025 at 12:07:36PM +0200, Rafael J. Wysocki wrote:
> > On Wed, Jul 2, 2025 at 7:15 AM Anup Patel <apatel at ventanamicro.com> wrote:
> > >
> > > From: Sunil V L <sunilvl at ventanamicro.com>
> > >
> > > Currently acpi_fwnode_get_reference_args() calls the public function
> > > __acpi_node_get_property_reference() which ignores the nargs_prop
> > > parameter.
> >
> > Which I suppose is a problem. Why is it so?
> >
> fwnode_property_get_reference_args() documents as below.
>
> * @nargs_prop: The name of the property telling the number of
> * arguments in the referred node. NULL if @nargs is known,
> * otherwise @nargs is ignored. Only relevant on OF.
> * @nargs: Number of arguments. Ignored if @nargs_prop is non-NULL.
>
> You can see that nargs_prop is not supported with ACPI currently. Since
> fwnode_property_get_reference_args() calls
> __acpi_node_get_property_reference(), there is no way to determine the
> nargs from the nargs_prop currently with ACPI. Since
> fwnode_property_get_reference_args() is a common API across DT and ACPI,
> it is a problem for users.
So the problem is that if nargs_prop is passed to
fwnode_property_get_reference_args() and it is a valid "cells"
property, OF will use it to obtain the number of reference arguments
and ACPI will ignore it. To make it work the same way in both cases,
acpi_fwnode_get_reference_args() needs to be modified to take
nargs_prop into account properly. This is the key information that
needs to go into the patch changelog.
> > > To fix this, make __acpi_node_get_property_reference() to
> > > call the static acpi_fwnode_get_reference() so that callers of
> > > fwnode_get_reference_args() can still pass a valid property name to
> > > fetch the number of arguments.
> >
> > Are the current callers of acpi_fwnode_get_reference_args() going to
> > be affected by this change and if so, then how?
> >
> Good question!. If some one is currently passing both valid nargs_prop and
> nargs with ACPI, now with this change it will start getting the value
> from nargs_prop which was simply ignored earlier. However, I see only 2
> combinations how fwnode_property_get_reference_args() is being used.
>
> (nargs_prop = NULL) && (args_count !=0)
> or
> (nargs_prop != NULL) && (args_count = 0)
OK
More information about the linux-riscv
mailing list