* [PATCH v1 0/6] gpio: Get rid of deprecated GPIOF_ACTIVE_LOW
@ 2024-11-04 9:34 Andy Shevchenko
2024-11-04 9:34 ` [PATCH v1 1/6] Input: gpio_keys - avoid using GPIOF_ACTIVE_LOW Andy Shevchenko
` (7 more replies)
0 siblings, 8 replies; 26+ messages in thread
From: Andy Shevchenko @ 2024-11-04 9:34 UTC (permalink / raw)
To: Andy Shevchenko, Bartosz Golaszewski, Dmitry Torokhov,
Tony Lindgren, Lee Jones, linux-gpio, linux-kernel, linux-input,
linux-leds, linux-arm-kernel, linux-usb
Cc: Linus Walleij, Bartosz Golaszewski, Pavel Machek,
Dominik Brodowski, Daniel Mack, Haojian Zhuang, Robert Jarzmik,
Greg Kroah-Hartman
This series targets the deprecated GPIOF_ACTIVE_LOW as only a few users
left. Convert those users to call modern APIs and drop this legacy piece
from the source tree.
The idea is to route this via GPIO tree, please Ack.
Andy Shevchenko (6):
Input: gpio_keys - avoid using GPIOF_ACTIVE_LOW
Input: gpio_keys_polled - avoid using GPIOF_ACTIVE_LOW
leds: gpio: Avoid using GPIOF_ACTIVE_LOW
pcmcia: soc_common: Avoid using GPIOF_ACTIVE_LOW
USB: gadget: pxa27x_udc: Avoid using GPIOF_ACTIVE_LOW
gpio: Get rid of GPIOF_ACTIVE_LOW
drivers/gpio/gpiolib-legacy.c | 3 ---
drivers/input/keyboard/gpio_keys.c | 10 ++++------
drivers/input/keyboard/gpio_keys_polled.c | 12 +++++-------
drivers/leds/leds-gpio.c | 9 ++++-----
drivers/pcmcia/soc_common.c | 12 +++++-------
drivers/usb/gadget/udc/pxa27x_udc.c | 7 ++++---
include/linux/gpio.h | 3 ---
7 files changed, 22 insertions(+), 34 deletions(-)
--
2.43.0.rc1.1336.g36b5255a03ac
^ permalink raw reply [flat|nested] 26+ messages in thread
* [PATCH v1 1/6] Input: gpio_keys - avoid using GPIOF_ACTIVE_LOW
2024-11-04 9:34 [PATCH v1 0/6] gpio: Get rid of deprecated GPIOF_ACTIVE_LOW Andy Shevchenko
@ 2024-11-04 9:34 ` Andy Shevchenko
2024-11-05 5:44 ` Dmitry Torokhov
2024-11-08 8:33 ` Linus Walleij
2024-11-04 9:34 ` [PATCH v1 2/6] Input: gpio_keys_polled " Andy Shevchenko
` (6 subsequent siblings)
7 siblings, 2 replies; 26+ messages in thread
From: Andy Shevchenko @ 2024-11-04 9:34 UTC (permalink / raw)
To: Andy Shevchenko, Bartosz Golaszewski, Dmitry Torokhov,
Tony Lindgren, Lee Jones, linux-gpio, linux-kernel, linux-input,
linux-leds, linux-arm-kernel, linux-usb
Cc: Linus Walleij, Bartosz Golaszewski, Pavel Machek,
Dominik Brodowski, Daniel Mack, Haojian Zhuang, Robert Jarzmik,
Greg Kroah-Hartman
Avoid using GPIOF_ACTIVE_LOW as it's deprecated and subject to remove.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/input/keyboard/gpio_keys.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index 380fe8dab3b0..5eef66516e37 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -531,12 +531,7 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
* Legacy GPIO number, so request the GPIO here and
* convert it to descriptor.
*/
- unsigned flags = GPIOF_IN;
-
- if (button->active_low)
- flags |= GPIOF_ACTIVE_LOW;
-
- error = devm_gpio_request_one(dev, button->gpio, flags, desc);
+ error = devm_gpio_request_one(dev, button->gpio, GPIOF_IN, desc);
if (error < 0) {
dev_err(dev, "Failed to request GPIO %d, error %d\n",
button->gpio, error);
@@ -546,6 +541,9 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
bdata->gpiod = gpio_to_desc(button->gpio);
if (!bdata->gpiod)
return -EINVAL;
+
+ if (button->active_low ^ gpiod_is_active_low(bdata->gpiod))
+ gpiod_toggle_active_low(bdata->gpiod);
}
if (bdata->gpiod) {
--
2.43.0.rc1.1336.g36b5255a03ac
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH v1 2/6] Input: gpio_keys_polled - avoid using GPIOF_ACTIVE_LOW
2024-11-04 9:34 [PATCH v1 0/6] gpio: Get rid of deprecated GPIOF_ACTIVE_LOW Andy Shevchenko
2024-11-04 9:34 ` [PATCH v1 1/6] Input: gpio_keys - avoid using GPIOF_ACTIVE_LOW Andy Shevchenko
@ 2024-11-04 9:34 ` Andy Shevchenko
2024-11-05 5:45 ` Dmitry Torokhov
2024-11-08 8:33 ` Linus Walleij
2024-11-04 9:34 ` [PATCH v1 3/6] leds: gpio: Avoid " Andy Shevchenko
` (5 subsequent siblings)
7 siblings, 2 replies; 26+ messages in thread
From: Andy Shevchenko @ 2024-11-04 9:34 UTC (permalink / raw)
To: Andy Shevchenko, Bartosz Golaszewski, Dmitry Torokhov,
Tony Lindgren, Lee Jones, linux-gpio, linux-kernel, linux-input,
linux-leds, linux-arm-kernel, linux-usb
Cc: Linus Walleij, Bartosz Golaszewski, Pavel Machek,
Dominik Brodowski, Daniel Mack, Haojian Zhuang, Robert Jarzmik,
Greg Kroah-Hartman
Avoid using GPIOF_ACTIVE_LOW as it's deprecated and subject to remove.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/input/keyboard/gpio_keys_polled.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/drivers/input/keyboard/gpio_keys_polled.c b/drivers/input/keyboard/gpio_keys_polled.c
index 41ca0d3c9098..e6707d72210e 100644
--- a/drivers/input/keyboard/gpio_keys_polled.c
+++ b/drivers/input/keyboard/gpio_keys_polled.c
@@ -306,13 +306,8 @@ static int gpio_keys_polled_probe(struct platform_device *pdev)
* Legacy GPIO number so request the GPIO here and
* convert it to descriptor.
*/
- unsigned flags = GPIOF_IN;
-
- if (button->active_low)
- flags |= GPIOF_ACTIVE_LOW;
-
- error = devm_gpio_request_one(dev, button->gpio,
- flags, button->desc ? : DRV_NAME);
+ error = devm_gpio_request_one(dev, button->gpio, GPIOF_IN,
+ button->desc ? : DRV_NAME);
if (error)
return dev_err_probe(dev, error,
"unable to claim gpio %u\n",
@@ -325,6 +320,9 @@ static int gpio_keys_polled_probe(struct platform_device *pdev)
button->gpio);
return -EINVAL;
}
+
+ if (button->active_low ^ gpiod_is_active_low(bdata->gpiod))
+ gpiod_toggle_active_low(bdata->gpiod);
}
bdata->last_state = -1;
--
2.43.0.rc1.1336.g36b5255a03ac
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH v1 3/6] leds: gpio: Avoid using GPIOF_ACTIVE_LOW
2024-11-04 9:34 [PATCH v1 0/6] gpio: Get rid of deprecated GPIOF_ACTIVE_LOW Andy Shevchenko
2024-11-04 9:34 ` [PATCH v1 1/6] Input: gpio_keys - avoid using GPIOF_ACTIVE_LOW Andy Shevchenko
2024-11-04 9:34 ` [PATCH v1 2/6] Input: gpio_keys_polled " Andy Shevchenko
@ 2024-11-04 9:34 ` Andy Shevchenko
2024-11-06 9:55 ` Lee Jones
` (2 more replies)
2024-11-04 9:34 ` [PATCH v1 4/6] pcmcia: soc_common: " Andy Shevchenko
` (4 subsequent siblings)
7 siblings, 3 replies; 26+ messages in thread
From: Andy Shevchenko @ 2024-11-04 9:34 UTC (permalink / raw)
To: Andy Shevchenko, Bartosz Golaszewski, Dmitry Torokhov,
Tony Lindgren, Lee Jones, linux-gpio, linux-kernel, linux-input,
linux-leds, linux-arm-kernel, linux-usb
Cc: Linus Walleij, Bartosz Golaszewski, Pavel Machek,
Dominik Brodowski, Daniel Mack, Haojian Zhuang, Robert Jarzmik,
Greg Kroah-Hartman
Avoid using GPIOF_ACTIVE_LOW as it's deprecated and subject to remove.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/leds/leds-gpio.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
index 0d59b0bbc002..a3428b22de3a 100644
--- a/drivers/leds/leds-gpio.c
+++ b/drivers/leds/leds-gpio.c
@@ -212,7 +212,6 @@ static struct gpio_desc *gpio_led_get_gpiod(struct device *dev, int idx,
const struct gpio_led *template)
{
struct gpio_desc *gpiod;
- unsigned long flags = GPIOF_OUT_INIT_LOW;
int ret;
/*
@@ -239,10 +238,7 @@ static struct gpio_desc *gpio_led_get_gpiod(struct device *dev, int idx,
if (!gpio_is_valid(template->gpio))
return ERR_PTR(-ENOENT);
- if (template->active_low)
- flags |= GPIOF_ACTIVE_LOW;
-
- ret = devm_gpio_request_one(dev, template->gpio, flags,
+ ret = devm_gpio_request_one(dev, template->gpio, GPIOF_OUT_INIT_LOW,
template->name);
if (ret < 0)
return ERR_PTR(ret);
@@ -251,6 +247,9 @@ static struct gpio_desc *gpio_led_get_gpiod(struct device *dev, int idx,
if (!gpiod)
return ERR_PTR(-EINVAL);
+ if (template->active_low ^ gpiod_is_active_low(gpiod))
+ gpiod_toggle_active_low(gpiod);
+
return gpiod;
}
--
2.43.0.rc1.1336.g36b5255a03ac
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH v1 4/6] pcmcia: soc_common: Avoid using GPIOF_ACTIVE_LOW
2024-11-04 9:34 [PATCH v1 0/6] gpio: Get rid of deprecated GPIOF_ACTIVE_LOW Andy Shevchenko
` (2 preceding siblings ...)
2024-11-04 9:34 ` [PATCH v1 3/6] leds: gpio: Avoid " Andy Shevchenko
@ 2024-11-04 9:34 ` Andy Shevchenko
2024-11-08 8:28 ` Linus Walleij
2024-11-04 9:34 ` [PATCH v1 5/6] USB: gadget: pxa27x_udc: " Andy Shevchenko
` (3 subsequent siblings)
7 siblings, 1 reply; 26+ messages in thread
From: Andy Shevchenko @ 2024-11-04 9:34 UTC (permalink / raw)
To: Andy Shevchenko, Bartosz Golaszewski, Dmitry Torokhov,
Tony Lindgren, Lee Jones, linux-gpio, linux-kernel, linux-input,
linux-leds, linux-arm-kernel, linux-usb
Cc: Linus Walleij, Bartosz Golaszewski, Pavel Machek,
Dominik Brodowski, Daniel Mack, Haojian Zhuang, Robert Jarzmik,
Greg Kroah-Hartman
Avoid using GPIOF_ACTIVE_LOW as it's deprecated and subject to remove.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/pcmcia/soc_common.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/drivers/pcmcia/soc_common.c b/drivers/pcmcia/soc_common.c
index 61b0c8952bb5..1deb9960db34 100644
--- a/drivers/pcmcia/soc_common.c
+++ b/drivers/pcmcia/soc_common.c
@@ -204,14 +204,8 @@ static int soc_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
for (i = 0; i < ARRAY_SIZE(skt->stat); i++) {
if (gpio_is_valid(skt->stat[i].gpio)) {
- unsigned long flags = GPIOF_IN;
-
- /* CD is active low by default */
- if (i == SOC_STAT_CD)
- flags |= GPIOF_ACTIVE_LOW;
-
ret = devm_gpio_request_one(skt->socket.dev.parent,
- skt->stat[i].gpio, flags,
+ skt->stat[i].gpio, GPIOF_IN,
skt->stat[i].name);
if (ret) {
__soc_pcmcia_hw_shutdown(skt, i);
@@ -219,6 +213,10 @@ static int soc_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
}
skt->stat[i].desc = gpio_to_desc(skt->stat[i].gpio);
+
+ /* CD is active low by default */
+ if ((i == SOC_STAT_CD) ^ gpiod_is_active_low(skt->stat[i].desc))
+ gpiod_toggle_active_low(skt->stat[i].desc);
}
if (i < SOC_STAT_VS1 && skt->stat[i].desc) {
--
2.43.0.rc1.1336.g36b5255a03ac
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH v1 5/6] USB: gadget: pxa27x_udc: Avoid using GPIOF_ACTIVE_LOW
2024-11-04 9:34 [PATCH v1 0/6] gpio: Get rid of deprecated GPIOF_ACTIVE_LOW Andy Shevchenko
` (3 preceding siblings ...)
2024-11-04 9:34 ` [PATCH v1 4/6] pcmcia: soc_common: " Andy Shevchenko
@ 2024-11-04 9:34 ` Andy Shevchenko
2024-11-05 12:26 ` Greg Kroah-Hartman
2024-11-08 8:34 ` Linus Walleij
2024-11-04 9:34 ` [PATCH v1 6/6] gpio: Get rid of GPIOF_ACTIVE_LOW Andy Shevchenko
` (2 subsequent siblings)
7 siblings, 2 replies; 26+ messages in thread
From: Andy Shevchenko @ 2024-11-04 9:34 UTC (permalink / raw)
To: Andy Shevchenko, Bartosz Golaszewski, Dmitry Torokhov,
Tony Lindgren, Lee Jones, linux-gpio, linux-kernel, linux-input,
linux-leds, linux-arm-kernel, linux-usb
Cc: Linus Walleij, Bartosz Golaszewski, Pavel Machek,
Dominik Brodowski, Daniel Mack, Haojian Zhuang, Robert Jarzmik,
Greg Kroah-Hartman
Avoid using GPIOF_ACTIVE_LOW as it's deprecated and subject to remove.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/usb/gadget/udc/pxa27x_udc.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/gadget/udc/pxa27x_udc.c b/drivers/usb/gadget/udc/pxa27x_udc.c
index 7d3a8a5f3796..f9a55d4f189f 100644
--- a/drivers/usb/gadget/udc/pxa27x_udc.c
+++ b/drivers/usb/gadget/udc/pxa27x_udc.c
@@ -2355,18 +2355,19 @@ static int pxa_udc_probe(struct platform_device *pdev)
struct pxa_udc *udc = &memory;
int retval = 0, gpio;
struct pxa2xx_udc_mach_info *mach = dev_get_platdata(&pdev->dev);
- unsigned long gpio_flags;
if (mach) {
- gpio_flags = mach->gpio_pullup_inverted ? GPIOF_ACTIVE_LOW : 0;
gpio = mach->gpio_pullup;
if (gpio_is_valid(gpio)) {
retval = devm_gpio_request_one(&pdev->dev, gpio,
- gpio_flags,
+ GPIOF_OUT_INIT_LOW,
"USB D+ pullup");
if (retval)
return retval;
udc->gpiod = gpio_to_desc(mach->gpio_pullup);
+
+ if (mach->gpio_pullup_inverted ^ gpiod_is_active_low(udc->gpiod))
+ gpiod_toggle_active_low(udc->gpiod);
}
udc->udc_command = mach->udc_command;
} else {
--
2.43.0.rc1.1336.g36b5255a03ac
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH v1 6/6] gpio: Get rid of GPIOF_ACTIVE_LOW
2024-11-04 9:34 [PATCH v1 0/6] gpio: Get rid of deprecated GPIOF_ACTIVE_LOW Andy Shevchenko
` (4 preceding siblings ...)
2024-11-04 9:34 ` [PATCH v1 5/6] USB: gadget: pxa27x_udc: " Andy Shevchenko
@ 2024-11-04 9:34 ` Andy Shevchenko
2024-11-08 8:29 ` Linus Walleij
2024-11-06 11:15 ` [PATCH v1 0/6] gpio: Get rid of deprecated GPIOF_ACTIVE_LOW Andy Shevchenko
2024-11-09 13:56 ` Bartosz Golaszewski
7 siblings, 1 reply; 26+ messages in thread
From: Andy Shevchenko @ 2024-11-04 9:34 UTC (permalink / raw)
To: Andy Shevchenko, Bartosz Golaszewski, Dmitry Torokhov,
Tony Lindgren, Lee Jones, linux-gpio, linux-kernel, linux-input,
linux-leds, linux-arm-kernel, linux-usb
Cc: Linus Walleij, Bartosz Golaszewski, Pavel Machek,
Dominik Brodowski, Daniel Mack, Haojian Zhuang, Robert Jarzmik,
Greg Kroah-Hartman
No more users.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/gpio/gpiolib-legacy.c | 3 ---
include/linux/gpio.h | 3 ---
2 files changed, 6 deletions(-)
diff --git a/drivers/gpio/gpiolib-legacy.c b/drivers/gpio/gpiolib-legacy.c
index 28f1046fb670..aeae6df8bec9 100644
--- a/drivers/gpio/gpiolib-legacy.c
+++ b/drivers/gpio/gpiolib-legacy.c
@@ -46,9 +46,6 @@ int gpio_request_one(unsigned gpio, unsigned long flags, const char *label)
if (err)
return err;
- if (flags & GPIOF_ACTIVE_LOW)
- set_bit(FLAG_ACTIVE_LOW, &desc->flags);
-
if (flags & GPIOF_IN)
err = gpiod_direction_input(desc);
else
diff --git a/include/linux/gpio.h b/include/linux/gpio.h
index 2d105be7bbc3..6270150f4e29 100644
--- a/include/linux/gpio.h
+++ b/include/linux/gpio.h
@@ -21,9 +21,6 @@ struct device;
#define GPIOF_OUT_INIT_LOW ((0 << 0) | (0 << 1))
#define GPIOF_OUT_INIT_HIGH ((0 << 0) | (1 << 1))
-/* Gpio pin is active-low */
-#define GPIOF_ACTIVE_LOW (1 << 2)
-
/**
* struct gpio - a structure describing a GPIO with configuration
* @gpio: the GPIO number
--
2.43.0.rc1.1336.g36b5255a03ac
^ permalink raw reply related [flat|nested] 26+ messages in thread
* Re: [PATCH v1 1/6] Input: gpio_keys - avoid using GPIOF_ACTIVE_LOW
2024-11-04 9:34 ` [PATCH v1 1/6] Input: gpio_keys - avoid using GPIOF_ACTIVE_LOW Andy Shevchenko
@ 2024-11-05 5:44 ` Dmitry Torokhov
2024-11-08 8:33 ` Linus Walleij
1 sibling, 0 replies; 26+ messages in thread
From: Dmitry Torokhov @ 2024-11-05 5:44 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Bartosz Golaszewski, Tony Lindgren, Lee Jones, linux-gpio,
linux-kernel, linux-input, linux-leds, linux-arm-kernel,
linux-usb, Linus Walleij, Bartosz Golaszewski, Pavel Machek,
Dominik Brodowski, Daniel Mack, Haojian Zhuang, Robert Jarzmik,
Greg Kroah-Hartman
On Mon, Nov 04, 2024 at 11:34:19AM +0200, Andy Shevchenko wrote:
> Avoid using GPIOF_ACTIVE_LOW as it's deprecated and subject to remove.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
> drivers/input/keyboard/gpio_keys.c | 10 ++++------
> 1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
> index 380fe8dab3b0..5eef66516e37 100644
> --- a/drivers/input/keyboard/gpio_keys.c
> +++ b/drivers/input/keyboard/gpio_keys.c
> @@ -531,12 +531,7 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
> * Legacy GPIO number, so request the GPIO here and
> * convert it to descriptor.
> */
> - unsigned flags = GPIOF_IN;
> -
> - if (button->active_low)
> - flags |= GPIOF_ACTIVE_LOW;
> -
> - error = devm_gpio_request_one(dev, button->gpio, flags, desc);
> + error = devm_gpio_request_one(dev, button->gpio, GPIOF_IN, desc);
> if (error < 0) {
> dev_err(dev, "Failed to request GPIO %d, error %d\n",
> button->gpio, error);
> @@ -546,6 +541,9 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
> bdata->gpiod = gpio_to_desc(button->gpio);
> if (!bdata->gpiod)
> return -EINVAL;
> +
> + if (button->active_low ^ gpiod_is_active_low(bdata->gpiod))
> + gpiod_toggle_active_low(bdata->gpiod);
> }
>
> if (bdata->gpiod) {
> --
> 2.43.0.rc1.1336.g36b5255a03ac
>
--
Dmitry
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v1 2/6] Input: gpio_keys_polled - avoid using GPIOF_ACTIVE_LOW
2024-11-04 9:34 ` [PATCH v1 2/6] Input: gpio_keys_polled " Andy Shevchenko
@ 2024-11-05 5:45 ` Dmitry Torokhov
2024-11-08 8:33 ` Linus Walleij
1 sibling, 0 replies; 26+ messages in thread
From: Dmitry Torokhov @ 2024-11-05 5:45 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Bartosz Golaszewski, Tony Lindgren, Lee Jones, linux-gpio,
linux-kernel, linux-input, linux-leds, linux-arm-kernel,
linux-usb, Linus Walleij, Bartosz Golaszewski, Pavel Machek,
Dominik Brodowski, Daniel Mack, Haojian Zhuang, Robert Jarzmik,
Greg Kroah-Hartman
On Mon, Nov 04, 2024 at 11:34:20AM +0200, Andy Shevchenko wrote:
> Avoid using GPIOF_ACTIVE_LOW as it's deprecated and subject to remove.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
> drivers/input/keyboard/gpio_keys_polled.c | 12 +++++-------
> 1 file changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/input/keyboard/gpio_keys_polled.c b/drivers/input/keyboard/gpio_keys_polled.c
> index 41ca0d3c9098..e6707d72210e 100644
> --- a/drivers/input/keyboard/gpio_keys_polled.c
> +++ b/drivers/input/keyboard/gpio_keys_polled.c
> @@ -306,13 +306,8 @@ static int gpio_keys_polled_probe(struct platform_device *pdev)
> * Legacy GPIO number so request the GPIO here and
> * convert it to descriptor.
> */
> - unsigned flags = GPIOF_IN;
> -
> - if (button->active_low)
> - flags |= GPIOF_ACTIVE_LOW;
> -
> - error = devm_gpio_request_one(dev, button->gpio,
> - flags, button->desc ? : DRV_NAME);
> + error = devm_gpio_request_one(dev, button->gpio, GPIOF_IN,
> + button->desc ? : DRV_NAME);
> if (error)
> return dev_err_probe(dev, error,
> "unable to claim gpio %u\n",
> @@ -325,6 +320,9 @@ static int gpio_keys_polled_probe(struct platform_device *pdev)
> button->gpio);
> return -EINVAL;
> }
> +
> + if (button->active_low ^ gpiod_is_active_low(bdata->gpiod))
> + gpiod_toggle_active_low(bdata->gpiod);
> }
>
> bdata->last_state = -1;
> --
> 2.43.0.rc1.1336.g36b5255a03ac
>
--
Dmitry
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v1 5/6] USB: gadget: pxa27x_udc: Avoid using GPIOF_ACTIVE_LOW
2024-11-04 9:34 ` [PATCH v1 5/6] USB: gadget: pxa27x_udc: " Andy Shevchenko
@ 2024-11-05 12:26 ` Greg Kroah-Hartman
2024-11-08 8:34 ` Linus Walleij
1 sibling, 0 replies; 26+ messages in thread
From: Greg Kroah-Hartman @ 2024-11-05 12:26 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Bartosz Golaszewski, Dmitry Torokhov, Tony Lindgren, Lee Jones,
linux-gpio, linux-kernel, linux-input, linux-leds,
linux-arm-kernel, linux-usb, Linus Walleij, Bartosz Golaszewski,
Pavel Machek, Dominik Brodowski, Daniel Mack, Haojian Zhuang,
Robert Jarzmik
On Mon, Nov 04, 2024 at 11:34:23AM +0200, Andy Shevchenko wrote:
> Avoid using GPIOF_ACTIVE_LOW as it's deprecated and subject to remove.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> drivers/usb/gadget/udc/pxa27x_udc.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v1 3/6] leds: gpio: Avoid using GPIOF_ACTIVE_LOW
2024-11-04 9:34 ` [PATCH v1 3/6] leds: gpio: Avoid " Andy Shevchenko
@ 2024-11-06 9:55 ` Lee Jones
2024-11-08 8:37 ` Linus Walleij
2024-11-11 9:45 ` Geert Uytterhoeven
2 siblings, 0 replies; 26+ messages in thread
From: Lee Jones @ 2024-11-06 9:55 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Bartosz Golaszewski, Dmitry Torokhov, Tony Lindgren, linux-gpio,
linux-kernel, linux-input, linux-leds, linux-arm-kernel,
linux-usb, Linus Walleij, Bartosz Golaszewski, Pavel Machek,
Dominik Brodowski, Daniel Mack, Haojian Zhuang, Robert Jarzmik,
Greg Kroah-Hartman
On Mon, 04 Nov 2024, Andy Shevchenko wrote:
> Avoid using GPIOF_ACTIVE_LOW as it's deprecated and subject to remove.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> drivers/leds/leds-gpio.c | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
Acked-by: Lee Jones <lee@kernel.org>
> diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
> index 0d59b0bbc002..a3428b22de3a 100644
> --- a/drivers/leds/leds-gpio.c
> +++ b/drivers/leds/leds-gpio.c
> @@ -212,7 +212,6 @@ static struct gpio_desc *gpio_led_get_gpiod(struct device *dev, int idx,
> const struct gpio_led *template)
> {
> struct gpio_desc *gpiod;
> - unsigned long flags = GPIOF_OUT_INIT_LOW;
> int ret;
>
> /*
> @@ -239,10 +238,7 @@ static struct gpio_desc *gpio_led_get_gpiod(struct device *dev, int idx,
> if (!gpio_is_valid(template->gpio))
> return ERR_PTR(-ENOENT);
>
> - if (template->active_low)
> - flags |= GPIOF_ACTIVE_LOW;
> -
> - ret = devm_gpio_request_one(dev, template->gpio, flags,
> + ret = devm_gpio_request_one(dev, template->gpio, GPIOF_OUT_INIT_LOW,
> template->name);
> if (ret < 0)
> return ERR_PTR(ret);
> @@ -251,6 +247,9 @@ static struct gpio_desc *gpio_led_get_gpiod(struct device *dev, int idx,
> if (!gpiod)
> return ERR_PTR(-EINVAL);
>
> + if (template->active_low ^ gpiod_is_active_low(gpiod))
> + gpiod_toggle_active_low(gpiod);
> +
> return gpiod;
> }
>
> --
> 2.43.0.rc1.1336.g36b5255a03ac
>
--
Lee Jones [李琼斯]
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v1 0/6] gpio: Get rid of deprecated GPIOF_ACTIVE_LOW
2024-11-04 9:34 [PATCH v1 0/6] gpio: Get rid of deprecated GPIOF_ACTIVE_LOW Andy Shevchenko
` (5 preceding siblings ...)
2024-11-04 9:34 ` [PATCH v1 6/6] gpio: Get rid of GPIOF_ACTIVE_LOW Andy Shevchenko
@ 2024-11-06 11:15 ` Andy Shevchenko
2024-11-06 13:43 ` Bartosz Golaszewski
2024-11-09 13:56 ` Bartosz Golaszewski
7 siblings, 1 reply; 26+ messages in thread
From: Andy Shevchenko @ 2024-11-06 11:15 UTC (permalink / raw)
To: Bartosz Golaszewski, Dmitry Torokhov, Tony Lindgren, Lee Jones,
linux-gpio, linux-kernel, linux-input, linux-leds,
linux-arm-kernel, linux-usb
Cc: Linus Walleij, Bartosz Golaszewski, Pavel Machek,
Dominik Brodowski, Daniel Mack, Haojian Zhuang, Robert Jarzmik,
Greg Kroah-Hartman
On Mon, Nov 04, 2024 at 11:34:18AM +0200, Andy Shevchenko wrote:
> This series targets the deprecated GPIOF_ACTIVE_LOW as only a few users
> left. Convert those users to call modern APIs and drop this legacy piece
> from the source tree.
>
> The idea is to route this via GPIO tree, please Ack.
Thank you for Acks, folks!
Dominik, is it possible to get yours or are you inactive nowadays (I saw
last mention of your name ca. 2023).
Bart, we have all Acks except pcmcia (see also above), and the change is
the same all over the places, do you think it's okay to apply if Dominik
won't respond for a few days?
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v1 0/6] gpio: Get rid of deprecated GPIOF_ACTIVE_LOW
2024-11-06 11:15 ` [PATCH v1 0/6] gpio: Get rid of deprecated GPIOF_ACTIVE_LOW Andy Shevchenko
@ 2024-11-06 13:43 ` Bartosz Golaszewski
0 siblings, 0 replies; 26+ messages in thread
From: Bartosz Golaszewski @ 2024-11-06 13:43 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Bartosz Golaszewski, Dmitry Torokhov, Tony Lindgren, Lee Jones,
linux-gpio, linux-kernel, linux-input, linux-leds,
linux-arm-kernel, linux-usb, Linus Walleij, Pavel Machek,
Dominik Brodowski, Daniel Mack, Haojian Zhuang, Robert Jarzmik,
Greg Kroah-Hartman
On Wed, Nov 6, 2024 at 12:15 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Mon, Nov 04, 2024 at 11:34:18AM +0200, Andy Shevchenko wrote:
> > This series targets the deprecated GPIOF_ACTIVE_LOW as only a few users
> > left. Convert those users to call modern APIs and drop this legacy piece
> > from the source tree.
> >
> > The idea is to route this via GPIO tree, please Ack.
>
> Thank you for Acks, folks!
>
> Dominik, is it possible to get yours or are you inactive nowadays (I saw
> last mention of your name ca. 2023).
>
> Bart, we have all Acks except pcmcia (see also above), and the change is
> the same all over the places, do you think it's okay to apply if Dominik
> won't respond for a few days?
>
If we don't get an ack until Friday, I will take it as is.
Bart
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v1 4/6] pcmcia: soc_common: Avoid using GPIOF_ACTIVE_LOW
2024-11-04 9:34 ` [PATCH v1 4/6] pcmcia: soc_common: " Andy Shevchenko
@ 2024-11-08 8:28 ` Linus Walleij
2024-11-08 8:35 ` Andy Shevchenko
0 siblings, 1 reply; 26+ messages in thread
From: Linus Walleij @ 2024-11-08 8:28 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Bartosz Golaszewski, Dmitry Torokhov, Tony Lindgren, Lee Jones,
linux-gpio, linux-kernel, linux-input, linux-leds,
linux-arm-kernel, linux-usb, Bartosz Golaszewski, Pavel Machek,
Dominik Brodowski, Daniel Mack, Haojian Zhuang, Robert Jarzmik,
Greg Kroah-Hartman
On Mon, Nov 4, 2024 at 10:36 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> Avoid using GPIOF_ACTIVE_LOW as it's deprecated and subject to remove.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Looks right to me, some testing would be even better
because I never trust these flags to get right.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v1 6/6] gpio: Get rid of GPIOF_ACTIVE_LOW
2024-11-04 9:34 ` [PATCH v1 6/6] gpio: Get rid of GPIOF_ACTIVE_LOW Andy Shevchenko
@ 2024-11-08 8:29 ` Linus Walleij
0 siblings, 0 replies; 26+ messages in thread
From: Linus Walleij @ 2024-11-08 8:29 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Bartosz Golaszewski, Dmitry Torokhov, Tony Lindgren, Lee Jones,
linux-gpio, linux-kernel, linux-input, linux-leds,
linux-arm-kernel, linux-usb, Bartosz Golaszewski, Pavel Machek,
Dominik Brodowski, Daniel Mack, Haojian Zhuang, Robert Jarzmik,
Greg Kroah-Hartman
On Mon, Nov 4, 2024 at 10:36 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> No more users.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
If the series flies, by all means:
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Thanks for working on this!
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v1 1/6] Input: gpio_keys - avoid using GPIOF_ACTIVE_LOW
2024-11-04 9:34 ` [PATCH v1 1/6] Input: gpio_keys - avoid using GPIOF_ACTIVE_LOW Andy Shevchenko
2024-11-05 5:44 ` Dmitry Torokhov
@ 2024-11-08 8:33 ` Linus Walleij
1 sibling, 0 replies; 26+ messages in thread
From: Linus Walleij @ 2024-11-08 8:33 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Bartosz Golaszewski, Dmitry Torokhov, Tony Lindgren, Lee Jones,
linux-gpio, linux-kernel, linux-input, linux-leds,
linux-arm-kernel, linux-usb, Bartosz Golaszewski, Pavel Machek,
Dominik Brodowski, Daniel Mack, Haojian Zhuang, Robert Jarzmik,
Greg Kroah-Hartman
On Mon, Nov 4, 2024 at 10:36 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> Avoid using GPIOF_ACTIVE_LOW as it's deprecated and subject to remove.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v1 2/6] Input: gpio_keys_polled - avoid using GPIOF_ACTIVE_LOW
2024-11-04 9:34 ` [PATCH v1 2/6] Input: gpio_keys_polled " Andy Shevchenko
2024-11-05 5:45 ` Dmitry Torokhov
@ 2024-11-08 8:33 ` Linus Walleij
1 sibling, 0 replies; 26+ messages in thread
From: Linus Walleij @ 2024-11-08 8:33 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Bartosz Golaszewski, Dmitry Torokhov, Tony Lindgren, Lee Jones,
linux-gpio, linux-kernel, linux-input, linux-leds,
linux-arm-kernel, linux-usb, Bartosz Golaszewski, Pavel Machek,
Dominik Brodowski, Daniel Mack, Haojian Zhuang, Robert Jarzmik,
Greg Kroah-Hartman
On Mon, Nov 4, 2024 at 10:36 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> Avoid using GPIOF_ACTIVE_LOW as it's deprecated and subject to remove.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v1 5/6] USB: gadget: pxa27x_udc: Avoid using GPIOF_ACTIVE_LOW
2024-11-04 9:34 ` [PATCH v1 5/6] USB: gadget: pxa27x_udc: " Andy Shevchenko
2024-11-05 12:26 ` Greg Kroah-Hartman
@ 2024-11-08 8:34 ` Linus Walleij
1 sibling, 0 replies; 26+ messages in thread
From: Linus Walleij @ 2024-11-08 8:34 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Bartosz Golaszewski, Dmitry Torokhov, Tony Lindgren, Lee Jones,
linux-gpio, linux-kernel, linux-input, linux-leds,
linux-arm-kernel, linux-usb, Bartosz Golaszewski, Pavel Machek,
Dominik Brodowski, Daniel Mack, Haojian Zhuang, Robert Jarzmik,
Greg Kroah-Hartman
On Mon, Nov 4, 2024 at 10:36 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> Avoid using GPIOF_ACTIVE_LOW as it's deprecated and subject to remove.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v1 4/6] pcmcia: soc_common: Avoid using GPIOF_ACTIVE_LOW
2024-11-08 8:28 ` Linus Walleij
@ 2024-11-08 8:35 ` Andy Shevchenko
2024-11-09 6:40 ` Dominik Brodowski
0 siblings, 1 reply; 26+ messages in thread
From: Andy Shevchenko @ 2024-11-08 8:35 UTC (permalink / raw)
To: Linus Walleij
Cc: Bartosz Golaszewski, Dmitry Torokhov, Tony Lindgren, Lee Jones,
linux-gpio, linux-kernel, linux-input, linux-leds,
linux-arm-kernel, linux-usb, Bartosz Golaszewski, Pavel Machek,
Dominik Brodowski, Daniel Mack, Haojian Zhuang, Robert Jarzmik,
Greg Kroah-Hartman
On Fri, Nov 08, 2024 at 09:28:19AM +0100, Linus Walleij wrote:
> On Mon, Nov 4, 2024 at 10:36 AM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
>
> > Avoid using GPIOF_ACTIVE_LOW as it's deprecated and subject to remove.
> >
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>
> Looks right to me, some testing would be even better
> because I never trust these flags to get right.
I also would like to have this, but seems the only odd fixer was active ca.
2023 last time, I'm not sure we may hear from Dominik in time, otherwise the
series will be postponed for unknown period of time, which I do not prefer,
rather I will fix any regressions later (but I doubt there are here).
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v1 3/6] leds: gpio: Avoid using GPIOF_ACTIVE_LOW
2024-11-04 9:34 ` [PATCH v1 3/6] leds: gpio: Avoid " Andy Shevchenko
2024-11-06 9:55 ` Lee Jones
@ 2024-11-08 8:37 ` Linus Walleij
2024-11-11 9:45 ` Geert Uytterhoeven
2 siblings, 0 replies; 26+ messages in thread
From: Linus Walleij @ 2024-11-08 8:37 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Bartosz Golaszewski, Dmitry Torokhov, Tony Lindgren, Lee Jones,
linux-gpio, linux-kernel, linux-input, linux-leds,
linux-arm-kernel, linux-usb, Bartosz Golaszewski, Pavel Machek,
Dominik Brodowski, Daniel Mack, Haojian Zhuang, Robert Jarzmik,
Greg Kroah-Hartman
On Mon, Nov 4, 2024 at 10:36 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> Avoid using GPIOF_ACTIVE_LOW as it's deprecated and subject to remove.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v1 4/6] pcmcia: soc_common: Avoid using GPIOF_ACTIVE_LOW
2024-11-08 8:35 ` Andy Shevchenko
@ 2024-11-09 6:40 ` Dominik Brodowski
2024-11-11 7:31 ` Andy Shevchenko
0 siblings, 1 reply; 26+ messages in thread
From: Dominik Brodowski @ 2024-11-09 6:40 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Linus Walleij, Bartosz Golaszewski, Dmitry Torokhov,
Tony Lindgren, Lee Jones, linux-gpio, linux-kernel, linux-input,
linux-leds, linux-arm-kernel, linux-usb, Bartosz Golaszewski,
Pavel Machek, Daniel Mack, Haojian Zhuang, Robert Jarzmik,
Greg Kroah-Hartman
Am Fri, Nov 08, 2024 at 10:35:41AM +0200 schrieb Andy Shevchenko:
> On Fri, Nov 08, 2024 at 09:28:19AM +0100, Linus Walleij wrote:
> > On Mon, Nov 4, 2024 at 10:36 AM Andy Shevchenko
> > <andriy.shevchenko@linux.intel.com> wrote:
> >
> > > Avoid using GPIOF_ACTIVE_LOW as it's deprecated and subject to remove.
> > >
> > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> >
> > Looks right to me, some testing would be even better
> > because I never trust these flags to get right.
>
> I also would like to have this, but seems the only odd fixer was active ca.
> 2023 last time, I'm not sure we may hear from Dominik in time, otherwise the
> series will be postponed for unknown period of time, which I do not prefer,
> rather I will fix any regressions later (but I doubt there are here).
As I don't have such hardware, I cannot help with testing, but from the
PCMCIA point of view:
Acked-by: Dominik Brodowski <linux@dominikbrodowski.net>
Thanks,
Dominik
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v1 0/6] gpio: Get rid of deprecated GPIOF_ACTIVE_LOW
2024-11-04 9:34 [PATCH v1 0/6] gpio: Get rid of deprecated GPIOF_ACTIVE_LOW Andy Shevchenko
` (6 preceding siblings ...)
2024-11-06 11:15 ` [PATCH v1 0/6] gpio: Get rid of deprecated GPIOF_ACTIVE_LOW Andy Shevchenko
@ 2024-11-09 13:56 ` Bartosz Golaszewski
7 siblings, 0 replies; 26+ messages in thread
From: Bartosz Golaszewski @ 2024-11-09 13:56 UTC (permalink / raw)
To: Dmitry Torokhov, Tony Lindgren, Lee Jones, linux-gpio,
linux-kernel, linux-input, linux-leds, linux-arm-kernel,
linux-usb, Andy Shevchenko
Cc: Bartosz Golaszewski, Linus Walleij, Bartosz Golaszewski,
Pavel Machek, Dominik Brodowski, Daniel Mack, Haojian Zhuang,
Robert Jarzmik, Greg Kroah-Hartman
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
On Mon, 04 Nov 2024 11:34:18 +0200, Andy Shevchenko wrote:
> This series targets the deprecated GPIOF_ACTIVE_LOW as only a few users
> left. Convert those users to call modern APIs and drop this legacy piece
> from the source tree.
>
> The idea is to route this via GPIO tree, please Ack.
>
> Andy Shevchenko (6):
> Input: gpio_keys - avoid using GPIOF_ACTIVE_LOW
> Input: gpio_keys_polled - avoid using GPIOF_ACTIVE_LOW
> leds: gpio: Avoid using GPIOF_ACTIVE_LOW
> pcmcia: soc_common: Avoid using GPIOF_ACTIVE_LOW
> USB: gadget: pxa27x_udc: Avoid using GPIOF_ACTIVE_LOW
> gpio: Get rid of GPIOF_ACTIVE_LOW
>
> [...]
Applied, thanks!
[1/6] Input: gpio_keys - avoid using GPIOF_ACTIVE_LOW
commit: a04abf25fb1ac47dd2bf1e1b7ca24ca78688b175
[2/6] Input: gpio_keys_polled - avoid using GPIOF_ACTIVE_LOW
commit: 081aaf2dfcfa10fa5cb5444b77b154cce4355708
[3/6] leds: gpio: Avoid using GPIOF_ACTIVE_LOW
commit: e6a2f0ea519fd2478920d02ce3de07a14fe36b2f
[4/6] pcmcia: soc_common: Avoid using GPIOF_ACTIVE_LOW
commit: 15998583b19749e63c5cd0431a2517f524352762
[5/6] USB: gadget: pxa27x_udc: Avoid using GPIOF_ACTIVE_LOW
commit: 62d2a940f29e6aa5a1d844a90820ca6240a99b34
[6/6] gpio: Get rid of GPIOF_ACTIVE_LOW
commit: fffb9fff12250018a6f4d3e411f9d289210da329
Best regards,
--
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v1 4/6] pcmcia: soc_common: Avoid using GPIOF_ACTIVE_LOW
2024-11-09 6:40 ` Dominik Brodowski
@ 2024-11-11 7:31 ` Andy Shevchenko
0 siblings, 0 replies; 26+ messages in thread
From: Andy Shevchenko @ 2024-11-11 7:31 UTC (permalink / raw)
To: Dominik Brodowski
Cc: Linus Walleij, Bartosz Golaszewski, Dmitry Torokhov,
Tony Lindgren, Lee Jones, linux-gpio, linux-kernel, linux-input,
linux-leds, linux-arm-kernel, linux-usb, Bartosz Golaszewski,
Pavel Machek, Daniel Mack, Haojian Zhuang, Robert Jarzmik,
Greg Kroah-Hartman
On Sat, Nov 09, 2024 at 07:40:15AM +0100, Dominik Brodowski wrote:
> Am Fri, Nov 08, 2024 at 10:35:41AM +0200 schrieb Andy Shevchenko:
> > On Fri, Nov 08, 2024 at 09:28:19AM +0100, Linus Walleij wrote:
> > > On Mon, Nov 4, 2024 at 10:36 AM Andy Shevchenko
> > > <andriy.shevchenko@linux.intel.com> wrote:
> > >
> > > > Avoid using GPIOF_ACTIVE_LOW as it's deprecated and subject to remove.
> > > >
> > > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > >
> > > Looks right to me, some testing would be even better
> > > because I never trust these flags to get right.
> >
> > I also would like to have this, but seems the only odd fixer was active ca.
> > 2023 last time, I'm not sure we may hear from Dominik in time, otherwise the
> > series will be postponed for unknown period of time, which I do not prefer,
> > rather I will fix any regressions later (but I doubt there are here).
>
> As I don't have such hardware, I cannot help with testing, but from the
> PCMCIA point of view:
>
> Acked-by: Dominik Brodowski <linux@dominikbrodowski.net>
Thanks for chiming in!
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v1 3/6] leds: gpio: Avoid using GPIOF_ACTIVE_LOW
2024-11-04 9:34 ` [PATCH v1 3/6] leds: gpio: Avoid " Andy Shevchenko
2024-11-06 9:55 ` Lee Jones
2024-11-08 8:37 ` Linus Walleij
@ 2024-11-11 9:45 ` Geert Uytterhoeven
2024-11-11 9:56 ` Andy Shevchenko
2 siblings, 1 reply; 26+ messages in thread
From: Geert Uytterhoeven @ 2024-11-11 9:45 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Bartosz Golaszewski, Dmitry Torokhov, Tony Lindgren, Lee Jones,
linux-gpio, linux-kernel, linux-input, linux-leds,
linux-arm-kernel, linux-usb, Linus Walleij, Bartosz Golaszewski,
Pavel Machek, Dominik Brodowski, Daniel Mack, Haojian Zhuang,
Robert Jarzmik, Greg Kroah-Hartman
Hi Andy,
On Mon, Nov 4, 2024 at 10:37 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> Avoid using GPIOF_ACTIVE_LOW as it's deprecated and subject to remove.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Thanks for your patch, which is now commit e6a2f0ea519fd247
("leds: gpio: Avoid using GPIOF_ACTIVE_LOW") in gpio/gpio/for-next.
> --- a/drivers/leds/leds-gpio.c
> +++ b/drivers/leds/leds-gpio.c
> @@ -212,7 +212,6 @@ static struct gpio_desc *gpio_led_get_gpiod(struct device *dev, int idx,
> const struct gpio_led *template)
> {
> struct gpio_desc *gpiod;
> - unsigned long flags = GPIOF_OUT_INIT_LOW;
> int ret;
>
> /*
> @@ -239,10 +238,7 @@ static struct gpio_desc *gpio_led_get_gpiod(struct device *dev, int idx,
> if (!gpio_is_valid(template->gpio))
> return ERR_PTR(-ENOENT);
>
> - if (template->active_low)
> - flags |= GPIOF_ACTIVE_LOW;
> -
> - ret = devm_gpio_request_one(dev, template->gpio, flags,
> + ret = devm_gpio_request_one(dev, template->gpio, GPIOF_OUT_INIT_LOW,
> template->name);
Just wondering, as I am not 100% sure: can this change change the
initial state of the GPIO?
> if (ret < 0)
> return ERR_PTR(ret);
> @@ -251,6 +247,9 @@ static struct gpio_desc *gpio_led_get_gpiod(struct device *dev, int idx,
> if (!gpiod)
> return ERR_PTR(-EINVAL);
>
> + if (template->active_low ^ gpiod_is_active_low(gpiod))
> + gpiod_toggle_active_low(gpiod);
> +
> return gpiod;
> }
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v1 3/6] leds: gpio: Avoid using GPIOF_ACTIVE_LOW
2024-11-11 9:45 ` Geert Uytterhoeven
@ 2024-11-11 9:56 ` Andy Shevchenko
2024-11-11 10:21 ` Geert Uytterhoeven
0 siblings, 1 reply; 26+ messages in thread
From: Andy Shevchenko @ 2024-11-11 9:56 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Bartosz Golaszewski, Dmitry Torokhov, Tony Lindgren, Lee Jones,
linux-gpio, linux-kernel, linux-input, linux-leds,
linux-arm-kernel, linux-usb, Linus Walleij, Bartosz Golaszewski,
Pavel Machek, Dominik Brodowski, Daniel Mack, Haojian Zhuang,
Robert Jarzmik, Greg Kroah-Hartman
On Mon, Nov 11, 2024 at 10:45:13AM +0100, Geert Uytterhoeven wrote:
> On Mon, Nov 4, 2024 at 10:37 AM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
...
> > - if (template->active_low)
> > - flags |= GPIOF_ACTIVE_LOW;
> > -
> > - ret = devm_gpio_request_one(dev, template->gpio, flags,
> > + ret = devm_gpio_request_one(dev, template->gpio, GPIOF_OUT_INIT_LOW,
> > template->name);
>
> Just wondering, as I am not 100% sure: can this change change the
> initial state of the GPIO?
You probably wonder how ACTIVE_LOW affects the OUT_INIT_LOW given above.
I have an answer to you, however I might be mistaken as well, but I spent some
time to investigate.
The above mentioned call ends up in the gpiod_direction_output_raw_commit() which
uses the value (low in this case) as an absolute value. It does not include the
ACTIVE_LOW in the value calculations. Hence, setting ACTIVE_LOW before or afterwards
has no effect on the existing flow.
If you notice a mistake, please elaborate this, so I can fix the approach!
> > if (ret < 0)
> > return ERR_PTR(ret);
...
> > + if (template->active_low ^ gpiod_is_active_low(gpiod))
> > + gpiod_toggle_active_low(gpiod);
> > +
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v1 3/6] leds: gpio: Avoid using GPIOF_ACTIVE_LOW
2024-11-11 9:56 ` Andy Shevchenko
@ 2024-11-11 10:21 ` Geert Uytterhoeven
0 siblings, 0 replies; 26+ messages in thread
From: Geert Uytterhoeven @ 2024-11-11 10:21 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Bartosz Golaszewski, Dmitry Torokhov, Tony Lindgren, Lee Jones,
linux-gpio, linux-kernel, linux-input, linux-leds,
linux-arm-kernel, linux-usb, Linus Walleij, Bartosz Golaszewski,
Pavel Machek, Dominik Brodowski, Daniel Mack, Haojian Zhuang,
Robert Jarzmik, Greg Kroah-Hartman
Hi Andy,
On Mon, Nov 11, 2024 at 10:57 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> On Mon, Nov 11, 2024 at 10:45:13AM +0100, Geert Uytterhoeven wrote:
> > On Mon, Nov 4, 2024 at 10:37 AM Andy Shevchenko
> > <andriy.shevchenko@linux.intel.com> wrote:
>
> ...
>
> > > - if (template->active_low)
> > > - flags |= GPIOF_ACTIVE_LOW;
> > > -
> > > - ret = devm_gpio_request_one(dev, template->gpio, flags,
> > > + ret = devm_gpio_request_one(dev, template->gpio, GPIOF_OUT_INIT_LOW,
> > > template->name);
> >
> > Just wondering, as I am not 100% sure: can this change change the
> > initial state of the GPIO?
>
> You probably wonder how ACTIVE_LOW affects the OUT_INIT_LOW given above.
> I have an answer to you, however I might be mistaken as well, but I spent some
> time to investigate.
>
> The above mentioned call ends up in the gpiod_direction_output_raw_commit() which
> uses the value (low in this case) as an absolute value. It does not include the
> ACTIVE_LOW in the value calculations. Hence, setting ACTIVE_LOW before or afterwards
> has no effect on the existing flow.
>
> If you notice a mistake, please elaborate this, so I can fix the approach!
Thanks, I had discovered the same, but wanted to double-check!
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 26+ messages in thread
end of thread, other threads:[~2024-11-11 10:21 UTC | newest]
Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-04 9:34 [PATCH v1 0/6] gpio: Get rid of deprecated GPIOF_ACTIVE_LOW Andy Shevchenko
2024-11-04 9:34 ` [PATCH v1 1/6] Input: gpio_keys - avoid using GPIOF_ACTIVE_LOW Andy Shevchenko
2024-11-05 5:44 ` Dmitry Torokhov
2024-11-08 8:33 ` Linus Walleij
2024-11-04 9:34 ` [PATCH v1 2/6] Input: gpio_keys_polled " Andy Shevchenko
2024-11-05 5:45 ` Dmitry Torokhov
2024-11-08 8:33 ` Linus Walleij
2024-11-04 9:34 ` [PATCH v1 3/6] leds: gpio: Avoid " Andy Shevchenko
2024-11-06 9:55 ` Lee Jones
2024-11-08 8:37 ` Linus Walleij
2024-11-11 9:45 ` Geert Uytterhoeven
2024-11-11 9:56 ` Andy Shevchenko
2024-11-11 10:21 ` Geert Uytterhoeven
2024-11-04 9:34 ` [PATCH v1 4/6] pcmcia: soc_common: " Andy Shevchenko
2024-11-08 8:28 ` Linus Walleij
2024-11-08 8:35 ` Andy Shevchenko
2024-11-09 6:40 ` Dominik Brodowski
2024-11-11 7:31 ` Andy Shevchenko
2024-11-04 9:34 ` [PATCH v1 5/6] USB: gadget: pxa27x_udc: " Andy Shevchenko
2024-11-05 12:26 ` Greg Kroah-Hartman
2024-11-08 8:34 ` Linus Walleij
2024-11-04 9:34 ` [PATCH v1 6/6] gpio: Get rid of GPIOF_ACTIVE_LOW Andy Shevchenko
2024-11-08 8:29 ` Linus Walleij
2024-11-06 11:15 ` [PATCH v1 0/6] gpio: Get rid of deprecated GPIOF_ACTIVE_LOW Andy Shevchenko
2024-11-06 13:43 ` Bartosz Golaszewski
2024-11-09 13:56 ` Bartosz Golaszewski
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).