[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190620151115.GA54126@ediswmail.ad.cirrus.com>
Date: Thu, 20 Jun 2019 16:11:15 +0100
From: Charles Keepax <ckeepax@...nsource.cirrus.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.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 05:52:21PM +0300, Andy Shevchenko wrote:
> 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?
>
I think you are right looking closely I think we can skip this. I
might update the comment here to make it clear the list needs
freed if this is changed though.
> > /* 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?
>
Again I think you are correct here, my thinking had been to
preserve the original functionality of only overwriting the value
in info->irq if we found one. But it looks like all callers don't
pass anything meaningful in this field so changing that behaviour
shouldn't matter.
Thanks,
Charles
Powered by blists - more mailing lists