Skip to content

Commit c1eaa8c

Browse files
pcercueiWim Van Sebroeck
authored andcommitted
watchdog: tegra_wdt: Remove #ifdef guards for PM related functions
Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle the .suspend/.resume callbacks. These macros allow the suspend and resume functions to be automatically dropped by the compiler when CONFIG_SUSPEND is disabled, without having to use #ifdef guards. Not using #ifdef guards means that the code is always compiled independently of any Kconfig option, and thanks to that bugs and regressions are easier to catch. While at it, the functions tegra_wdt_runtime_{suspend,resume} were renamed to tegra_wdt_{suspend,resume}, as they are *not* runtime-PM callbacks, but standard system suspend/resume callbacks. Signed-off-by: Paul Cercueil <[email protected]> Cc: Thierry Reding <[email protected]> Cc: Jonathan Hunter <[email protected]> Cc: [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 29958ab commit c1eaa8c

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

drivers/watchdog/tegra_wdt.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,7 @@ static int tegra_wdt_probe(struct platform_device *pdev)
230230
return 0;
231231
}
232232

233-
#ifdef CONFIG_PM_SLEEP
234-
static int tegra_wdt_runtime_suspend(struct device *dev)
233+
static int tegra_wdt_suspend(struct device *dev)
235234
{
236235
struct tegra_wdt *wdt = dev_get_drvdata(dev);
237236

@@ -241,7 +240,7 @@ static int tegra_wdt_runtime_suspend(struct device *dev)
241240
return 0;
242241
}
243242

244-
static int tegra_wdt_runtime_resume(struct device *dev)
243+
static int tegra_wdt_resume(struct device *dev)
245244
{
246245
struct tegra_wdt *wdt = dev_get_drvdata(dev);
247246

@@ -250,24 +249,21 @@ static int tegra_wdt_runtime_resume(struct device *dev)
250249

251250
return 0;
252251
}
253-
#endif
254252

255253
static const struct of_device_id tegra_wdt_of_match[] = {
256254
{ .compatible = "nvidia,tegra30-timer", },
257255
{ },
258256
};
259257
MODULE_DEVICE_TABLE(of, tegra_wdt_of_match);
260258

261-
static const struct dev_pm_ops tegra_wdt_pm_ops = {
262-
SET_SYSTEM_SLEEP_PM_OPS(tegra_wdt_runtime_suspend,
263-
tegra_wdt_runtime_resume)
264-
};
259+
static DEFINE_SIMPLE_DEV_PM_OPS(tegra_wdt_pm_ops,
260+
tegra_wdt_suspend, tegra_wdt_resume);
265261

266262
static struct platform_driver tegra_wdt_driver = {
267263
.probe = tegra_wdt_probe,
268264
.driver = {
269265
.name = "tegra-wdt",
270-
.pm = &tegra_wdt_pm_ops,
266+
.pm = pm_sleep_ptr(&tegra_wdt_pm_ops),
271267
.of_match_table = tegra_wdt_of_match,
272268
},
273269
};

0 commit comments

Comments
 (0)