]> www.infradead.org Git - users/jedix/linux-maple.git/commit
HID: core: remove #ifdef CONFIG_PM from hid_driver
authorThomas Weißschuh <linux@weissschuh.net>
Thu, 12 Oct 2023 10:23:38 +0000 (12:23 +0200)
committerBenjamin Tissoires <bentiss@kernel.org>
Wed, 25 Oct 2023 16:33:42 +0000 (18:33 +0200)
commitdf8b030d82dd1224881acb4e778fa06c4824f72b
tree71116db8edf3f34ad755aa8b781fe8e989bd92b4
parentbab19d1b21547046b0a38dde948086f6cbcaefaa
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 <linux@weissschuh.net>
Link: https://lore.kernel.org/r/20231012-hid-pm_ptr-v1-1-0a71531ca93b@weissschuh.net
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
include/linux/hid.h