[PATCH v3 15/23] ACPI: property: Add support for cells property
Andy Shevchenko
andriy.shevchenko at linux.intel.com
Mon May 12 00:16:52 PDT 2025
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
More information about the linux-riscv
mailing list