linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/6] gpiolib: acpi: Assign polarity when call acpi_populate_gpio_lookup()
@ 2017-11-10 13:40 Andy Shevchenko
  2017-11-10 13:40 ` [PATCH v1 2/6] gpiolib: acpi: Don't contaminate return parameter in case of error Andy Shevchenko
                   ` (7 more replies)
  0 siblings, 8 replies; 26+ messages in thread
From: Andy Shevchenko @ 2017-11-10 13:40 UTC (permalink / raw)
  To: Linus Walleij, linux-gpio, Rafael J. Wysocki, linux-acpi,
	Mika Westerberg
  Cc: Andy Shevchenko

There is no need, since we preserve firmware settings, to override
polarity for GpioInt() resources.

While Documentation/gpio-properties.txt refers to any from GpioIo() /
GpioInt() resources, the active_low flag has been introduced to fill the
gap only for GpioIo() which lacks of that information.

Moreover, in case of GpioInt() existed solution was broken anyway, it
overrides only in one direction, i.e. from 0 to 1, otherwise it would be
still 1 as defined in the resource macro.

So, move the assignment to a right place and forbid to (semi-)override
polarity for GpioInt() type of resources.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/gpio/gpiolib-acpi.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
index eb4528c87c0b..2a85d27eb028 100644
--- a/drivers/gpio/gpiolib-acpi.c
+++ b/drivers/gpio/gpiolib-acpi.c
@@ -531,8 +531,8 @@ static int acpi_populate_gpio_lookup(struct acpi_resource *ares, void *data)
 			lookup->info.triggering = agpio->triggering;
 		} else {
 			lookup->info.flags = acpi_gpio_to_gpiod_flags(agpio);
+			lookup->info.polarity = lookup->active_low;
 		}
-
 	}
 
 	return 1;
@@ -557,11 +557,8 @@ static int acpi_gpio_resource_lookup(struct acpi_gpio_lookup *lookup,
 	if (!lookup->desc)
 		return -ENOENT;
 
-	if (info) {
+	if (info)
 		*info = lookup->info;
-		if (lookup->active_low)
-			info->polarity = lookup->active_low;
-	}
 	return 0;
 }
 
-- 
2.14.2


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

end of thread, other threads:[~2017-11-30 11:07 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-10 13:40 [PATCH v1 1/6] gpiolib: acpi: Assign polarity when call acpi_populate_gpio_lookup() Andy Shevchenko
2017-11-10 13:40 ` [PATCH v1 2/6] gpiolib: acpi: Don't contaminate return parameter in case of error Andy Shevchenko
2017-11-13 11:15   ` Mika Westerberg
2017-11-29 12:28   ` Linus Walleij
2017-11-10 13:40 ` [PATCH v1 3/6] gpiolib: acpi: Move adev member to struct acpi_gpio_info Andy Shevchenko
2017-11-13 11:23   ` Mika Westerberg
2017-11-29 12:30   ` Linus Walleij
2017-11-10 13:40 ` [PATCH v1 4/6] gpiolib: acpi: Consolidate debug output in acpi_gpio_update_gpiod_flags() Andy Shevchenko
2017-11-13 11:25   ` Mika Westerberg
2017-11-29 12:31   ` Linus Walleij
2017-11-10 13:40 ` [PATCH v1 5/6] gpiolib: acpi: Add quirks field to struct acpi_gpio_mapping Andy Shevchenko
2017-11-13 11:44   ` Mika Westerberg
2017-11-29 12:32   ` Linus Walleij
2017-11-10 13:40 ` [PATCH v1 6/6] gpiolib: acpi: Introduce NO_RESTRICTION quirk Andy Shevchenko
2017-11-13 11:55   ` Mika Westerberg
2017-11-13 13:10     ` Andy Shevchenko
2017-11-13 13:19       ` Mika Westerberg
2017-11-29 12:35       ` Linus Walleij
2017-11-29 13:41         ` Andy Shevchenko
2017-11-30  9:57           ` Linus Walleij
2017-11-30 11:07             ` Andy Shevchenko
2017-11-29 12:34   ` Linus Walleij
2017-11-13 11:07 ` [PATCH v1 1/6] gpiolib: acpi: Assign polarity when call acpi_populate_gpio_lookup() Mika Westerberg
2017-11-18 14:55 ` Rafael J. Wysocki
2017-11-18 16:45   ` Andy Shevchenko
2017-11-29 12:27 ` Linus Walleij

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