Skip to content

Commit 47e79d3

Browse files
jic23dtor
authored andcommitted
Input: wistron_btns - use pm_sleep_ptr() to allow removal of ifdef CONFIG_PM guards
As the guards only apply to suspend and resume, #ifdef CONFIG_PM_SLEEP would have been a tighter protection. As pm_sleep_ptr() lets the compiler see the protected ops structure and callbacks but also lets the compiler remove it as unused code if !CONFIG_PM_SLEEP this allows the #ifdef guards to be removed, slightly simplifying the resulting code. -- It seems likely that DEFINE_SIMPLE_DEV_PM_OPS() would work here but I'd prefer not to make that change unless someone can confirm that the extra callbacks registered will have no unwanted side effects in this driver. Signed-off-by: Jonathan Cameron <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent f33f61a commit 47e79d3

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

drivers/input/misc/wistron_btns.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1295,7 +1295,6 @@ static int wistron_remove(struct platform_device *dev)
12951295
return 0;
12961296
}
12971297

1298-
#ifdef CONFIG_PM
12991298
static int wistron_suspend(struct device *dev)
13001299
{
13011300
if (have_wifi)
@@ -1330,14 +1329,11 @@ static const struct dev_pm_ops wistron_pm_ops = {
13301329
.poweroff = wistron_suspend,
13311330
.restore = wistron_resume,
13321331
};
1333-
#endif
13341332

13351333
static struct platform_driver wistron_driver = {
13361334
.driver = {
13371335
.name = "wistron-bios",
1338-
#ifdef CONFIG_PM
1339-
.pm = &wistron_pm_ops,
1340-
#endif
1336+
.pm = pm_sleep_ptr(&wistron_pm_ops),
13411337
},
13421338
.probe = wistron_probe,
13431339
.remove = wistron_remove,

0 commit comments

Comments
 (0)