* [PATCH v2] gpio: acpi: Ignore -EPROBE_DEFER for unselected gpioints
@ 2017-03-13 22:04 Hans de Goede
2017-03-13 22:06 ` Hans de Goede
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Hans de Goede @ 2017-03-13 22:04 UTC (permalink / raw)
To: Linus Walleij, Alexandre Courbot
Cc: Hans de Goede, Andy Shevchenko, linux-gpio
When acpi_dev_gpio_irq_get gets called with an index of say 2, it should
not care if acpi_get_gpiod for index 0 or 1 returns -EPROBE_DEFER.
This allows drivers which request a gpioint with index > 0 to function
if there is no gpiochip driver (loaded) for gpioints with a lower index.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/gpio/gpiolib-acpi.c | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
index 9b37a36..8cd3f66 100644
--- a/drivers/gpio/gpiolib-acpi.c
+++ b/drivers/gpio/gpiolib-acpi.c
@@ -653,20 +653,24 @@ int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index)
{
int idx, i;
unsigned int irq_flags;
- int ret = -ENOENT;
for (i = 0, idx = 0; idx <= index; i++) {
struct acpi_gpio_info info;
struct gpio_desc *desc;
desc = acpi_get_gpiod_by_index(adev, NULL, i, &info);
- if (IS_ERR(desc)) {
- ret = PTR_ERR(desc);
- break;
- }
+
+ /* Ignore -EPROBE_DEFER, it only matters if idx matches */
+ if (IS_ERR(desc) && PTR_ERR(desc) != -EPROBE_DEFER)
+ return PTR_ERR(desc);
+
if (info.gpioint && idx++ == index) {
- int irq = gpiod_to_irq(desc);
+ int irq;
+
+ if (IS_ERR(desc))
+ return PTR_ERR(desc);
+ irq = gpiod_to_irq(desc);
if (irq < 0)
return irq;
@@ -682,7 +686,7 @@ int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index)
}
}
- return ret;
+ return -ENOENT;
}
EXPORT_SYMBOL_GPL(acpi_dev_gpio_irq_get);
--
2.9.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2] gpio: acpi: Ignore -EPROBE_DEFER for unselected gpioints
2017-03-13 22:04 [PATCH v2] gpio: acpi: Ignore -EPROBE_DEFER for unselected gpioints Hans de Goede
@ 2017-03-13 22:06 ` Hans de Goede
2017-03-15 10:31 ` Linus Walleij
2017-03-16 14:48 ` Linus Walleij
2 siblings, 0 replies; 6+ messages in thread
From: Hans de Goede @ 2017-03-13 22:06 UTC (permalink / raw)
To: Linus Walleij, Alexandre Courbot; +Cc: Andy Shevchenko, linux-gpio
Hi,
A note about the v2 in the subject, this patch moving from me to
Andy and back again has resulted in the inline changelog being
eaten.
This is basically a new patch replacing my 2 patch series
which tried to deal with -EPROBE_DEFER errors for not
selected gpioints. It uses a different (simpler) approach
then that series.
Regards,
Hans
On 13-03-17 23:04, Hans de Goede wrote:
> When acpi_dev_gpio_irq_get gets called with an index of say 2, it should
> not care if acpi_get_gpiod for index 0 or 1 returns -EPROBE_DEFER.
>
> This allows drivers which request a gpioint with index > 0 to function
> if there is no gpiochip driver (loaded) for gpioints with a lower index.
>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> drivers/gpio/gpiolib-acpi.c | 18 +++++++++++-------
> 1 file changed, 11 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
> index 9b37a36..8cd3f66 100644
> --- a/drivers/gpio/gpiolib-acpi.c
> +++ b/drivers/gpio/gpiolib-acpi.c
> @@ -653,20 +653,24 @@ int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index)
> {
> int idx, i;
> unsigned int irq_flags;
> - int ret = -ENOENT;
>
> for (i = 0, idx = 0; idx <= index; i++) {
> struct acpi_gpio_info info;
> struct gpio_desc *desc;
>
> desc = acpi_get_gpiod_by_index(adev, NULL, i, &info);
> - if (IS_ERR(desc)) {
> - ret = PTR_ERR(desc);
> - break;
> - }
> +
> + /* Ignore -EPROBE_DEFER, it only matters if idx matches */
> + if (IS_ERR(desc) && PTR_ERR(desc) != -EPROBE_DEFER)
> + return PTR_ERR(desc);
> +
> if (info.gpioint && idx++ == index) {
> - int irq = gpiod_to_irq(desc);
> + int irq;
> +
> + if (IS_ERR(desc))
> + return PTR_ERR(desc);
>
> + irq = gpiod_to_irq(desc);
> if (irq < 0)
> return irq;
>
> @@ -682,7 +686,7 @@ int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index)
> }
>
> }
> - return ret;
> + return -ENOENT;
> }
> EXPORT_SYMBOL_GPL(acpi_dev_gpio_irq_get);
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] gpio: acpi: Ignore -EPROBE_DEFER for unselected gpioints
2017-03-13 22:04 [PATCH v2] gpio: acpi: Ignore -EPROBE_DEFER for unselected gpioints Hans de Goede
2017-03-13 22:06 ` Hans de Goede
@ 2017-03-15 10:31 ` Linus Walleij
2017-03-15 10:54 ` Mika Westerberg
2017-03-16 14:48 ` Linus Walleij
2 siblings, 1 reply; 6+ messages in thread
From: Linus Walleij @ 2017-03-15 10:31 UTC (permalink / raw)
To: Hans de Goede, Mika Westerberg, Rafael J. Wysocki
Cc: Alexandre Courbot, Andy Shevchenko, linux-gpio
On Mon, Mar 13, 2017 at 11:04 PM, Hans de Goede <hdegoede@redhat.com> wrote:
> When acpi_dev_gpio_irq_get gets called with an index of say 2, it should
> not care if acpi_get_gpiod for index 0 or 1 returns -EPROBE_DEFER.
>
> This allows drivers which request a gpioint with index > 0 to function
> if there is no gpiochip driver (loaded) for gpioints with a lower index.
>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
I am dependent on Mika and Rafael to review ACPI/GPIO patches,
maybe I should just put in a special entry to MAINTAINERS for
this file... anyway let's see what they say.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] gpio: acpi: Ignore -EPROBE_DEFER for unselected gpioints
2017-03-15 10:31 ` Linus Walleij
@ 2017-03-15 10:54 ` Mika Westerberg
2017-03-15 13:35 ` Hans de Goede
0 siblings, 1 reply; 6+ messages in thread
From: Mika Westerberg @ 2017-03-15 10:54 UTC (permalink / raw)
To: Linus Walleij
Cc: Hans de Goede, Rafael J. Wysocki, Alexandre Courbot,
Andy Shevchenko, linux-gpio
On Wed, Mar 15, 2017 at 11:31:36AM +0100, Linus Walleij wrote:
> On Mon, Mar 13, 2017 at 11:04 PM, Hans de Goede <hdegoede@redhat.com> wrote:
>
> > When acpi_dev_gpio_irq_get gets called with an index of say 2, it should
> > not care if acpi_get_gpiod for index 0 or 1 returns -EPROBE_DEFER.
> >
> > This allows drivers which request a gpioint with index > 0 to function
> > if there is no gpiochip driver (loaded) for gpioints with a lower index.
> >
> > Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>
> I am dependent on Mika and Rafael to review ACPI/GPIO patches,
> maybe I should just put in a special entry to MAINTAINERS for
> this file... anyway let's see what they say.
Hans, could you in future Cc patches related to ACPI to linux-acpi
mailing list as well? This one I looked up from linux-gpio mail
archives.
The patch looks good to me so,
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] gpio: acpi: Ignore -EPROBE_DEFER for unselected gpioints
2017-03-15 10:54 ` Mika Westerberg
@ 2017-03-15 13:35 ` Hans de Goede
0 siblings, 0 replies; 6+ messages in thread
From: Hans de Goede @ 2017-03-15 13:35 UTC (permalink / raw)
To: Mika Westerberg, Linus Walleij
Cc: Rafael J. Wysocki, Alexandre Courbot, Andy Shevchenko, linux-gpio
Hi,
On 15-03-17 11:54, Mika Westerberg wrote:
> On Wed, Mar 15, 2017 at 11:31:36AM +0100, Linus Walleij wrote:
>> On Mon, Mar 13, 2017 at 11:04 PM, Hans de Goede <hdegoede@redhat.com> wrote:
>>
>>> When acpi_dev_gpio_irq_get gets called with an index of say 2, it should
>>> not care if acpi_get_gpiod for index 0 or 1 returns -EPROBE_DEFER.
>>>
>>> This allows drivers which request a gpioint with index > 0 to function
>>> if there is no gpiochip driver (loaded) for gpioints with a lower index.
>>>
>>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>>> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>>
>> I am dependent on Mika and Rafael to review ACPI/GPIO patches,
>> maybe I should just put in a special entry to MAINTAINERS for
>> this file... anyway let's see what they say.
>
> Hans, could you in future Cc patches related to ACPI to linux-acpi
> mailing list as well?
Ok, will do.
> This one I looked up from linux-gpio mail
> archives.
>
> The patch looks good to me so,
>
> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Thank you.
Regards,
Hans
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] gpio: acpi: Ignore -EPROBE_DEFER for unselected gpioints
2017-03-13 22:04 [PATCH v2] gpio: acpi: Ignore -EPROBE_DEFER for unselected gpioints Hans de Goede
2017-03-13 22:06 ` Hans de Goede
2017-03-15 10:31 ` Linus Walleij
@ 2017-03-16 14:48 ` Linus Walleij
2 siblings, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2017-03-16 14:48 UTC (permalink / raw)
To: Hans de Goede; +Cc: Alexandre Courbot, Andy Shevchenko, linux-gpio
On Mon, Mar 13, 2017 at 11:04 PM, Hans de Goede <hdegoede@redhat.com> wrote:
> When acpi_dev_gpio_irq_get gets called with an index of say 2, it should
> not care if acpi_get_gpiod for index 0 or 1 returns -EPROBE_DEFER.
>
> This allows drivers which request a gpioint with index > 0 to function
> if there is no gpiochip driver (loaded) for gpioints with a lower index.
>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Patch applied with Mika's ACK.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-03-16 14:48 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-13 22:04 [PATCH v2] gpio: acpi: Ignore -EPROBE_DEFER for unselected gpioints Hans de Goede
2017-03-13 22:06 ` Hans de Goede
2017-03-15 10:31 ` Linus Walleij
2017-03-15 10:54 ` Mika Westerberg
2017-03-15 13:35 ` Hans de Goede
2017-03-16 14:48 ` Linus Walleij
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.