The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] HID: Convert to DEFINE_SIMPLE_DEV_PM_OPS()
@ 2026-08-20  9:09 Triet Hoang
  0 siblings, 0 replies; only message in thread
From: Triet Hoang @ 2026-08-20  9:09 UTC (permalink / raw)
  To: basavaraj.natikar; +Cc: jikos, bentiss, linux-input, linux-kernel, Triet Hoang

Convert the deprecated SIMPLE_DEV_PM_OPS
to DEFINE_SIMPLE_DEV_PM_OPS and pm_sleep_ptr().

This lets us drop the __maybe_unused annotations from the suspend and
resume callbacks, and reduces kernel size in case CONFIG_PM or
CONFIG_PM_SLEEP is disabled.

Signed-off-by: Triet Hoang <triet.hoang.dev@gmail.com>
---
 drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 8 ++++----
 drivers/hid/hid-google-hammer.c        | 6 +++---
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
index eda26a094d3f..731dfdd459ac 100644
--- a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
+++ b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
@@ -560,7 +560,7 @@ static void amd_sfh_shutdown(struct pci_dev *pdev)
 	}
 }
 
-static int __maybe_unused amd_mp2_pci_resume(struct device *dev)
+static int amd_mp2_pci_resume(struct device *dev)
 {
 	struct amd_mp2_dev *mp2 = dev_get_drvdata(dev);
 
@@ -571,7 +571,7 @@ static int __maybe_unused amd_mp2_pci_resume(struct device *dev)
 	return 0;
 }
 
-static int __maybe_unused amd_mp2_pci_suspend(struct device *dev)
+static int amd_mp2_pci_suspend(struct device *dev)
 {
 	struct amd_mp2_dev *mp2 = dev_get_drvdata(dev);
 
@@ -582,7 +582,7 @@ static int __maybe_unused amd_mp2_pci_suspend(struct device *dev)
 	return 0;
 }
 
-static SIMPLE_DEV_PM_OPS(amd_mp2_pm_ops, amd_mp2_pci_suspend,
+static DEFINE_SIMPLE_DEV_PM_OPS(amd_mp2_pm_ops, amd_mp2_pci_suspend,
 		amd_mp2_pci_resume);
 
 static const struct pci_device_id amd_mp2_pci_tbl[] = {
@@ -596,7 +596,7 @@ static struct pci_driver amd_mp2_pci_driver = {
 	.name		= DRIVER_NAME,
 	.id_table	= amd_mp2_pci_tbl,
 	.probe		= amd_mp2_pci_probe,
-	.driver.pm	= &amd_mp2_pm_ops,
+	.driver.pm	= pm_sleep_ptr(&amd_mp2_pm_ops),
 	.shutdown	= amd_sfh_shutdown,
 	.remove		= amd_sfh_remove,
 	.dev_groups	= amd_sfh_groups,
diff --git a/drivers/hid/hid-google-hammer.c b/drivers/hid/hid-google-hammer.c
index c99c3c0d442e..d7a504e48775 100644
--- a/drivers/hid/hid-google-hammer.c
+++ b/drivers/hid/hid-google-hammer.c
@@ -132,7 +132,7 @@ static int cbas_ec_notify(struct notifier_block *nb,
 	return NOTIFY_OK;
 }
 
-static __maybe_unused int cbas_ec_resume(struct device *dev)
+static int cbas_ec_resume(struct device *dev)
 {
 	struct cros_ec_device *ec = dev_get_drvdata(dev->parent);
 	bool base_present;
@@ -163,7 +163,7 @@ static __maybe_unused int cbas_ec_resume(struct device *dev)
 	return 0;
 }
 
-static SIMPLE_DEV_PM_OPS(cbas_ec_pm_ops, NULL, cbas_ec_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(cbas_ec_pm_ops, NULL, cbas_ec_resume);
 
 static void cbas_ec_set_input(struct input_dev *input)
 {
@@ -289,7 +289,7 @@ static struct platform_driver cbas_ec_driver = {
 		.name = "cbas_ec",
 		.acpi_match_table = ACPI_PTR(cbas_ec_acpi_ids),
 		.of_match_table = of_match_ptr(cbas_ec_of_match),
-		.pm = &cbas_ec_pm_ops,
+		.pm = pm_sleep_ptr(&cbas_ec_pm_ops),
 	},
 };
 
-- 
2.53.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-08-20  9:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-20  9:09 [PATCH] HID: Convert to DEFINE_SIMPLE_DEV_PM_OPS() Triet Hoang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox