Messages in this thread Patch in this message | | | From | Gwendal Grignou <> | Subject | [PATCH 1/3] plaform/chrome: remove SET_SYSTEM_SLEEP_PM_OPS | Date | Mon, 3 Jan 2022 22:22:11 -0800 |
| |
commit 296282fca791 ("PM: core: Add new *_PM_OPS macros, deprecate old ones") replaces SET_SIMPLE_DEV_PM_OPS with DEFINE_SIMPLE_DEV_PM_OPS.
Use sed and a cocci script to replace the macro and remove __maybe_unused: @Replacement@ identifier operation; identifier suspend, resume; @@ - static const struct dev_pm_ops operation = { SET_SYSTEM_SLEEP_PM_OPS(suspend, resume) }; + gg_fc operation = gg_arg(suspend, resume);
@@ identifier Replacement.suspend; identifier dev; @@
- __maybe_unused suspend(struct device* dev ) { ... } @@ identifier Replacement.resume; identifier dev; @@
- __maybe_unused resume(struct device* dev ) { ... }
@@ identifier Replacement.operation; @@
- &operation + pm_sleep_ptr(&operation)
spatch -sp_file no_SET_SYSTEM_SLEEP_PM_OPS.cocci -dir drivers/platform/chrome | patch -p 1 -d drivers/platform/chrome sed -i 's/gg_fc \(.*\) = gg_arg(/DEFINE_SIMPLE_DEV_PM_OPS(\1, /' $(git diff --name-only)
Signed-off-by: Gwendal Grignou <gwendal@chromium.org> --- drivers/platform/chrome/cros_ec_typec.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c index 5de0bfb0bc4d99..c3d449f9e38bc6 100644 --- a/drivers/platform/chrome/cros_ec_typec.c +++ b/drivers/platform/chrome/cros_ec_typec.c @@ -1129,7 +1129,7 @@ static int cros_typec_probe(struct platform_device *pdev) return ret; } -static int __maybe_unused cros_typec_suspend(struct device *dev) +static int cros_typec_suspend(struct device *dev) { struct cros_typec_data *typec = dev_get_drvdata(dev); @@ -1138,7 +1138,7 @@ static int __maybe_unused cros_typec_suspend(struct device *dev) return 0; } -static int __maybe_unused cros_typec_resume(struct device *dev) +static int cros_typec_resume(struct device *dev) { struct cros_typec_data *typec = dev_get_drvdata(dev); @@ -1148,16 +1148,14 @@ static int __maybe_unused cros_typec_resume(struct device *dev) return 0; } -static const struct dev_pm_ops cros_typec_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(cros_typec_suspend, cros_typec_resume) -}; +DEFINE_SIMPLE_DEV_PM_OPS(cros_typec_pm_ops, cros_typec_suspend, cros_typec_resume); static struct platform_driver cros_typec_driver = { .driver = { .name = DRV_NAME, .acpi_match_table = ACPI_PTR(cros_typec_acpi_id), .of_match_table = of_match_ptr(cros_typec_of_match), - .pm = &cros_typec_pm_ops, + .pm = pm_sleep_ptr(&cros_typec_pm_ops), }, .probe = cros_typec_probe, }; -- 2.34.1.448.ga2b2bfdf31-goog
| |