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

HID: rmi: 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-4-0a71531ca93b@weissschuh.net
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>

authored by

Thomas Weißschuh and committed by
Benjamin Tissoires
eeebfe62 fc254341

+3 -7
+3 -7
drivers/hid/hid-rmi.c
··· 436 436 input_sync(field->hidinput->input); 437 437 } 438 438 439 - #ifdef CONFIG_PM 440 439 static int rmi_suspend(struct hid_device *hdev, pm_message_t message) 441 440 { 442 441 struct rmi_data *data = hid_get_drvdata(hdev); ··· 482 483 hid_hw_close(hdev); 483 484 return ret; 484 485 } 485 - #endif /* CONFIG_PM */ 486 486 487 487 static int rmi_hid_reset(struct rmi_transport_dev *xport, u16 reset_addr) 488 488 { ··· 772 774 .report = rmi_report, 773 775 .input_mapping = rmi_input_mapping, 774 776 .input_configured = rmi_input_configured, 775 - #ifdef CONFIG_PM 776 - .suspend = rmi_suspend, 777 - .resume = rmi_post_resume, 778 - .reset_resume = rmi_post_resume, 779 - #endif 777 + .suspend = pm_ptr(rmi_suspend), 778 + .resume = pm_ptr(rmi_post_resume), 779 + .reset_resume = pm_ptr(rmi_post_resume), 780 780 }; 781 781 782 782 module_hid_driver(rmi_driver);