Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

watchdog: da9063: Do not use a global variable

Using the 'use_sw_pm' variable as global is not recommended
as it prevents multi instances of the driver to run.

Make it a member of the da9063 structure instead.

Signed-off-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20241018135821.274376-1-festevam@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>

authored by

Fabio Estevam and committed by
Wim Van Sebroeck
076354a4 3a6a399c

+6 -4
+5 -4
drivers/watchdog/da9063_wdt.c
··· 27 27 * others: timeout = 2048 ms * 2^(TWDSCALE-1). 28 28 */ 29 29 static const unsigned int wdt_timeout[] = { 0, 2, 4, 8, 16, 32, 65, 131 }; 30 - static bool use_sw_pm; 31 30 32 31 #define DA9063_TWDSCALE_DISABLE 0 33 32 #define DA9063_TWDSCALE_MIN 1 ··· 229 230 if (!wdd) 230 231 return -ENOMEM; 231 232 232 - use_sw_pm = device_property_present(dev, "dlg,use-sw-pm"); 233 + da9063->use_sw_pm = device_property_present(dev, "dlg,use-sw-pm"); 233 234 234 235 wdd->info = &da9063_watchdog_info; 235 236 wdd->ops = &da9063_watchdog_ops; ··· 266 267 static int __maybe_unused da9063_wdt_suspend(struct device *dev) 267 268 { 268 269 struct watchdog_device *wdd = dev_get_drvdata(dev); 270 + struct da9063 *da9063 = watchdog_get_drvdata(wdd); 269 271 270 - if (!use_sw_pm) 272 + if (!da9063->use_sw_pm) 271 273 return 0; 272 274 273 275 if (watchdog_active(wdd)) ··· 280 280 static int __maybe_unused da9063_wdt_resume(struct device *dev) 281 281 { 282 282 struct watchdog_device *wdd = dev_get_drvdata(dev); 283 + struct da9063 *da9063 = watchdog_get_drvdata(wdd); 283 284 284 - if (!use_sw_pm) 285 + if (!da9063->use_sw_pm) 285 286 return 0; 286 287 287 288 if (watchdog_active(wdd))
+1
include/linux/mfd/da9063/core.h
··· 78 78 enum da9063_type type; 79 79 unsigned char variant_code; 80 80 unsigned int flags; 81 + bool use_sw_pm; 81 82 82 83 /* Control interface */ 83 84 struct regmap *regmap;