[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 3 Mar 2021 10:22:02 +0100
From: Linus Walleij <linus.walleij@...aro.org>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: Mika Westerberg <mika.westerberg@...ux.intel.com>,
"open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>,
ACPI Devel Maling List <linux-acpi@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Bartosz Golaszewski <bgolaszewski@...libre.com>
Subject: Re: [PATCH v1 4/4] gpiolib: Reuse device's fwnode to create IRQ domain
On Tue, Mar 2, 2021 at 4:35 PM Andy Shevchenko
<andriy.shevchenko@...ux.intel.com> wrote:
> When IRQ domain is created for an ACPI case, the name of it becomes unknown-%d
> since for now it utilizes of_node member only and doesn't consider fwnode case.
> Convert IRQ domain creation code to utilize fwnode instead.
>
> Before/After the change on Intel Galileo Gen 2 with two GPIO (IRQ) controllers:
>
> unknown-1 ==> \_SB.PCI0.GIP0.GPO
> unknown-2 ==> \_SB.NIO3
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
This first part seems to do what you want,
> @@ -1457,9 +1457,9 @@ static int gpiochip_add_irqchip(struct gpio_chip *gc,
> struct lock_class_key *lock_key,
> struct lock_class_key *request_key)
> {
> + struct fwnode_handle *fwnode = dev_fwnode(&gc->gpiodev->dev);
(...)
But this:
> @@ -1504,15 +1497,14 @@ static int gpiochip_add_irqchip(struct gpio_chip *gc,
> return ret;
> } else {
> /* Some drivers provide custom irqdomain ops */
> - if (gc->irq.domain_ops)
> - ops = gc->irq.domain_ops;
> -
> - if (!ops)
> - ops = &gpiochip_domain_ops;
> - gc->irq.domain = irq_domain_add_simple(np,
> - gc->ngpio,
> - gc->irq.first,
> - ops, gc);
> + ops = gc->irq.domain_ops ?: &gpiochip_domain_ops;
> + if (gc->irq.first)
> + gc->irq.domain = irq_domain_create_legacy(fwnode, gc->ngpio,
> + gc->irq.first, 0,
> + ops, gc);
> + else
> + gc->irq.domain = irq_domain_create_linear(fwnode, gc->ngpio,
> + ops, gc);
This looks like a refactoring and reimplementation of irq_domain_add_simple()?
Why, and should it rather be a separate patch?
Yours,
Linus Walleij
Powered by blists - more mailing lists