Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

HID: usbhid: remove #ifdef CONFIG_PM

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.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://lore.kernel.org/r/20231012-hid-pm_ptr-v1-2-0a71531ca93b@weissschuh.net
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>

authored by

Thomas Weißschuh and committed by
Benjamin Tissoires
f3548721 df8b030d

+3 -8
+3 -8
drivers/hid/usbhid/hid-core.c
··· 1562 1562 return 0; 1563 1563 } 1564 1564 1565 - #ifdef CONFIG_PM 1566 1565 static int hid_resume_common(struct hid_device *hid, bool driver_suspended) 1567 1566 { 1568 1567 int status = 0; ··· 1653 1654 return status; 1654 1655 } 1655 1656 1656 - #endif /* CONFIG_PM */ 1657 - 1658 1657 static const struct usb_device_id hid_usb_ids[] = { 1659 1658 { .match_flags = USB_DEVICE_ID_MATCH_INT_CLASS, 1660 1659 .bInterfaceClass = USB_INTERFACE_CLASS_HID }, ··· 1665 1668 .name = "usbhid", 1666 1669 .probe = usbhid_probe, 1667 1670 .disconnect = usbhid_disconnect, 1668 - #ifdef CONFIG_PM 1669 - .suspend = hid_suspend, 1670 - .resume = hid_resume, 1671 - .reset_resume = hid_reset_resume, 1672 - #endif 1671 + .suspend = pm_ptr(hid_suspend), 1672 + .resume = pm_ptr(hid_resume), 1673 + .reset_resume = pm_ptr(hid_reset_resume), 1673 1674 .pre_reset = hid_pre_reset, 1674 1675 .post_reset = hid_post_reset, 1675 1676 .id_table = hid_usb_ids,