Skip to content

Commit df8b030

Browse files
t-8chBenjamin Tissoires
authored andcommitted
HID: core: remove #ifdef CONFIG_PM from hid_driver
Allow HID drivers to pass ->suspend, ->resume and ->reset_resume via pm_ptr(). Through the usage of pm_ptr() the CONFIG_PM-dependent code will always be compiled, protecting against bitrot. The linker will then garbage-collect the unused function avoiding any overhead. The only overhead in the final kernel image and at runtime are a few extra bytes in 'struct hid_driver'. The same approach is chosen by 'struct usb_driver' and other subsystems. Signed-off-by: Thomas Weißschuh <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Benjamin Tissoires <[email protected]>
1 parent bab19d1 commit df8b030

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/linux/hid.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -833,11 +833,11 @@ struct hid_driver {
833833
void (*feature_mapping)(struct hid_device *hdev,
834834
struct hid_field *field,
835835
struct hid_usage *usage);
836-
#ifdef CONFIG_PM
836+
837837
int (*suspend)(struct hid_device *hdev, pm_message_t message);
838838
int (*resume)(struct hid_device *hdev);
839839
int (*reset_resume)(struct hid_device *hdev);
840-
#endif
840+
841841
/* private: */
842842
struct device_driver driver;
843843
};

0 commit comments

Comments
 (0)