Skip to contentSkip to conversation

HID: Convert to DEFINE_SIMPLE_DEV_PM_OPS()

PATCH New Triet Hoang 1 participant 1 message Aug 20

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 HID: Convert to DEFINE_SIMPLE_DEV_PM_OPS()

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.

---
 drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 8 ++++----
 drivers/hid/hid-google-hammer.c        | 6 +++---
 2 files changed, 7 insertions(+), 7 deletions(-)
drivers/hid/amd-sfh-hid/amd_sfh_pcie.c +4 -4
index eda26a094d3f..731dfdd459ac 100644
@@ -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,
drivers/hid/hid-google-hammer.c +3 -3
index c99c3c0d442e..d7a504e48775 100644
@@ -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),
 	},
 };
 
Signature · 1 line
2.53.0