All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gpiolib: acpi: Print pin number on acpi_gpiochip_alloc_event errors
@ 2019-10-18 19:52 Hans de Goede
  2019-10-21  9:11 ` Andy Shevchenko
  0 siblings, 1 reply; 6+ messages in thread
From: Hans de Goede @ 2019-10-18 19:52 UTC (permalink / raw)
  To: Mika Westerberg, Andy Shevchenko, Bartosz Golaszewski, Linus Walleij
  Cc: Hans de Goede, linux-gpio, linux-acpi

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

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/gpio/gpiolib-acpi.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
index 609ed16ae933..2911dd6f2625 100644
--- a/drivers/gpio/gpiolib-acpi.c
+++ b/drivers/gpio/gpiolib-acpi.c
@@ -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;
 	}
 
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] gpiolib: acpi: Print pin number on acpi_gpiochip_alloc_event errors
  2019-10-18 19:52 [PATCH] gpiolib: acpi: Print pin number on acpi_gpiochip_alloc_event errors Hans de Goede
@ 2019-10-21  9:11 ` Andy Shevchenko
  2019-10-21 12:52   ` Hans de Goede
  2019-10-21 13:26   ` Andy Shevchenko
  0 siblings, 2 replies; 6+ messages in thread
From: Andy Shevchenko @ 2019-10-21  9:11 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Mika Westerberg, Bartosz Golaszewski, Linus Walleij, linux-gpio,
	linux-acpi

On Fri, Oct 18, 2019 at 09:52:08PM +0200, Hans de Goede wrote:
> 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
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
>  drivers/gpio/gpiolib-acpi.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
> index 609ed16ae933..2911dd6f2625 100644
> --- a/drivers/gpio/gpiolib-acpi.c
> +++ b/drivers/gpio/gpiolib-acpi.c
> @@ -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;
>  	}
>  
> -- 
> 2.23.0
> 

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] gpiolib: acpi: Print pin number on acpi_gpiochip_alloc_event errors
  2019-10-21  9:11 ` Andy Shevchenko
@ 2019-10-21 12:52   ` Hans de Goede
  2019-10-21 13:23     ` Andy Shevchenko
  2019-10-21 13:26   ` Andy Shevchenko
  1 sibling, 1 reply; 6+ messages in thread
From: Hans de Goede @ 2019-10-21 12:52 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Mika Westerberg, Bartosz Golaszewski, Linus Walleij, linux-gpio,
	linux-acpi

Hi,

On 21-10-2019 11:11, Andy Shevchenko wrote:
> On Fri, Oct 18, 2019 at 09:52:08PM +0200, Hans de Goede wrote:
>> 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




> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> 
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>> ---
>>   drivers/gpio/gpiolib-acpi.c | 9 ++++++---
>>   1 file changed, 6 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
>> index 609ed16ae933..2911dd6f2625 100644
>> --- a/drivers/gpio/gpiolib-acpi.c
>> +++ b/drivers/gpio/gpiolib-acpi.c
>> @@ -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;
>>   	}
>>   
>> -- 
>> 2.23.0
>>
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] gpiolib: acpi: Print pin number on acpi_gpiochip_alloc_event errors
  2019-10-21 12:52   ` Hans de Goede
@ 2019-10-21 13:23     ` Andy Shevchenko
  2019-11-14 10:13       ` Hans de Goede
  0 siblings, 1 reply; 6+ messages in thread
From: Andy Shevchenko @ 2019-10-21 13:23 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Mika Westerberg, Bartosz Golaszewski, Linus Walleij, linux-gpio,
	linux-acpi

On Mon, Oct 21, 2019 at 02:52:13PM +0200, Hans de Goede wrote:
> On 21-10-2019 11:11, Andy Shevchenko wrote:
> > On Fri, Oct 18, 2019 at 09:52:08PM +0200, Hans de Goede wrote:
> > > 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?

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] gpiolib: acpi: Print pin number on acpi_gpiochip_alloc_event errors
  2019-10-21  9:11 ` Andy Shevchenko
  2019-10-21 12:52   ` Hans de Goede
@ 2019-10-21 13:26   ` Andy Shevchenko
  1 sibling, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2019-10-21 13:26 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Mika Westerberg, Bartosz Golaszewski, Linus Walleij, linux-gpio,
	linux-acpi

On Mon, Oct 21, 2019 at 12:11:24PM +0300, Andy Shevchenko wrote:
> On Fri, Oct 18, 2019 at 09:52:08PM +0200, Hans de Goede wrote:
> > 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
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

I have to withdraw this due to potential issue found.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] gpiolib: acpi: Print pin number on acpi_gpiochip_alloc_event errors
  2019-10-21 13:23     ` Andy Shevchenko
@ 2019-11-14 10:13       ` Hans de Goede
  0 siblings, 0 replies; 6+ messages in thread
From: Hans de Goede @ 2019-11-14 10:13 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Mika Westerberg, Bartosz Golaszewski, Linus Walleij, linux-gpio,
	linux-acpi

Hi,

On 21-10-2019 15:23, Andy Shevchenko wrote:
> On Mon, Oct 21, 2019 at 02:52:13PM +0200, Hans de Goede wrote:
>> On 21-10-2019 11:11, Andy Shevchenko wrote:
>>> On Fri, Oct 18, 2019 at 09:52:08PM +0200, Hans de Goede wrote:
>>>> 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?

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-11-14 10:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-18 19:52 [PATCH] gpiolib: acpi: Print pin number on acpi_gpiochip_alloc_event errors Hans de Goede
2019-10-21  9:11 ` Andy Shevchenko
2019-10-21 12:52   ` Hans de Goede
2019-10-21 13:23     ` Andy Shevchenko
2019-11-14 10:13       ` Hans de Goede
2019-10-21 13:26   ` Andy Shevchenko

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.