[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aCGgZPJUQdAnWa-z@smile.fi.intel.com>
Date: Mon, 12 May 2025 10:16:52 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
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>,
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>,
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-riscv@...ts.infradead.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 15/23] ACPI: property: Add support for cells property
On Sun, May 11, 2025 at 07:09:31PM +0530, Anup Patel wrote:
>
> Currently, ACPI doesn't support cells property when
> fwnode_property_get_reference_args() is called. ACPI always expects the
> number of arguments to be passed. However,
> fwnode_property_get_reference_args() 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.
You can reformat above to make it deviate less (in terms of line lengths):
Currently, ACPI doesn't support cells property when
fwnode_property_get_reference_args() is called. 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.
...
> + if (nargs_prop) {
> + if (!acpi_dev_get_property(device, nargs_prop,
> + ACPI_TYPE_INTEGER, &obj)) {
> + args_count = obj->integer.value;
> + }
> + }
> +
> + if (nargs_prop) {
> + device = to_acpi_device_node(ref_fwnode);
> + if (!acpi_dev_get_property(device, nargs_prop,
> + ACPI_TYPE_INTEGER, &obj)) {
> + args_count = obj->integer.value;
> + }
> + }
These two seems to me enough duplicative to have a common helper:
static unsigned int ...(struct acpi_dev *adev, ...)
{
// define an obj variable?
if (!nargs_prop)
return 0;
if (acpi_dev_get_property(adev, nargs_prop, ACPI_TYPE_INTEGER, &obj))
return 0;
return obj->integer.value;
}
Yes, the nember of LoCs most likely will increase, but the point here is better
maintenance experience.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists