lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 22 Mar 2022 23:29:11 +0100
From:   Tobias Waldekranz <tobias@...dekranz.com>
To:     Wim Van Sebroeck <wim@...ux-watchdog.org>,
        Guenter Roeck <linux@...ck-us.net>
Cc:     linux-watchdog@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] watchdog: gpio_wdt: Support GPO lines with the toggle algorithm

Support using GPO lines (i.e. GPIOs that are output-only) with
gpio_wdt using the "toggle" algorithm.

Since its inception, gpio_wdt has configured its GPIO line as an input
when using the "toggle" algorithm, even though it is used as an output
when kicking. This needlessly barred hardware with output-only pins
from using the driver.

Signed-off-by: Tobias Waldekranz <tobias@...dekranz.com>
---

Hi,

This patch has been in our downstream tree for a long time. We need it
because our kick GPIO can't be used as an input.

What I really can't figure out is why the driver would request the pin
as in input, when it's always going to end up being used as an output
anyway.

So I thought I'd send it upstream in the hopes of either getting it
merged, or an explanation as to why it is needed.

 drivers/watchdog/gpio_wdt.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/watchdog/gpio_wdt.c b/drivers/watchdog/gpio_wdt.c
index 0923201ce874..f7686688e0e2 100644
--- a/drivers/watchdog/gpio_wdt.c
+++ b/drivers/watchdog/gpio_wdt.c
@@ -108,7 +108,6 @@ static int gpio_wdt_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	struct device_node *np = dev->of_node;
 	struct gpio_wdt_priv *priv;
-	enum gpiod_flags gflags;
 	unsigned int hw_margin;
 	const char *algo;
 	int ret;
@@ -122,17 +121,15 @@ static int gpio_wdt_probe(struct platform_device *pdev)
 	ret = of_property_read_string(np, "hw_algo", &algo);
 	if (ret)
 		return ret;
-	if (!strcmp(algo, "toggle")) {
+
+	if (!strcmp(algo, "toggle"))
 		priv->hw_algo = HW_ALGO_TOGGLE;
-		gflags = GPIOD_IN;
-	} else if (!strcmp(algo, "level")) {
+	else if (!strcmp(algo, "level"))
 		priv->hw_algo = HW_ALGO_LEVEL;
-		gflags = GPIOD_OUT_LOW;
-	} else {
+	else
 		return -EINVAL;
-	}
 
-	priv->gpiod = devm_gpiod_get(dev, NULL, gflags);
+	priv->gpiod = devm_gpiod_get(dev, NULL, GPIOD_OUT_LOW);
 	if (IS_ERR(priv->gpiod))
 		return PTR_ERR(priv->gpiod);
 
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ