Skip to content

Commit f354872

Browse files
t-8chBenjamin Tissoires
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Benjamin Tissoires <[email protected]>
1 parent df8b030 commit f354872

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

drivers/hid/usbhid/hid-core.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1562,7 +1562,6 @@ static int hid_post_reset(struct usb_interface *intf)
15621562
return 0;
15631563
}
15641564

1565-
#ifdef CONFIG_PM
15661565
static int hid_resume_common(struct hid_device *hid, bool driver_suspended)
15671566
{
15681567
int status = 0;
@@ -1654,8 +1653,6 @@ static int hid_reset_resume(struct usb_interface *intf)
16541653
return status;
16551654
}
16561655

1657-
#endif /* CONFIG_PM */
1658-
16591656
static const struct usb_device_id hid_usb_ids[] = {
16601657
{ .match_flags = USB_DEVICE_ID_MATCH_INT_CLASS,
16611658
.bInterfaceClass = USB_INTERFACE_CLASS_HID },
@@ -1668,11 +1665,9 @@ static struct usb_driver hid_driver = {
16681665
.name = "usbhid",
16691666
.probe = usbhid_probe,
16701667
.disconnect = usbhid_disconnect,
1671-
#ifdef CONFIG_PM
1672-
.suspend = hid_suspend,
1673-
.resume = hid_resume,
1674-
.reset_resume = hid_reset_resume,
1675-
#endif
1668+
.suspend = pm_ptr(hid_suspend),
1669+
.resume = pm_ptr(hid_resume),
1670+
.reset_resume = pm_ptr(hid_reset_resume),
16761671
.pre_reset = hid_pre_reset,
16771672
.post_reset = hid_post_reset,
16781673
.id_table = hid_usb_ids,

0 commit comments

Comments
 (0)