diff mbox series

[v1,1/6] gpiolib: acpi: Assign polarity when call acpi_populate_gpio_lookup()

Message ID 20171110134033.85461-1-andriy.shevchenko@linux.intel.com
State New
Headers show
Series [v1,1/6] gpiolib: acpi: Assign polarity when call acpi_populate_gpio_lookup() | expand

Commit Message

Andy Shevchenko Nov. 10, 2017, 1:40 p.m. UTC
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(-)

Comments

Mika Westerberg Nov. 13, 2017, 11:07 a.m. UTC | #1
On Fri, Nov 10, 2017 at 03:40:28PM +0200, Andy Shevchenko wrote:
> 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>

Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
--
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
Rafael J. Wysocki Nov. 18, 2017, 2:55 p.m. UTC | #2
On Friday, November 10, 2017 2:40:28 PM CET Andy Shevchenko wrote:
> 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.

I'm assuming that this series is targeted at the GPIO subsystem.

Please let me know if that's not the case.

Thanks,
Rafael

--
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
Andy Shevchenko Nov. 18, 2017, 4:45 p.m. UTC | #3
On Sat, 2017-11-18 at 15:55 +0100, Rafael J. Wysocki wrote:
> On Friday, November 10, 2017 2:40:28 PM CET Andy Shevchenko wrote:

> I'm assuming that this series is targeted at the GPIO subsystem.

That's correct.
Linus Walleij Nov. 29, 2017, 12:27 p.m. UTC | #4
On Fri, Nov 10, 2017 at 2:40 PM, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:

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

Patch applied with Mika's ACK.

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
diff mbox series

Patch

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