Skip to content

Commit 747d88a

Browse files
fabioestevamWim Van Sebroeck
authored andcommitted
watchdog: imx7ulp: Pass the wdog instance inimx7ulp_wdt_enable()
It is more natural to pass the watchdog instance inside imx7ulp_wdt_enable() instead of the base address. This also has the benefit to reduce the code a bit. Signed-off-by: Fabio Estevam <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]> Signed-off-by: Wim Van Sebroeck <[email protected]>
1 parent 4c0bfc0 commit 747d88a

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

drivers/watchdog/imx7ulp_wdt.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,17 @@ struct imx7ulp_wdt_device {
4747
struct clk *clk;
4848
};
4949

50-
static inline void imx7ulp_wdt_enable(void __iomem *base, bool enable)
50+
static inline void imx7ulp_wdt_enable(struct watchdog_device *wdog, bool enable)
5151
{
52-
u32 val = readl(base + WDOG_CS);
52+
struct imx7ulp_wdt_device *wdt = watchdog_get_drvdata(wdog);
5353

54-
writel(UNLOCK, base + WDOG_CNT);
54+
u32 val = readl(wdt->base + WDOG_CS);
55+
56+
writel(UNLOCK, wdt->base + WDOG_CNT);
5557
if (enable)
56-
writel(val | WDOG_CS_EN, base + WDOG_CS);
58+
writel(val | WDOG_CS_EN, wdt->base + WDOG_CS);
5759
else
58-
writel(val & ~WDOG_CS_EN, base + WDOG_CS);
60+
writel(val & ~WDOG_CS_EN, wdt->base + WDOG_CS);
5961
}
6062

6163
static inline bool imx7ulp_wdt_is_enabled(void __iomem *base)
@@ -76,18 +78,15 @@ static int imx7ulp_wdt_ping(struct watchdog_device *wdog)
7678

7779
static int imx7ulp_wdt_start(struct watchdog_device *wdog)
7880
{
79-
struct imx7ulp_wdt_device *wdt = watchdog_get_drvdata(wdog);
8081

81-
imx7ulp_wdt_enable(wdt->base, true);
82+
imx7ulp_wdt_enable(wdog, true);
8283

8384
return 0;
8485
}
8586

8687
static int imx7ulp_wdt_stop(struct watchdog_device *wdog)
8788
{
88-
struct imx7ulp_wdt_device *wdt = watchdog_get_drvdata(wdog);
89-
90-
imx7ulp_wdt_enable(wdt->base, false);
89+
imx7ulp_wdt_enable(wdog, false);
9190

9291
return 0;
9392
}

0 commit comments

Comments
 (0)