Skip to content

Commit 20e6ce4

Browse files
eaibmzhcahca
authored andcommitted
watchdog: diag288_wdt: unify lpar and zvm diag288 helpers
Change naming of the internal diag288 helper functions to improve overall readability and reduce confusion: * Rename __diag288() to diag288(). * Get rid of the misnamed helper __diag288_lpar() that was used not only on LPARs but also zVM and KVM systems. * Rename __diag288_vm() to diag288_str(). Reviewed-by: Heiko Carstens <[email protected]> Signed-off-by: Alexander Egorenkov <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Heiko Carstens <[email protected]>
1 parent 3790085 commit 20e6ce4

File tree

1 file changed

+13
-19
lines changed

1 file changed

+13
-19
lines changed

drivers/watchdog/diag288_wdt.c

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ MODULE_ALIAS("vmwatchdog");
7171

7272
static char *cmd_buf;
7373

74-
static int __diag288(unsigned int func, unsigned int timeout,
75-
unsigned long action, unsigned int len)
74+
static int diag288(unsigned int func, unsigned int timeout,
75+
unsigned long action, unsigned int len)
7676
{
7777
union register_pair r1 = { .even = func, .odd = timeout, };
7878
union register_pair r3 = { .even = action, .odd = len, };
@@ -92,7 +92,7 @@ static int __diag288(unsigned int func, unsigned int timeout,
9292
return err;
9393
}
9494

95-
static int __diag288_vm(unsigned int func, unsigned int timeout, char *cmd)
95+
static int diag288_str(unsigned int func, unsigned int timeout, char *cmd)
9696
{
9797
ssize_t len;
9898

@@ -102,13 +102,7 @@ static int __diag288_vm(unsigned int func, unsigned int timeout, char *cmd)
102102
ASCEBC(cmd_buf, MAX_CMDLEN);
103103
EBC_TOUPPER(cmd_buf, MAX_CMDLEN);
104104

105-
return __diag288(func, timeout, virt_to_phys(cmd_buf), len);
106-
}
107-
108-
static int __diag288_lpar(unsigned int func, unsigned int timeout,
109-
unsigned long action)
110-
{
111-
return __diag288(func, timeout, action, 0);
105+
return diag288(func, timeout, virt_to_phys(cmd_buf), len);
112106
}
113107

114108
static int wdt_start(struct watchdog_device *dev)
@@ -119,11 +113,10 @@ static int wdt_start(struct watchdog_device *dev)
119113
if (MACHINE_IS_VM) {
120114
func = conceal_on ? (WDT_FUNC_INIT | WDT_FUNC_CONCEAL)
121115
: WDT_FUNC_INIT;
122-
ret = __diag288_vm(func, dev->timeout, wdt_cmd);
116+
ret = diag288_str(func, dev->timeout, wdt_cmd);
123117
WARN_ON(ret != 0);
124118
} else {
125-
ret = __diag288_lpar(WDT_FUNC_INIT,
126-
dev->timeout, LPARWDT_RESTART);
119+
ret = diag288(WDT_FUNC_INIT, dev->timeout, LPARWDT_RESTART, 0);
127120
}
128121

129122
if (ret) {
@@ -135,7 +128,7 @@ static int wdt_start(struct watchdog_device *dev)
135128

136129
static int wdt_stop(struct watchdog_device *dev)
137130
{
138-
return __diag288(WDT_FUNC_CANCEL, 0, 0, 0);
131+
return diag288(WDT_FUNC_CANCEL, 0, 0, 0);
139132
}
140133

141134
static int wdt_ping(struct watchdog_device *dev)
@@ -152,10 +145,10 @@ static int wdt_ping(struct watchdog_device *dev)
152145
func = conceal_on ? (WDT_FUNC_INIT | WDT_FUNC_CONCEAL)
153146
: WDT_FUNC_INIT;
154147

155-
ret = __diag288_vm(func, dev->timeout, wdt_cmd);
148+
ret = diag288_str(func, dev->timeout, wdt_cmd);
156149
WARN_ON(ret != 0);
157150
} else {
158-
ret = __diag288_lpar(WDT_FUNC_CHANGE, dev->timeout, 0);
151+
ret = diag288(WDT_FUNC_CHANGE, dev->timeout, 0, 0);
159152
}
160153

161154
if (ret)
@@ -206,20 +199,21 @@ static int __init diag288_init(void)
206199
return -ENOMEM;
207200
}
208201

209-
ret = __diag288_vm(WDT_FUNC_INIT, MIN_INTERVAL, "BEGIN");
202+
ret = diag288_str(WDT_FUNC_INIT, MIN_INTERVAL, "BEGIN");
210203
if (ret != 0) {
211204
pr_err("The watchdog cannot be initialized\n");
212205
kfree(cmd_buf);
213206
return -EINVAL;
214207
}
215208
} else {
216-
if (__diag288_lpar(WDT_FUNC_INIT, 30, LPARWDT_RESTART)) {
209+
if (diag288(WDT_FUNC_INIT, WDT_DEFAULT_TIMEOUT,
210+
LPARWDT_RESTART, 0)) {
217211
pr_err("The watchdog cannot be initialized\n");
218212
return -EINVAL;
219213
}
220214
}
221215

222-
if (__diag288_lpar(WDT_FUNC_CANCEL, 0, 0)) {
216+
if (diag288(WDT_FUNC_CANCEL, 0, 0, 0)) {
223217
pr_err("The watchdog cannot be deactivated\n");
224218
return -EINVAL;
225219
}

0 commit comments

Comments
 (0)