On Thu, Jun 20, 2019 at 02:34:15PM +0100, Charles Keepax wrote:
> Use the available IRQ helper functions, most of the functions have
> additional helpful side affects like configuring the trigger type of the
> IRQ.
> 
> Reviewed-by: Mika Westerberg <mika.westerb...@linux.intel.com>
> Reviewed-by: Andy Shevchenko <andriy.shevche...@linux.intel.com>
> Signed-off-by: Charles Keepax <ckee...@opensource.cirrus.com>

Some last minute observations / questions.

> +     struct resource r;
> +
> +     if (*irq <= 0 && acpi_dev_resource_interrupt(ares, 0, &r))
> +             *irq = i2c_dev_irq_from_resources(&r, 1);
> +
> +     return 1; /* No need to add resource to the list */

If we don't add it to the list, do we still need to manage the empty
resource_list below?

>       /* Then fill IRQ number if any */
>       INIT_LIST_HEAD(&resource_list);
> -     ret = acpi_dev_get_resources(adev, &resource_list, NULL, NULL);
> +     ret = acpi_dev_get_resources(adev, &resource_list,
> +                                  i2c_acpi_add_resource, &irq);
>       if (ret < 0)
>               return -EINVAL;
>  
> -     resource_list_for_each_entry(entry, &resource_list) {
> -             if (resource_type(entry->res) == IORESOURCE_IRQ) {
> -                     info->irq = entry->res->start;
> -                     break;
> -             }
> -     }

> +     if (irq > 0)
> +             info->irq = irq;

Hmm... can't we just assign it directly inside the _add_resource() call back as
original code did?

-- 
With Best Regards,
Andy Shevchenko


Reply via email to