Re: [PATCH v4 23/24] platform: Modify platform_get_irq_optional() to use resource

From: Andy Shevchenko
Date: Sat Jan 06 2024 - 09:56:14 EST


On Tue, Jan 02, 2024 at 02:07:47PM -0700, Mark Hasemeyer wrote:
> Unify handling of ACPI, GPIO, devictree, and platform resource
> interrupts in platform_get_irq_optional(). Each of these subsystems
> provide their own APIs which provide IRQ information as a struct
> resource. This simplifies the logic of the function and allows callers
> to get more information about the IRQ by looking at the resource flags.
> For example, whether or not an IRQ is wake capable.

...

> + ret = fwnode_irq_get_resource(fwnode, num, r);

I still prefer this not to return positive value. Since you _require_ @r to be
not NULL, i.e. valid, the returning positive value makes no sense.

> + ret = ret < 0 ? ret : 0;
> + if (!ret || ret == -EPROBE_DEFER)
> + goto out;

...

> + struct resource *platform_res = platform_get_resource(dev, IORESOURCE_IRQ, num);

Same comment, please split definition and assignment.

--
With Best Regards,
Andy Shevchenko