Skip to contentSkip to conversation

gpiolib: acpi: Print pin number on acpi_gpiochip_alloc_event errors

PATCH Superseded Hans de Goede 2 participants 6 messages Oct 18, 2019 – Nov 14, 2019

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpiolib: acpi: Print pin number on acpi_gpiochip_alloc_event errors

Print pin number on acpi_gpiochip_alloc_event errors, to help debugging these.

---
 drivers/gpio/gpiolib-acpi.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpio/gpiolib-acpi.c +6 -3
index 609ed16ae933..2911dd6f2625 100644
@@ -230,19 +230,22 @@ 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%02X\n", pin);
 		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%02X as interrupt\n", pin);
 		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%02X to IRQ\n", pin);
 		goto fail_unlock_irq;
 	}
 
Signature · 1 line
2.23.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 2 lines · Hans de Goede

Print pin number on acpi_gpiochip_alloc_event errors, to help debugging these.

I'm not sure which one is better decimal or hex, perhaps Mika can help me, in any case

Quoted 38 lines
---
 drivers/gpio/gpiolib-acpi.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpio/gpiolib-acpi.c +6 -3
index 609ed16ae933..2911dd6f2625 100644
@@ -230,19 +230,22 @@ 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%02X\n", pin);
 		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%02X as interrupt\n", pin);
 		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%02X to IRQ\n", pin);
 		goto fail_unlock_irq;
 	}
 
Signature · 1 line
2.23.0
Signature · 2 lines
With Best Regards,
Andy Shevchenko
#2 lore raw

Hi,

Quoted 5 lines · Andy Shevchenko
Quoted 2 lines · Hans de Goede

Print pin number on acpi_gpiochip_alloc_event errors, to help debugging these.

I'm not sure which one is better decimal or hex, perhaps Mika can help me, in any case

They are listed as hex in the dis-assembled DSTD.

Regards,

Hans

Quoted 41 lines
Quoted 38 lines
---
  drivers/gpio/gpiolib-acpi.c | 9 ++++++---
  1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpio/gpiolib-acpi.c +6 -3
index 609ed16ae933..2911dd6f2625 100644
@@ -230,19 +230,22 @@ 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%02X\n", pin);
  		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%02X as interrupt\n", pin);
  		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%02X to IRQ\n", pin);
  		goto fail_unlock_irq;
  	}
 
Signature · 1 line
2.23.0
#3 lore raw
Quoted 8 lines · Hans de Goede
Quoted 5 lines · Andy Shevchenko
Quoted 2 lines · Hans de Goede

Print pin number on acpi_gpiochip_alloc_event errors, to help debugging these.

I'm not sure which one is better decimal or hex, perhaps Mika can help me, in any case

They are listed as hex in the dis-assembled DSTD.

Oh, now I noticed the potential issue. The pin can be 16-bit, you pring here only for the case when we have evname. Maybe do something similar in these messages? Print event name for pin inside byte range and value otherwise?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#5 lore raw
In reply to Andy Shevchenko
Quoted 6 lines · Andy Shevchenko
Quoted 2 lines · Hans de Goede

Print pin number on acpi_gpiochip_alloc_event errors, to help debugging these.

I'm not sure which one is better decimal or hex, perhaps Mika can help me, in any case

I have to withdraw this due to potential issue found.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#4 lore raw
In reply to Andy Shevchenko

Hi,

Quoted 6 lines · Andy Shevchenko
Quoted 5 lines · Hans de Goede
Quoted 4 lines · Andy Shevchenko
Quoted 2 lines · Hans de Goede

Print pin number on acpi_gpiochip_alloc_event errors, to help debugging these.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

I'm not sure which one is better decimal or hex, perhaps Mika can help me, in any case

They are listed as hex in the dis-assembled DSTD.

Oh, now I noticed the potential issue. The pin can be 16-bit, you pring here only for the case when we have evname. Maybe do something similar in these messages? Print event name for pin inside byte range and value otherwise?

I'm preparing a v2 now, together with another related, less cosmetic patch. I will switch to a 16 bit printf format for v2.

Regards,

Hans