linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Linus Walleij <linus.walleij@linaro.org>,
	Alexandre Courbot <gnurou@gmail.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	linux-gpio@vger.kernel.org, Hans de Goede <hdegoede@redhat.com>
Subject: [PATCH 1/2] gpio: acpi: acpi_gpio_resource_lookup: return info even if there is no desc
Date: Fri, 10 Mar 2017 21:58:45 +0100	[thread overview]
Message-ID: <20170310205846.16530-2-hdegoede@redhat.com> (raw)
In-Reply-To: <20170310205846.16530-1-hdegoede@redhat.com>

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(-)

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


  reply	other threads:[~2017-03-10 20:58 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-10 20:58 [PATCH 0/2] gpio: acpi: acpi_dev_gpio_irq_get: ignore the status of unselected irqs Hans de Goede
2017-03-10 20:58 ` Hans de Goede [this message]
2017-03-15 10:17   ` [PATCH 1/2] gpio: acpi: acpi_gpio_resource_lookup: return info even if there is no desc Linus Walleij
2017-03-15 10:19     ` Hans de Goede
2017-03-10 20:58 ` [PATCH 2/2] gpio: acpi: acpi_dev_gpio_irq_get: ignore the status of unselected irqs Hans de Goede
2017-03-13 17:23 ` [PATCH 0/2] " Andy Shevchenko
2017-03-13 17:56   ` Hans de Goede
2017-03-13 19:19     ` Andy Shevchenko
2017-03-13 19:23       ` Hans de Goede
2017-03-13 19:31         ` Andy Shevchenko
2017-03-13 19:38           ` Andy Shevchenko
2017-03-13 22:02             ` Hans de Goede

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170310205846.16530-2-hdegoede@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=gnurou@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).