* [PATCH v2 1/2] gpiolib: acpi: Print pin number on acpi_gpiochip_alloc_event errors
@ 2019-11-14 10:25 Hans de Goede
2019-11-14 10:26 ` [PATCH v2 2/2] gpiolib: acpi: Make acpi_gpiochip_alloc_event always return AE_OK Hans de Goede
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Hans de Goede @ 2019-11-14 10:25 UTC (permalink / raw)
To: Mika Westerberg, Andy Shevchenko, Bartosz Golaszewski, Linus Walleij
Cc: Hans de Goede, linux-gpio, linux-acpi
Print pin number and error-code on acpi_gpiochip_alloc_event errors,
to help debugging these.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
Changes in v2:
-Take into account that pin-number may be 16 bits
-Also log the error-code
---
drivers/gpio/gpiolib-acpi.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
index 59ccfd24627d..473c3b7508af 100644
--- a/drivers/gpio/gpiolib-acpi.c
+++ b/drivers/gpio/gpiolib-acpi.c
@@ -230,19 +230,25 @@ static acpi_status acpi_gpiochip_alloc_event(struct acpi_resource *ares,
desc = gpiochip_request_own_desc(chip, pin, "ACPI:Event",
GPIO_ACTIVE_HIGH, GPIOD_IN);
if (IS_ERR(desc)) {
- dev_err(chip->parent, "Failed to request GPIO\n");
+ dev_err(chip->parent,
+ "Failed to request GPIO for pin 0x%04X, err %ld\n",
+ pin, PTR_ERR(desc));
return AE_ERROR;
}
ret = gpiochip_lock_as_irq(chip, pin);
if (ret) {
- dev_err(chip->parent, "Failed to lock GPIO as interrupt\n");
+ dev_err(chip->parent,
+ "Failed to lock GPIO pin 0x%04X as interrupt, err %d\n",
+ pin, ret);
goto fail_free_desc;
}
irq = gpiod_to_irq(desc);
if (irq < 0) {
- dev_err(chip->parent, "Failed to translate GPIO to IRQ\n");
+ dev_err(chip->parent,
+ "Failed to translate GPIO pin 0x%04X to IRQ, err %d\n",
+ pin, irq);
goto fail_unlock_irq;
}
--
2.23.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 2/2] gpiolib: acpi: Make acpi_gpiochip_alloc_event always return AE_OK
2019-11-14 10:25 [PATCH v2 1/2] gpiolib: acpi: Print pin number on acpi_gpiochip_alloc_event errors Hans de Goede
@ 2019-11-14 10:26 ` Hans de Goede
2019-11-14 10:42 ` Mika Westerberg
2019-11-21 13:36 ` Linus Walleij
2019-11-14 10:41 ` [PATCH v2 1/2] gpiolib: acpi: Print pin number on acpi_gpiochip_alloc_event errors Mika Westerberg
2019-11-15 15:47 ` Linus Walleij
2 siblings, 2 replies; 6+ messages in thread
From: Hans de Goede @ 2019-11-14 10:26 UTC (permalink / raw)
To: Mika Westerberg, Andy Shevchenko, Bartosz Golaszewski, Linus Walleij
Cc: Hans de Goede, linux-gpio, linux-acpi
acpi_gpiochip_alloc_event is used to loop over all _AEI resources, if
we fail to bind an event handler to one of them, that is not a reason to
not try the other resources.
This commit modifies acpi_gpiochip_alloc_event to always return AE_OK,
so that we will always try to add an event handler for all _AEI resources.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
Changes in v2:
-This is a new patch in v2 of this patch-set
---
drivers/gpio/gpiolib-acpi.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
index 473c3b7508af..d30e57dc755c 100644
--- a/drivers/gpio/gpiolib-acpi.c
+++ b/drivers/gpio/gpiolib-acpi.c
@@ -194,6 +194,7 @@ static void acpi_gpiochip_request_irqs(struct acpi_gpio_chip *acpi_gpio)
acpi_gpiochip_request_irq(acpi_gpio, event);
}
+/* Always returns AE_OK so that we keep looping over the resources */
static acpi_status acpi_gpiochip_alloc_event(struct acpi_resource *ares,
void *context)
{
@@ -233,7 +234,7 @@ static acpi_status acpi_gpiochip_alloc_event(struct acpi_resource *ares,
dev_err(chip->parent,
"Failed to request GPIO for pin 0x%04X, err %ld\n",
pin, PTR_ERR(desc));
- return AE_ERROR;
+ return AE_OK;
}
ret = gpiochip_lock_as_irq(chip, pin);
@@ -293,7 +294,7 @@ static acpi_status acpi_gpiochip_alloc_event(struct acpi_resource *ares,
fail_free_desc:
gpiochip_free_own_desc(desc);
- return AE_ERROR;
+ return AE_OK;
}
/**
--
2.23.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/2] gpiolib: acpi: Print pin number on acpi_gpiochip_alloc_event errors
2019-11-14 10:25 [PATCH v2 1/2] gpiolib: acpi: Print pin number on acpi_gpiochip_alloc_event errors Hans de Goede
2019-11-14 10:26 ` [PATCH v2 2/2] gpiolib: acpi: Make acpi_gpiochip_alloc_event always return AE_OK Hans de Goede
@ 2019-11-14 10:41 ` Mika Westerberg
2019-11-15 15:47 ` Linus Walleij
2 siblings, 0 replies; 6+ messages in thread
From: Mika Westerberg @ 2019-11-14 10:41 UTC (permalink / raw)
To: Hans de Goede
Cc: Andy Shevchenko, Bartosz Golaszewski, Linus Walleij, linux-gpio,
linux-acpi
On Thu, Nov 14, 2019 at 11:25:59AM +0100, Hans de Goede wrote:
> Print pin number and error-code on acpi_gpiochip_alloc_event errors,
> to help debugging these.
>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 2/2] gpiolib: acpi: Make acpi_gpiochip_alloc_event always return AE_OK
2019-11-14 10:26 ` [PATCH v2 2/2] gpiolib: acpi: Make acpi_gpiochip_alloc_event always return AE_OK Hans de Goede
@ 2019-11-14 10:42 ` Mika Westerberg
2019-11-21 13:36 ` Linus Walleij
1 sibling, 0 replies; 6+ messages in thread
From: Mika Westerberg @ 2019-11-14 10:42 UTC (permalink / raw)
To: Hans de Goede
Cc: Andy Shevchenko, Bartosz Golaszewski, Linus Walleij, linux-gpio,
linux-acpi
On Thu, Nov 14, 2019 at 11:26:00AM +0100, Hans de Goede wrote:
> acpi_gpiochip_alloc_event is used to loop over all _AEI resources, if
> we fail to bind an event handler to one of them, that is not a reason to
> not try the other resources.
>
> This commit modifies acpi_gpiochip_alloc_event to always return AE_OK,
> so that we will always try to add an event handler for all _AEI resources.
Makes sense.
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/2] gpiolib: acpi: Print pin number on acpi_gpiochip_alloc_event errors
2019-11-14 10:25 [PATCH v2 1/2] gpiolib: acpi: Print pin number on acpi_gpiochip_alloc_event errors Hans de Goede
2019-11-14 10:26 ` [PATCH v2 2/2] gpiolib: acpi: Make acpi_gpiochip_alloc_event always return AE_OK Hans de Goede
2019-11-14 10:41 ` [PATCH v2 1/2] gpiolib: acpi: Print pin number on acpi_gpiochip_alloc_event errors Mika Westerberg
@ 2019-11-15 15:47 ` Linus Walleij
2 siblings, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2019-11-15 15:47 UTC (permalink / raw)
To: Hans de Goede
Cc: Mika Westerberg, Andy Shevchenko, Bartosz Golaszewski,
open list:GPIO SUBSYSTEM, ACPI Devel Maling List
On Thu, Nov 14, 2019 at 11:26 AM Hans de Goede <hdegoede@redhat.com> wrote:
> Print pin number and error-code on acpi_gpiochip_alloc_event errors,
> to help debugging these.
>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
> Changes in v2:
> -Take into account that pin-number may be 16 bits
> -Also log the error-code
Patch applied.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 2/2] gpiolib: acpi: Make acpi_gpiochip_alloc_event always return AE_OK
2019-11-14 10:26 ` [PATCH v2 2/2] gpiolib: acpi: Make acpi_gpiochip_alloc_event always return AE_OK Hans de Goede
2019-11-14 10:42 ` Mika Westerberg
@ 2019-11-21 13:36 ` Linus Walleij
1 sibling, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2019-11-21 13:36 UTC (permalink / raw)
To: Hans de Goede
Cc: Mika Westerberg, Andy Shevchenko, Bartosz Golaszewski,
open list:GPIO SUBSYSTEM, ACPI Devel Maling List
On Thu, Nov 14, 2019 at 11:26 AM Hans de Goede <hdegoede@redhat.com> wrote:
> acpi_gpiochip_alloc_event is used to loop over all _AEI resources, if
> we fail to bind an event handler to one of them, that is not a reason to
> not try the other resources.
>
> This commit modifies acpi_gpiochip_alloc_event to always return AE_OK,
> so that we will always try to add an event handler for all _AEI resources.
>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
> Changes in v2:
> -This is a new patch in v2 of this patch-set
Patch applied with Mika's ACK.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-11-21 13:36 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-14 10:25 [PATCH v2 1/2] gpiolib: acpi: Print pin number on acpi_gpiochip_alloc_event errors Hans de Goede
2019-11-14 10:26 ` [PATCH v2 2/2] gpiolib: acpi: Make acpi_gpiochip_alloc_event always return AE_OK Hans de Goede
2019-11-14 10:42 ` Mika Westerberg
2019-11-21 13:36 ` Linus Walleij
2019-11-14 10:41 ` [PATCH v2 1/2] gpiolib: acpi: Print pin number on acpi_gpiochip_alloc_event errors Mika Westerberg
2019-11-15 15:47 ` 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.