[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231207075835.3091694-1-r.czerwinski@pengutronix.de>
Date: Thu, 7 Dec 2023 08:58:36 +0100
From: Rouven Czerwinski <r.czerwinski@...gutronix.de>
To: Johannes Berg <johannes.berg@...el.com>,
Josua Mayer <josua@...id-run.com>,
linux-wireless@...r.kernel.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: pza@...gutronix.de,
Rouven Czerwinski <r.czerwinski@...gutronix.de>,
stable@...r.kernel.org, Johannes Berg <johannes@...solutions.net>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>
Subject: [PATCH v2] net: rfkill: gpio: set GPIO direction
Fix the undefined usage of the GPIO consumer API after retrieving the
GPIO description with GPIO_ASIS. The API documentation mentions that
GPIO_ASIS won't set a GPIO direction and requires the user to set a
direction before using the GPIO.
This can be confirmed on i.MX6 hardware, where rfkill-gpio is no longer
able to enabled/disable a device, presumably because the GPIO controller
was never configured for the output direction.
Fixes: b2f750c3a80b ("net: rfkill: gpio: prevent value glitch during probe")
Cc: stable@...r.kernel.org
Signed-off-by: Rouven Czerwinski <r.czerwinski@...gutronix.de>
---
v2:
- remove the if clauses, the gpiod_direction_* functions can handle NULL
gpio descriptors.
net/rfkill/rfkill-gpio.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/net/rfkill/rfkill-gpio.c b/net/rfkill/rfkill-gpio.c
index 5a81505fba9ac..4e32d659524e0 100644
--- a/net/rfkill/rfkill-gpio.c
+++ b/net/rfkill/rfkill-gpio.c
@@ -126,6 +126,14 @@ static int rfkill_gpio_probe(struct platform_device *pdev)
return -EINVAL;
}
+ ret = gpiod_direction_output(rfkill->reset_gpio, true);
+ if (ret)
+ return ret;
+
+ ret = gpiod_direction_output(rfkill->shutdown_gpio, true);
+ if (ret)
+ return ret;
+
rfkill->rfkill_dev = rfkill_alloc(rfkill->name, &pdev->dev,
rfkill->type, &rfkill_gpio_ops,
rfkill);
base-commit: 994d5c58e50e91bb02c7be4a91d5186292a895c8
--
2.39.2
Powered by blists - more mailing lists