Re: [PATCH v2 1/2] watchdog: add pretimeout support to the core

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 06/25/2016 06:01 PM, Vladimir Zapolskiy wrote:
From: Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx>

Since the watchdog framework centrializes the IOCTL interfaces of device
drivers now, SETPRETIMEOUT and GETPRETIMEOUT need to be added in the
common code.

Signed-off-by: Robin Gong <b38343@xxxxxxxxxxxxx>
Signed-off-by: Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx>
[vzapolskiy: added conditional pretimeout sysfs attribute visibility]
Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@xxxxxxxxxx>
---

[ ... ]

--- a/drivers/watchdog/watchdog_dev.c
+++ b/drivers/watchdog/watchdog_dev.c
@@ -307,10 +307,14 @@ static int watchdog_set_timeout(struct watchdog_device *wdd,
  	if (watchdog_timeout_invalid(wdd, timeout))
  		return -EINVAL;

-	if (wdd->ops->set_timeout)
+	if (wdd->ops->set_timeout) {
  		err = wdd->ops->set_timeout(wdd, timeout);
-	else
+	} else {
  		wdd->timeout = timeout;
+		/* Disable pretimeout if it doesn't fit the new timeout */
+		if (wdd->pretimeout > wdd->timeout)

Nitpick: If we consider pretimeout == timeout to be invalid, we should reject it here
as well. So this should be >=.

Otherwise lgtm, so feel free to add

Reviewed-by: Guenter Roeck <linux@xxxxxxxxxxxx>

to the next version. I'd suggest to wait a bit to give Wolfram time to provide input,
though.

Thanks,
Guenter

--
To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux