Skip to content

Commit 345c7b7

Browse files
jic23dtor
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent f31e738 commit 345c7b7

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

drivers/input/input.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <linux/proc_fs.h>
2020
#include <linux/sched.h>
2121
#include <linux/seq_file.h>
22+
#include <linux/pm.h>
2223
#include <linux/poll.h>
2324
#include <linux/device.h>
2425
#include <linux/kstrtox.h>
@@ -1828,7 +1829,6 @@ static int input_uninhibit_device(struct input_dev *dev)
18281829
return ret;
18291830
}
18301831

1831-
#ifdef CONFIG_PM_SLEEP
18321832
static int input_dev_suspend(struct device *dev)
18331833
{
18341834
struct input_dev *input_dev = to_input_dev(dev);
@@ -1903,15 +1903,12 @@ static const struct dev_pm_ops input_dev_pm_ops = {
19031903
.poweroff = input_dev_poweroff,
19041904
.restore = input_dev_resume,
19051905
};
1906-
#endif /* CONFIG_PM */
19071906

19081907
static const struct device_type input_dev_type = {
19091908
.groups = input_dev_attr_groups,
19101909
.release = input_dev_release,
19111910
.uevent = input_dev_uevent,
1912-
#ifdef CONFIG_PM_SLEEP
1913-
.pm = &input_dev_pm_ops,
1914-
#endif
1911+
.pm = pm_sleep_ptr(&input_dev_pm_ops),
19151912
};
19161913

19171914
static char *input_devnode(const struct device *dev, umode_t *mode)

0 commit comments

Comments
 (0)