[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJZ5v0iYYuK2GF2Pg3NiO4vLFzoYm6Q3Dnk5O2DkMJm1R3qSfQ@mail.gmail.com>
Date: Wed, 2 Jul 2025 12:20:55 +0200
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Anup Patel <apatel@...tanamicro.com>
Cc: Michael Turquette <mturquette@...libre.com>, Stephen Boyd <sboyd@...nel.org>,
Rob Herring <robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley <conor+dt@...nel.org>,
Jassi Brar <jassisinghbrar@...il.com>, Thomas Gleixner <tglx@...utronix.de>,
"Rafael J . Wysocki" <rafael@...nel.org>, Mika Westerberg <mika.westerberg@...ux.intel.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Linus Walleij <linus.walleij@...aro.org>, Bartosz Golaszewski <brgl@...ev.pl>,
Uwe Kleine-König <ukleinek@...nel.org>,
Palmer Dabbelt <palmer@...belt.com>, Paul Walmsley <paul.walmsley@...ive.com>,
Alexandre Ghiti <alex@...ti.fr>, Len Brown <lenb@...nel.org>, Sunil V L <sunilvl@...tanamicro.com>,
Rahul Pathak <rpathak@...tanamicro.com>, Leyfoon Tan <leyfoon.tan@...rfivetech.com>,
Atish Patra <atish.patra@...ux.dev>, Andrew Jones <ajones@...tanamicro.com>,
Samuel Holland <samuel.holland@...ive.com>, Anup Patel <anup@...infault.org>,
linux-clk@...r.kernel.org, devicetree@...r.kernel.org,
linux-acpi@...r.kernel.org, linux-riscv@...ts.infradead.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v7 15/24] ACPI: property: Add support for cells property
On Wed, Jul 2, 2025 at 7:16 AM Anup Patel <apatel@...tanamicro.com> wrote:
>
> From: Sunil V L <sunilvl@...tanamicro.com>
>
> Currently, ACPI doesn't support cells property when
> fwnode_property_get_reference_args() is called.
What exactly do you mean by "cells property" here and below?
> ACPI always expects
> the number of arguments to be passed. However, the above mentioned
> call being a common interface for OF and ACPI, it is better to have
> single calling convention which works for both. Hence, add support
> for cells property on the reference device to get the number of
> arguments dynamically.
>
> Signed-off-by: Sunil V L <sunilvl@...tanamicro.com>
> Signed-off-by: Anup Patel <apatel@...tanamicro.com>
> ---
> drivers/acpi/property.c | 22 ++++++++++++++++++----
> drivers/base/property.c | 2 +-
> 2 files changed, 19 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c
> index d4863746fb11..d08b0ea5c915 100644
> --- a/drivers/acpi/property.c
> +++ b/drivers/acpi/property.c
> @@ -882,6 +882,17 @@ static struct fwnode_handle *acpi_parse_string_ref(const struct fwnode_handle *f
> return &dn->fwnode;
> }
>
> +static unsigned int acpi_fwnode_get_args_count(const struct acpi_device *device,
> + const char *nargs_prop)
> +{
> + const union acpi_object *obj;
> +
> + if (acpi_dev_get_property(device, nargs_prop, ACPI_TYPE_INTEGER, &obj))
> + return 0;
> +
> + return obj->integer.value;
> +}
> +
> static int acpi_fwnode_get_reference_args(const struct fwnode_handle *fwnode,
> const char *propname, const char *nargs_prop,
> unsigned int args_count, unsigned int index,
> @@ -892,6 +903,7 @@ static int acpi_fwnode_get_reference_args(const struct fwnode_handle *fwnode,
> const struct acpi_device_data *data;
> struct fwnode_handle *ref_fwnode;
> struct acpi_device *device;
> + unsigned int nargs_count;
> int ret, idx = 0;
>
> data = acpi_device_data_of_node(fwnode);
> @@ -960,11 +972,12 @@ static int acpi_fwnode_get_reference_args(const struct fwnode_handle *fwnode,
> if (!device)
> return -EINVAL;
>
> + nargs_count = acpi_fwnode_get_args_count(device, nargs_prop);
I think it should work the same way as it used to for the callers that
pass args_count, so maybe
if (!args_count)
args_count = acpi_fwnode_get_args_count(device, nargs_prop);
> element++;
> -
> ret = acpi_get_ref_args(idx == index ? args : NULL,
> acpi_fwnode_handle(device),
> - &element, end, args_count);
> + &element, end,
> + nargs_count ? nargs_count : args_count);
And this change would not be necessary?
And analogously below.
> if (ret < 0)
> return ret;
>
> @@ -978,11 +991,12 @@ static int acpi_fwnode_get_reference_args(const struct fwnode_handle *fwnode,
> if (!ref_fwnode)
> return -EINVAL;
>
> + device = to_acpi_device_node(ref_fwnode);
> + nargs_count = acpi_fwnode_get_args_count(device, nargs_prop);
> element++;
> -
> ret = acpi_get_ref_args(idx == index ? args : NULL,
> ref_fwnode, &element, end,
> - args_count);
> + nargs_count ? nargs_count : args_count);
> if (ret < 0)
> return ret;
>
> diff --git a/drivers/base/property.c b/drivers/base/property.c
> index f626d5bbe806..6a63860579dd 100644
> --- a/drivers/base/property.c
> +++ b/drivers/base/property.c
> @@ -578,7 +578,7 @@ EXPORT_SYMBOL_GPL(fwnode_property_match_property_string);
> * @prop: The name of the property
> * @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.
> + * otherwise @nargs is ignored.
> * @nargs: Number of arguments. Ignored if @nargs_prop is non-NULL.
> * @index: Index of the reference, from zero onwards.
> * @args: Result structure with reference and integer arguments.
> --
Powered by blists - more mailing lists