Introduce local variable 'struct device *dev' and use it instead of
dereferencing it repeatedly.
The conversion was done automatically with coccinelle using the
following semantic patches. The semantic patches and the scripts
used to generate this commit log are available at
https://github.com/groeck/coccinelle-patches
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
This does the necessary cleanup on driver unload automatically.
Signed-off-by: André Draszik <git@andred.net>
Cc: linux-watchdog@vger.kernel.org
Cc: John Crispin <john@phrozen.org>
Reviewed-by: Guenter Roeck <Linux@roeck-us.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
If the watchdog hardware is enabled/running during boot, e.g.
due to a boot loader configuring it, we must tell the
watchdog framework about this fact so that it can ping the
watchdog until userspace opens the device and takes over
control.
Do so using the WDOG_HW_RUNNING flag that exists for exactly
that use-case.
Given the watchdog driver core doesn't know what timeout was
originally set by whoever started the watchdog (boot loader),
we make sure to update the timeout in the hardware according
to what the watchdog core thinks it is.
Signed-off-by: André Draszik <git@andred.net>
Cc: linux-watchdog@vger.kernel.org
Cc: John Crispin <john@phrozen.org>
Reviewed-by: Guenter Roeck <Linux@roeck-us.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
These watchdog_ops and watchdog_info structures are only stored
in the ops and info fields of a watchdog_device structure,
respectively, which are const. Thus make the watchdog_ops and
watchdog_info structures const as well.
Done with the help of Coccinelle. The rules for the watchdog_ops case are
as follows:
// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct watchdog_ops i@p = { ... };
@ok@
identifier r.i;
struct watchdog_device e;
position p;
@@
e.ops = &i@p;
@bad@
position p != {r.p,ok.p};
identifier r.i;
struct watchdog_ops e;
@@
e@i@p
@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
struct watchdog_ops i = { ... };
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Commit a53e35db70 ("reset: Ensure drivers are explicit when requesting
reset lines") started to transition the reset control request API calls
to explicitly state whether the driver needs exclusive or shared reset
control behavior. Convert all drivers requesting exclusive resets to the
explicit API call so the temporary transition helpers can be removed.
No functional changes.
Cc: linux-watchdog@vger.kernel.org
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Declare watchdog_ops structures as const as they are only stored in the
ops field of a watchdog_device structure. This field is of type const, so
watchdog_ops structures having this property can be made const too.
Done using Coccinelle:
@r disable optional_qualifier@
identifier x;
position p;
@@
static struct watchdog_ops x@p={...};
@ok@
struct watchdog_device w;
identifier r.x;
position p;
@@
w.ops=&x@p;
@bad@
position p != {r.p,ok.p};
identifier r.x;
@@
x@p
@depends on !bad disable optional_qualifier@
identifier r.x;
@@
+const
struct watchdog_ops x;
File size details before and after patching.
First line of every .o file shows the file size before patching
and second line shows the size after patching.
text data bss dec hex filename
1340 544 0 1884 75c drivers/watchdog/bcm_kona_wdt.o
1436 440 0 1876 754 drivers/watchdog/bcm_kona_wdt.o
1176 544 4 1724 6bc drivers/watchdog/digicolor_wdt.o
1272 440 4 1716 6b4 drivers/watchdog/digicolor_wdt.o
925 580 89 1594 63a drivers/watchdog/ep93xx_wdt.o
1021 476 89 1586 632 drivers/watchdog/ep93xx_wdt.o
4932 288 17 5237 1475 drivers/watchdog/s3c2410_wdt.o
5028 192 17 5237 1475 drivers/watchdog/s3c2410_wdt.o
1977 292 1 2270 8de drivers/watchdog/sama5d4_wdt.o
2073 196 1 2270 8de drivers/watchdog/sama5d4_wdt.o
1375 484 1 1860 744 drivers/watchdog/sirfsoc_wdt.o
1471 380 1 1852 73c drivers/watchdog/sirfsoc_wdt.o
Size remains the same for the files drivers/watchdog/diag288_wdt.o
drivers/watchdog/asm9260_wdt.o and drivers/watchdog/atlas7_wdt.o
The following .o files did not compile:
drivers/watchdog/sun4v_wdt.o, drivers/watchdog/sbsa_gwdt.o,
drivers/watchdog/rt2880_wdt.o, drivers/watchdog/booke_wdt.o
drivers/watchdog/mt7621_wdt.o
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
This patch updates my email address as I no longer have access to the old
one.
Signed-off-by: John Crispin <john@phrozen.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Commit 0254e95353 ("watchdog: Drop pointer to watchdog device from
struct watchdog_device") removed the dev pointer from struct
watchdog_device, but this driver was still assigning it, leading to
a compilation error:
drivers/watchdog/mt7621_wdt.c: In function 'mt7621_wdt_probe':
drivers/watchdog/mt7621_wdt.c:142:16: error:
'struct watchdog_device' has no member named 'dev'
Fix this by removing the assignment.
Fixes: 0254e95353 ("watchdog: Drop pointer to watchdog device ...")
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Cc: stable@vger.kernel.org # v4.5+
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
This patch adds support for the watchdog core found on newer MediaTek Wifi
SoCs MT7621 and MT7628. There is no symbol for MT7628 as it is a subtype of
MT7620 so we depend on that instead.
Signed-off-by: John Crispin <blogic@openwrt.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>