mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Richard <thomas.richard@bootlin.com>
To: wim@linux-watchdog.org, linux@roeck-us.net
Cc: linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org,
	michael.brunner@kontron.com, thomas.richard@bootlin.com,
	thomas.petazzoni@bootlin.com
Subject: [PATCH] watchdog: kempld: use pretimeout member of watchdog_device struct
Date: Thu, 13 Jun 2024 18:41:57 +0200	[thread overview]
Message-ID: <20240613164157.457693-1-thomas.richard@bootlin.com> (raw)

Th driver was written whereas pretimeout wasn't supported by the watchdog
core. So the pretimeout was stored in the driver data.

Now the core has pretimeout support, so use it.

Signed-off-by: Thomas Richard <thomas.richard@bootlin.com>
---
 drivers/watchdog/kempld_wdt.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/watchdog/kempld_wdt.c b/drivers/watchdog/kempld_wdt.c
index e6c7a2906680..ebb873502203 100644
--- a/drivers/watchdog/kempld_wdt.c
+++ b/drivers/watchdog/kempld_wdt.c
@@ -73,7 +73,6 @@ struct kempld_wdt_stage {
 struct kempld_wdt_data {
 	struct kempld_device_data	*pld;
 	struct watchdog_device		wdd;
-	unsigned int			pretimeout;
 	struct kempld_wdt_stage		stage[KEMPLD_WDT_MAX_STAGES];
 	u8				pm_status_store;
 };
@@ -205,8 +204,8 @@ static int kempld_wdt_set_timeout(struct watchdog_device *wdd,
 	timeout_stage = &wdt_data->stage[STAGE_TIMEOUT];
 	pretimeout_stage = &wdt_data->stage[STAGE_PRETIMEOUT];
 
-	if (pretimeout_stage->mask && wdt_data->pretimeout > 0)
-		timeout = wdt_data->pretimeout;
+	if (pretimeout_stage->mask && wdd->pretimeout > 0)
+		timeout = wdd->pretimeout;
 
 	ret = kempld_wdt_set_stage_action(wdt_data, timeout_stage,
 						ACTION_RESET);
@@ -249,13 +248,14 @@ static int kempld_wdt_set_pretimeout(struct watchdog_device *wdd,
 	if (ret)
 		return ret;
 
-	wdt_data->pretimeout = pretimeout;
+	wdd->pretimeout = pretimeout;
 	return 0;
 }
 
 static void kempld_wdt_update_timeouts(struct kempld_wdt_data *wdt_data)
 {
 	struct kempld_device_data *pld = wdt_data->pld;
+	struct watchdog_device *wdd = &wdt_data->wdd;
 	struct kempld_wdt_stage *pretimeout_stage;
 	struct kempld_wdt_stage *timeout_stage;
 	unsigned int pretimeout, timeout;
@@ -269,11 +269,11 @@ static void kempld_wdt_update_timeouts(struct kempld_wdt_data *wdt_data)
 	kempld_release_mutex(pld);
 
 	if (pretimeout)
-		wdt_data->pretimeout = timeout;
+		wdd->pretimeout = timeout;
 	else
-		wdt_data->pretimeout = 0;
+		wdd->pretimeout = 0;
 
-	wdt_data->wdd.timeout = pretimeout + timeout;
+	wdd->timeout = pretimeout + timeout;
 }
 
 static int kempld_wdt_start(struct watchdog_device *wdd)
@@ -336,7 +336,6 @@ static int kempld_wdt_keepalive(struct watchdog_device *wdd)
 static long kempld_wdt_ioctl(struct watchdog_device *wdd, unsigned int cmd,
 				unsigned long arg)
 {
-	struct kempld_wdt_data *wdt_data = watchdog_get_drvdata(wdd);
 	void __user *argp = (void __user *)arg;
 	int ret = -ENOIOCTLCMD;
 	int __user *p = argp;
@@ -352,7 +351,7 @@ static long kempld_wdt_ioctl(struct watchdog_device *wdd, unsigned int cmd,
 		ret = kempld_wdt_keepalive(wdd);
 		break;
 	case WDIOC_GETPRETIMEOUT:
-		ret = put_user(wdt_data->pretimeout, (int __user *)arg);
+		ret = put_user(wdd->pretimeout, (int __user *)arg);
 		break;
 	}
 
-- 
2.39.2


             reply	other threads:[~2024-06-13 16:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-13 16:41 Thomas Richard [this message]
2024-06-13 19:53 ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240613164157.457693-1-thomas.richard@bootlin.com \
    --to=thomas.richard@bootlin.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=michael.brunner@kontron.com \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=wim@linux-watchdog.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®