diff mbox series

[v1,4/6] pcmcia: soc_common: Avoid using GPIOF_ACTIVE_LOW

Message ID 20241104093609.156059-5-andriy.shevchenko@linux.intel.com
State Accepted
Commit 15998583b19749e63c5cd0431a2517f524352762
Headers show
Series gpio: Get rid of deprecated GPIOF_ACTIVE_LOW | expand

Commit Message

Andy Shevchenko Nov. 4, 2024, 9:34 a.m. UTC
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(-)

Comments

Linus Walleij Nov. 8, 2024, 8:28 a.m. UTC | #1
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
Andy Shevchenko Nov. 8, 2024, 8:35 a.m. UTC | #2
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).
Dominik Brodowski Nov. 9, 2024, 6:40 a.m. UTC | #3
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
Andy Shevchenko Nov. 11, 2024, 7:31 a.m. UTC | #4
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!
diff mbox series

Patch

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