Skip to content

Commit

Permalink
HID: rmi: remove #ifdef CONFIG_PM
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Thomas Weißschuh authored and Benjamin Tissoires committed Oct 25, 2023
1 parent fc25434 commit eeebfe6
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions drivers/hid/hid-rmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,6 @@ static void rmi_report(struct hid_device *hid, struct hid_report *report)
input_sync(field->hidinput->input);
}

#ifdef CONFIG_PM
static int rmi_suspend(struct hid_device *hdev, pm_message_t message)
{
struct rmi_data *data = hid_get_drvdata(hdev);
Expand Down Expand Up @@ -483,7 +482,6 @@ static int rmi_post_resume(struct hid_device *hdev)
hid_hw_close(hdev);
return ret;
}
#endif /* CONFIG_PM */

static int rmi_hid_reset(struct rmi_transport_dev *xport, u16 reset_addr)
{
Expand Down Expand Up @@ -774,11 +772,9 @@ static struct hid_driver rmi_driver = {
.report = rmi_report,
.input_mapping = rmi_input_mapping,
.input_configured = rmi_input_configured,
#ifdef CONFIG_PM
.suspend = rmi_suspend,
.resume = rmi_post_resume,
.reset_resume = rmi_post_resume,
#endif
.suspend = pm_ptr(rmi_suspend),
.resume = pm_ptr(rmi_post_resume),
.reset_resume = pm_ptr(rmi_post_resume),
};

module_hid_driver(rmi_driver);
Expand Down

0 comments on commit eeebfe6

Please sign in to comment.