diff mbox

[1/2] gpio: acpi: acpi_gpio_resource_lookup: return info even if there is no desc

Message ID 20170310205846.16530-2-hdegoede@redhat.com
State New
Headers show

Commit Message

Hans de Goede March 10, 2017, 8:58 p.m. UTC
Make acpi_gpio_resource_lookup fill acpi_gpio_info even if there is
no gpio_desc for the gpio and add a found flag to lookup which is
used to indicate that valid info was found.

This is a preparation patch for making acpi_dev_gpio_irq_get actually
skip interrupts which do not match the requested index, rather then
bailing if it cannot retreive a gpio_desc for them.

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

Comments

Linus Walleij March 15, 2017, 10:17 a.m. UTC | #1
On Fri, Mar 10, 2017 at 9:58 PM, Hans de Goede <hdegoede@redhat.com> wrote:

> Make acpi_gpio_resource_lookup fill acpi_gpio_info even if there is
> no gpio_desc for the gpio and add a found flag to lookup which is
> used to indicate that valid info was found.
>
> This is a preparation patch for making acpi_dev_gpio_irq_get actually
> skip interrupts which do not match the requested index, rather then
> bailing if it cannot retreive a gpio_desc for them.
>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

I'm totally dependent on Mika/Rafael to review these ACPI patches.

Mika?

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Hans de Goede March 15, 2017, 10:19 a.m. UTC | #2
Hi,

On 15-03-17 11:17, Linus Walleij wrote:
> On Fri, Mar 10, 2017 at 9:58 PM, Hans de Goede <hdegoede@redhat.com> wrote:
>
>> Make acpi_gpio_resource_lookup fill acpi_gpio_info even if there is
>> no gpio_desc for the gpio and add a found flag to lookup which is
>> used to indicate that valid info was found.
>>
>> This is a preparation patch for making acpi_dev_gpio_irq_get actually
>> skip interrupts which do not match the requested index, rather then
>> bailing if it cannot retreive a gpio_desc for them.
>>
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>
> I'm totally dependent on Mika/Rafael to review these ACPI patches.

This series has been superseded by: "gpio: acpi: Ignore -EPROBE_DEFER for unselected gpioints"
which is a single simpler patch fixing the issue in a better way.

Regards,

Hans
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
index 3fe63d8..86fabdd 100644
--- a/drivers/gpio/gpiolib-acpi.c
+++ b/drivers/gpio/gpiolib-acpi.c
@@ -475,6 +475,7 @@  struct acpi_gpio_lookup {
 	int index;
 	int pin_index;
 	bool active_low;
+	bool found;
 	struct acpi_device *adev;
 	struct gpio_desc *desc;
 	int n;
@@ -513,6 +514,7 @@  static int acpi_populate_gpio_lookup(struct acpi_resource *ares, void *data)
 		} else {
 			lookup->info.flags = acpi_gpio_to_gpiod_flags(agpio);
 		}
+		lookup->found = true;
 	}
 
 	return 1;
@@ -534,15 +536,13 @@  static int acpi_gpio_resource_lookup(struct acpi_gpio_lookup *lookup,
 
 	acpi_dev_free_resource_list(&res_list);
 
-	if (!lookup->desc)
-		return -ENOENT;
-
 	if (info) {
 		*info = lookup->info;
 		if (lookup->active_low)
 			info->polarity = lookup->active_low;
 	}
-	return 0;
+
+	return lookup->desc ? 0 : -ENOENT;
 }
 
 static int acpi_gpio_property_lookup(struct fwnode_handle *fwnode,