Skip to content

Commit 4aba1a7

Browse files
committed
Merge tag 'linux-watchdog-5.4-rc7' of git://www.linux-watchdog.org/linux-watchdog
Pull watchdog fixes from Wim Van Sebroeck: - cpwd: fix build regression - pm8916_wdt: fix pretimeout registration flow - meson: Fix the wrong value of left time - imx_sc_wdt: Pretimeout should follow SCU firmware format - bd70528: Add MODULE_ALIAS to allow module auto loading * tag 'linux-watchdog-5.4-rc7' of git://www.linux-watchdog.org/linux-watchdog: watchdog: bd70528: Add MODULE_ALIAS to allow module auto loading watchdog: imx_sc_wdt: Pretimeout should follow SCU firmware format watchdog: meson: Fix the wrong value of left time watchdog: pm8916_wdt: fix pretimeout registration flow watchdog: cpwd: fix build regression
2 parents 0058b0a + 81363f2 commit 4aba1a7

File tree

5 files changed

+28
-8
lines changed

5 files changed

+28
-8
lines changed

drivers/watchdog/bd70528_wdt.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,3 +288,4 @@ module_platform_driver(bd70528_wdt);
288288
MODULE_AUTHOR("Matti Vaittinen <[email protected]>");
289289
MODULE_DESCRIPTION("BD70528 watchdog driver");
290290
MODULE_LICENSE("GPL");
291+
MODULE_ALIAS("platform:bd70528-wdt");

drivers/watchdog/cpwd.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <linux/interrupt.h>
2727
#include <linux/ioport.h>
2828
#include <linux/timer.h>
29+
#include <linux/compat.h>
2930
#include <linux/slab.h>
3031
#include <linux/mutex.h>
3132
#include <linux/io.h>
@@ -473,6 +474,11 @@ static long cpwd_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
473474
return 0;
474475
}
475476

477+
static long cpwd_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
478+
{
479+
return cpwd_ioctl(file, cmd, (unsigned long)compat_ptr(arg));
480+
}
481+
476482
static ssize_t cpwd_write(struct file *file, const char __user *buf,
477483
size_t count, loff_t *ppos)
478484
{
@@ -497,7 +503,7 @@ static ssize_t cpwd_read(struct file *file, char __user *buffer,
497503
static const struct file_operations cpwd_fops = {
498504
.owner = THIS_MODULE,
499505
.unlocked_ioctl = cpwd_ioctl,
500-
.compat_ioctl = compat_ptr_ioctl,
506+
.compat_ioctl = cpwd_compat_ioctl,
501507
.open = cpwd_open,
502508
.write = cpwd_write,
503509
.read = cpwd_read,

drivers/watchdog/imx_sc_wdt.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,14 @@ static int imx_sc_wdt_set_pretimeout(struct watchdog_device *wdog,
9999
{
100100
struct arm_smccc_res res;
101101

102+
/*
103+
* SCU firmware calculates pretimeout based on current time
104+
* stamp instead of watchdog timeout stamp, need to convert
105+
* the pretimeout to SCU firmware's timeout value.
106+
*/
102107
arm_smccc_smc(IMX_SIP_TIMER, IMX_SIP_TIMER_SET_PRETIME_WDOG,
103-
pretimeout * 1000, 0, 0, 0, 0, 0, &res);
108+
(wdog->timeout - pretimeout) * 1000, 0, 0, 0,
109+
0, 0, &res);
104110
if (res.a0)
105111
return -EACCES;
106112

drivers/watchdog/meson_gxbb_wdt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ static unsigned int meson_gxbb_wdt_get_timeleft(struct watchdog_device *wdt_dev)
8989

9090
reg = readl(data->reg_base + GXBB_WDT_TCNT_REG);
9191

92-
return ((reg >> GXBB_WDT_TCNT_CNT_SHIFT) -
93-
(reg & GXBB_WDT_TCNT_SETUP_MASK)) / 1000;
92+
return ((reg & GXBB_WDT_TCNT_SETUP_MASK) -
93+
(reg >> GXBB_WDT_TCNT_CNT_SHIFT)) / 1000;
9494
}
9595

9696
static const struct watchdog_ops meson_gxbb_wdt_ops = {

drivers/watchdog/pm8916_wdt.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,17 @@ static int pm8916_wdt_probe(struct platform_device *pdev)
163163

164164
irq = platform_get_irq(pdev, 0);
165165
if (irq > 0) {
166-
if (devm_request_irq(dev, irq, pm8916_wdt_isr, 0, "pm8916_wdt",
167-
wdt))
168-
irq = 0;
166+
err = devm_request_irq(dev, irq, pm8916_wdt_isr, 0,
167+
"pm8916_wdt", wdt);
168+
if (err)
169+
return err;
170+
171+
wdt->wdev.info = &pm8916_wdt_pt_ident;
172+
} else {
173+
if (irq == -EPROBE_DEFER)
174+
return -EPROBE_DEFER;
175+
176+
wdt->wdev.info = &pm8916_wdt_ident;
169177
}
170178

171179
/* Configure watchdog to hard-reset mode */
@@ -177,7 +185,6 @@ static int pm8916_wdt_probe(struct platform_device *pdev)
177185
return err;
178186
}
179187

180-
wdt->wdev.info = (irq > 0) ? &pm8916_wdt_pt_ident : &pm8916_wdt_ident,
181188
wdt->wdev.ops = &pm8916_wdt_ops,
182189
wdt->wdev.parent = dev;
183190
wdt->wdev.min_timeout = PM8916_WDT_MIN_TIMEOUT;

0 commit comments

Comments
 (0)