From: Alexander Egorenkov <egorenar@linux.ibm.com>
To: wim@linux-watchdog.org, linux@roeck-us.net
Cc: linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org,
hca@linux.ibm.com
Subject: [PATCH 4/5] watchdog: diag288_wdt: de-duplicate diag_stat_inc() calls
Date: Fri, 3 Feb 2023 08:39:57 +0100 [thread overview]
Message-ID: <20230203073958.1585738-5-egorenar@linux.ibm.com> (raw)
In-Reply-To: <20230203073958.1585738-1-egorenar@linux.ibm.com>
Call diag_stat_inc() from __diag288() to reduce code duplication.
Reviewed-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Alexander Egorenkov <egorenar@linux.ibm.com>
---
drivers/watchdog/diag288_wdt.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/drivers/watchdog/diag288_wdt.c b/drivers/watchdog/diag288_wdt.c
index c717f47dd4c3..a29ad164b27a 100644
--- a/drivers/watchdog/diag288_wdt.c
+++ b/drivers/watchdog/diag288_wdt.c
@@ -78,6 +78,8 @@ static int __diag288(unsigned int func, unsigned int timeout,
union register_pair r3 = { .even = action, .odd = len, };
int err;
+ diag_stat_inc(DIAG_STAT_X288);
+
err = -EINVAL;
asm volatile(
" diag %[r1],%[r3],0x288\n"
@@ -100,14 +102,12 @@ static int __diag288_vm(unsigned int func, unsigned int timeout, char *cmd)
ASCEBC(cmd_buf, MAX_CMDLEN);
EBC_TOUPPER(cmd_buf, MAX_CMDLEN);
- diag_stat_inc(DIAG_STAT_X288);
return __diag288(func, timeout, virt_to_phys(cmd_buf), len);
}
static int __diag288_lpar(unsigned int func, unsigned int timeout,
unsigned long action)
{
- diag_stat_inc(DIAG_STAT_X288);
return __diag288(func, timeout, action, 0);
}
@@ -135,12 +135,7 @@ static int wdt_start(struct watchdog_device *dev)
static int wdt_stop(struct watchdog_device *dev)
{
- int ret;
-
- diag_stat_inc(DIAG_STAT_X288);
- ret = __diag288(WDT_FUNC_CANCEL, 0, 0, 0);
-
- return ret;
+ return __diag288(WDT_FUNC_CANCEL, 0, 0, 0);
}
static int wdt_ping(struct watchdog_device *dev)
--
2.37.2
next prev parent reply other threads:[~2023-02-03 7:40 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-03 7:39 [PATCH 0/5] diag288 watchdog fixes and improvements Alexander Egorenkov
2023-02-03 7:39 ` [PATCH 1/5] watchdog: diag288_wdt: get rid of register asm Alexander Egorenkov
2023-02-03 18:17 ` Guenter Roeck
2023-02-03 7:39 ` [PATCH 2/5] watchdog: diag288_wdt: remove power management Alexander Egorenkov
2023-02-03 18:23 ` Guenter Roeck
2023-02-03 7:39 ` [PATCH 3/5] watchdog: diag288_wdt: unify command buffer handling for diag288 zvm Alexander Egorenkov
2023-02-03 18:34 ` Guenter Roeck
2023-02-03 7:39 ` Alexander Egorenkov [this message]
2023-02-03 18:36 ` [PATCH 4/5] watchdog: diag288_wdt: de-duplicate diag_stat_inc() calls Guenter Roeck
2023-02-03 7:39 ` [PATCH 5/5] watchdog: diag288_wdt: unify lpar and zvm diag288 helpers Alexander Egorenkov
2023-02-03 18:37 ` Guenter Roeck
2023-02-06 9:59 ` [PATCH 0/5] diag288 watchdog fixes and improvements Heiko Carstens
2023-02-06 13:55 ` Guenter Roeck
2023-02-06 14:33 ` Heiko Carstens
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=20230203073958.1585738-5-egorenar@linux.ibm.com \
--to=egorenar@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=linux@roeck-us.net \
--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