[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACRpkdaRP9UpBd0stX+qgTRcaHN2108yeak3FvZeHaayyc6uWg@mail.gmail.com>
Date: Tue, 3 Jun 2014 10:08:00 +0200
From: Linus Walleij <linus.walleij@...aro.org>
To: "Zhu, Lejun" <lejun.zhu@...ux.intel.com>
Cc: Mika Westerberg <mika.westerberg@...ux.intel.com>,
Grygorii Strashko <grygorii.strashko@...com>,
Alexandre Courbot <gnurou@...il.com>,
Mathias Nyman <mathias.nyman@...ux.intel.com>,
"linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
jacob.jun.pan@...ux.intel.com, bin.yang@...el.com
Subject: Re: [PATCH v4] gpio: Add support for Intel SoC PMIC (Crystal Cove)
On Fri, May 30, 2014 at 4:12 AM, Zhu, Lejun <lejun.zhu@...ux.intel.com> wrote:
> retval = gpiochip_add(&cg->chip);
> if (retval) {
> dev_warn(&pdev->dev, "add gpio chip error: %d\n", retval);
> return ret;
> }
>
> gpiochip_irqchip_add(&cg->chip, &crystalcove_irqchip, 0,
> handle_simple_irq, IRQ_TYPE_NONE);
>
> retval = request_threaded_irq(irq, NULL, crystalcove_gpio_irq_handler,
> IRQF_ONESHOT, KBUILD_MODNAME, cg);
You should request the interrupt before you add the irqchip
I think. But it shouldn't really matter, mainly to avoid tearing
down the irqchip if getting the irq should fail.
> But this code will trigger a crash in gpiolib-acpi. Currently at the end
> of gpiochip_add(), it calls:
>
> gpiochip_add() -> acpi_gpiochip_add() -> acpi_gpiochip_request_interrupts()
>
> acpi_gpiochip_request_interrupts() needs ->to_irq to work. Without having
> called gpiochip_irqchip_add() already, this will be NULL:
>
> if (!chip->to_irq)
> return; <-- It will return here.
>
> INIT_LIST_HEAD(&acpi_gpio->events);
>
> In the tear down path, acpi_gpiochip_free_interrupts() will find to_irq is
> no longer NULL, then it will walk an uninitialized list.
>
> So, should this be fixed in gpiolib-acpi?
Maybe, maybe in the drivers. I think Mika has a proposed solution...
Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists