[v2,1/2] gpiolib: acpi: Print pin number on acpi_gpiochip_alloc_event errors
diff mbox series

Message ID 20191114102600.34558-1-hdegoede@redhat.com
State New
Headers show
Series
  • [v2,1/2] gpiolib: acpi: Print pin number on acpi_gpiochip_alloc_event errors
Related show

Commit Message

Hans de Goede Nov. 14, 2019, 10:25 a.m. UTC
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(-)

Comments

Mika Westerberg Nov. 14, 2019, 10:41 a.m. UTC | #1
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>
Linus Walleij Nov. 15, 2019, 3:47 p.m. UTC | #2
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

Patch
diff mbox series

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;
 	}