Re: [PATCH] gpio: convince line to become input in irq helper

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 22, 2016 at 7:12 PM, Bjorn Andersson
<bjorn.andersson@xxxxxxxxxx> wrote:
> On Wed 22 Jun 07:33 PDT 2016, Linus Walleij wrote:
>
>> The generic IRQ helper library just checks if the IRQ line is
>> set as input before activating it for interrupts. As we
>> recently started to check things better with .get_dir() it
>> turns out that it's good to try to convince the line to become
>> an input before attempting to lock it as IRQ.
>>
>> Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
>
> I really like this.

Thanks :)

>> +     /*
>> +      * If it is possible to switch this GPIO to an input
>> +      * this is a good time to do it.
>> +      */
>> +     if (chip->direction_input) {
>> +             struct gpio_desc *desc;
>> +             int ret;
>> +
>> +             desc = gpiochip_get_desc(chip, d->hwirq);
>> +             if (IS_ERR(desc))
>> +                     return PTR_ERR(desc);
>> +
>> +             ret = chip->direction_input(chip, d->hwirq);
>> +             if (!ret)
>> +                     clear_bit(FLAG_IS_OUT, &desc->flags);
>
> With this updated semantics I think it's a mistake to not propagate this
> error. Clients will not be able to rely on it and have to continue
> configuring their pins as input just to be sure.

OK good point I'll propagate it. But it will only be used by those
driver utilizing the generic IRQchip helper.

It's especially for the usecase where you take an IRQ off a DT
resource without gpiod_to_irq() first.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux