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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 drivers/gpio/gpiolib-acpi.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

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,
-- 
2.9.3

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



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux