summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorJonathan Cameron <Jonathan.Cameron@huawei.com>2023-01-14 20:16:18 +0300
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2023-01-28 01:49:53 +0300
commit345c7b741c4631fad38bb8dc8d6659ac05d92380 (patch)
treefd8c848684f1ad862bc86a7e5c2537e2b655a0bc /drivers
parentf31e7388dd1633ed2273cc5c6a99f225ec1a5350 (diff)
downloadlinux-345c7b741c4631fad38bb8dc8d6659ac05d92380.tar.xz
Input: Use pm_sleep_ptr() to avoid need for ifdef CONFIG_PM_SLEEP
As the new pm_sleep_ptr() macro lets the compiler see the code, but then remove it if !CONFIG_PM_SLEEP it can be used to avoid the need for #ifdef guards. Use that in the input core to simplify the code a little. Note pm_sleep_ptr() has not been applied to each callback in the ops structure because the pm_sleep_ptr() at the usage site is sufficient. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Link: https://lore.kernel.org/r/20230114171620.42891-15-jic23@kernel.org Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/input/input.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/input/input.c b/drivers/input/input.c
index ca2e3dd7188b..9fdb22db2ca4 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -19,6 +19,7 @@
#include <linux/proc_fs.h>
#include <linux/sched.h>
#include <linux/seq_file.h>
+#include <linux/pm.h>
#include <linux/poll.h>
#include <linux/device.h>
#include <linux/kstrtox.h>
@@ -1828,7 +1829,6 @@ out:
return ret;
}
-#ifdef CONFIG_PM_SLEEP
static int input_dev_suspend(struct device *dev)
{
struct input_dev *input_dev = to_input_dev(dev);
@@ -1903,15 +1903,12 @@ static const struct dev_pm_ops input_dev_pm_ops = {
.poweroff = input_dev_poweroff,
.restore = input_dev_resume,
};
-#endif /* CONFIG_PM */
static const struct device_type input_dev_type = {
.groups = input_dev_attr_groups,
.release = input_dev_release,
.uevent = input_dev_uevent,
-#ifdef CONFIG_PM_SLEEP
- .pm = &input_dev_pm_ops,
-#endif
+ .pm = pm_sleep_ptr(&input_dev_pm_ops),
};
static char *input_devnode(const struct device *dev, umode_t *mode)