[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190620145221.GC9224@smile.fi.intel.com>
Date: Thu, 20 Jun 2019 17:52:21 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Charles Keepax <ckeepax@...nsource.cirrus.com>
Cc: wsa@...-dreams.de, mika.westerberg@...ux.intel.com,
jarkko.nikula@...ux.intel.com, linux-i2c@...r.kernel.org,
linux-acpi@...r.kernel.org, linux-kernel@...r.kernel.org,
benjamin.tissoires@...hat.com, jbroadus@...il.com,
patches@...nsource.cirrus.com
Subject: Re: [PATCH v5 2/7] i2c: acpi: Use available IRQ helper functions
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.westerberg@...ux.intel.com>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> Signed-off-by: Charles Keepax <ckeepax@...nsource.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
Powered by blists - more mailing lists