[v2,2/2] gpiolib: acpi: Make acpi_gpiochip_alloc_event always return AE_OK
diff mbox series

Message ID 20191114102600.34558-2-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:26 a.m. UTC
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(-)

Comments

Mika Westerberg Nov. 14, 2019, 10:42 a.m. UTC | #1
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>
Linus Walleij Nov. 21, 2019, 1:36 p.m. UTC | #2
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

Patch
diff mbox series

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