Re: [PATCH v1 5/6] platform: Modify platform_get_irq_optional() to use resource

From: Mark Hasemeyer
Date: Mon Dec 18 2023 - 15:23:56 EST


> > + *r = (struct resource)DEFINE_RES_IRQ(ret);
>
> Why is the annotation needed?

It's not needed anymore. I'll remove it.

> > - struct resource *r;
> > + struct resource *platform_res;
> >
> > if (IS_ENABLED(CONFIG_OF_IRQ) && dev->dev.of_node) {
> > - ret = of_irq_get(dev->dev.of_node, num);
> > + ret = of_irq_to_resource(dev->dev.of_node, num, r);
> > if (ret > 0 || ret == -EPROBE_DEFER)
> > goto out;
> > }
>
>
> > + if (has_acpi_companion(&dev->dev)) {
> > + ret = acpi_irq_get(ACPI_HANDLE(&dev->dev), num, r);
> > + if (!ret || ret == -EPROBE_DEFER) {
> > + ret = ret ?: r->start;
> > + goto out;
> > + }
> > + }
>
> Consider combine the above to use fwnode_irq_get() in the separate prerequisite
> change.

I like the idea. It doesn't look like 'struct fwnode_operations'
provides a way to retrieve information in a 'struct resource' format.
Perhaps this could be followed up on in a separate patch train?

>
> > + irqd_set_trigger_type(irqd, r->flags & IORESOURCE_BITS);
>
> NIH resource_type().
>
> > + }
> > return ret;

Does NIH mean "not invented here"? resource_type() masks
IORESOURCE_TYPE_BITS, not IORESOURCE_BITS. I'm not quite sure what you
mean here.