[PATCH v3 15/23] ACPI: property: Add support for cells property
Sunil V L
sunilvl at ventanamicro.com
Mon May 12 01:30:54 PDT 2025
Hi Andy,
On Mon, May 12, 2025 at 10:16:52AM +0300, Andy Shevchenko wrote:
> 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.
>
Sure. Let me update in the next revision. Thanks!
> ...
>
> > + 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.
>
Makes sense. Let me do it in the next version.
Thanks!
Sunil
More information about the linux-riscv
mailing list