Re: [PATCH v1 1/6] gpiolib: acpi: Modify acpi_dev_irq_wake_get_by to use resource

From: Andy Shevchenko
Date: Wed Dec 13 2023 - 14:35:05 EST


On Wed, Dec 13, 2023 at 11:00:19AM -0700, Mark Hasemeyer wrote:
> Other information besides wake capability can be provided about GPIO
> IRQs such as triggering, polarity, and sharability. Use resource flags
> to provide this information to the caller if they want it.
>
> This should keep the API more robust over time as flags are added,
> modified, or removed. It also more closely matches acpi_irq_get which

acpi_irq_get()

> take a resource as an argument.
>
> Rename the function to acpi_dev_get_gpio_irq_resource to better describe

acpi_dev_get_gpio_irq_resource()

> the function's new behavior.

...

> + * @r: pointer to resource to populate with irq information. It is not modified on failure.

IRQ

I don't think the second remark is even needed. It's usual approach, i.e.
we expect no changes in the output if error condition is met.

...

> + * Irq number will be available in the resource structure.

IRQ

...

> + *r = (struct resource)DEFINE_RES_IRQ(irq);

Why do you need "(struct resource)" annotation?

...

> + struct resource irqres;
> struct i2c_acpi_irq_context irq_ctx = {
> .irq = -ENOENT,
> };

Hmm... I'm wondering if we can reuse irqres as a context to the respective
lookup calls.

--
With Best Regards,
Andy Shevchenko