Skip to content

Commit 7e5bca6

Browse files
andy-shevWim Van Sebroeck
authored andcommitted
watchdog: gpio_wdt: Make use of device properties
Convert the module to be property provider agnostic and allow it to be used on non-OF platforms. Include mod_devicetable.h explicitly to replace the dropped of.h which included mod_devicetable.h indirectly. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20230925123543.2945710-1-andriy.shevchenko@linux.intel.com Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
1 parent 5d6aa89 commit 7e5bca6

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

drivers/watchdog/gpio_wdt.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@
55
* Author: 2013, Alexander Shiyan <shc_work@mail.ru>
66
*/
77

8-
#include <linux/err.h>
98
#include <linux/delay.h>
10-
#include <linux/module.h>
9+
#include <linux/err.h>
1110
#include <linux/gpio/consumer.h>
12-
#include <linux/of.h>
11+
#include <linux/mod_devicetable.h>
12+
#include <linux/module.h>
1313
#include <linux/platform_device.h>
14+
#include <linux/property.h>
1415
#include <linux/watchdog.h>
1516

1617
static bool nowayout = WATCHDOG_NOWAYOUT;
@@ -106,7 +107,6 @@ static const struct watchdog_ops gpio_wdt_ops = {
106107
static int gpio_wdt_probe(struct platform_device *pdev)
107108
{
108109
struct device *dev = &pdev->dev;
109-
struct device_node *np = dev->of_node;
110110
struct gpio_wdt_priv *priv;
111111
enum gpiod_flags gflags;
112112
unsigned int hw_margin;
@@ -119,7 +119,7 @@ static int gpio_wdt_probe(struct platform_device *pdev)
119119

120120
platform_set_drvdata(pdev, priv);
121121

122-
ret = of_property_read_string(np, "hw_algo", &algo);
122+
ret = device_property_read_string(dev, "hw_algo", &algo);
123123
if (ret)
124124
return ret;
125125
if (!strcmp(algo, "toggle")) {
@@ -136,16 +136,14 @@ static int gpio_wdt_probe(struct platform_device *pdev)
136136
if (IS_ERR(priv->gpiod))
137137
return PTR_ERR(priv->gpiod);
138138

139-
ret = of_property_read_u32(np,
140-
"hw_margin_ms", &hw_margin);
139+
ret = device_property_read_u32(dev, "hw_margin_ms", &hw_margin);
141140
if (ret)
142141
return ret;
143142
/* Disallow values lower than 2 and higher than 65535 ms */
144143
if (hw_margin < 2 || hw_margin > 65535)
145144
return -EINVAL;
146145

147-
priv->always_running = of_property_read_bool(np,
148-
"always-running");
146+
priv->always_running = device_property_read_bool(dev, "always-running");
149147

150148
watchdog_set_drvdata(&priv->wdd, priv);
151149

0 commit comments

Comments
 (0)