platform/x86: hp_accel: Use SIMPLE_DEV_PM_OPS() for PM ops
PATCH 1/1 platform/x86: hp_accel: Use SIMPLE_DEV_PM_OPS() for PM ops
After the commit 34570a898eef ("platform/x86: hp_accel: Remove _INI method call") there is no need to have separate methods for resume and restore, hence we may fold them together and use SIMPLE_DEV_PM_OPS() for PM ops.
While at it, switch to use __maybe_unused attribute.
--- drivers/platform/x86/hp_accel.c | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-)
drivers/platform/x86/hp_accel.c +4 -23
@@ -355,39 +355,20 @@ static int lis3lv02d_remove(struct platform_device *device)return 0 ; } -#ifdef CONFIG_PM_SLEEP -static int lis3lv02d_suspend (struct device *dev) +static int __maybe_unused lis3lv02d_suspend (struct device *dev) {/* make sure the device is off when we suspend */ lis3lv02d_poweroff (&lis3_dev);return 0 ; } -static int lis3lv02d_resume (struct device *dev) +static int __maybe_unused lis3lv02d_resume (struct device *dev) {lis3lv02d_poweron (&lis3_dev);return 0 ; } -static int lis3lv02d_restore (struct device *dev) -{ -lis3lv02d_poweron (&lis3_dev); -return 0 ; -} - -static const struct dev_pm_ops hp_accel_pm = { - .suspend = lis3lv02d_suspend, - .resume = lis3lv02d_resume, - .freeze = lis3lv02d_suspend, - .thaw = lis3lv02d_resume, - .poweroff = lis3lv02d_suspend, - .restore = lis3lv02d_restore, -}; - -#define HP_ACCEL_PM (&hp_accel_pm) -#else -#define HP_ACCEL_PM NULL -#endif +static SIMPLE_DEV_PM_OPS(hp_accel_pm, lis3lv02d_suspend, lis3lv02d_resume);/* For the HP MDPS aka 3D Driveguard */ static struct platform_driver lis3lv02d_driver = {
@@ -395,7 +376,7 @@ static struct platform_driver lis3lv02d_driver = { .remove = lis3lv02d_remove, .driver = { .name = "hp_accel", - .pm = HP_ACCEL_PM, + .pm = &hp_accel_pm, .acpi_match_table = lis3lv02d_device_ids, }, };
Signature · 1 line
2.33.0
Hi,
Quoted 8 lines · Andy Shevchenko
After the commit
34570a898eef("platform/x86:hp_accel: Remove_INImethod call") there is no need to have separate methods for resume and restore, hence we may fold them together and useSIMPLE_DEV_PM_OPS()for PM ops.While at it, switch to use
__maybe_unusedattribute.Signed-off-by Andy Shevchenko <[email protected]>
Thank you for your patch, I've applied this patch to my review-hans branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans
Note it will show up in my review-hans branch once I've pushed my local branch there, which might take a while.
Once I've run some tests on this branch the patches there will be added to the platform-drivers-x86/for-next branch and eventually will be included in the pdx86 pull-request to Linus for the next merge-window.
Regards,
Hans
Quoted 61 lines
--- drivers/platform/x86/hp_accel.c | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-)drivers/platform/x86/hp_accel.c +4
-23@@ -355,39 +355,20 @@ static int lis3lv02d_remove(struct platform_device *device)return 0 ; } -#ifdef CONFIG_PM_SLEEP -static int lis3lv02d_suspend (struct device *dev) +static int __maybe_unused lis3lv02d_suspend (struct device *dev) {/* make sure the device is off when we suspend */ lis3lv02d_poweroff (&lis3_dev);return 0 ; } -static int lis3lv02d_resume (struct device *dev) +static int __maybe_unused lis3lv02d_resume (struct device *dev) {lis3lv02d_poweron (&lis3_dev);return 0 ; } -static int lis3lv02d_restore (struct device *dev) -{ -lis3lv02d_poweron (&lis3_dev); -return 0 ; -} - -static const struct dev_pm_ops hp_accel_pm = { - .suspend = lis3lv02d_suspend, - .resume = lis3lv02d_resume, - .freeze = lis3lv02d_suspend, - .thaw = lis3lv02d_resume, - .poweroff = lis3lv02d_suspend, - .restore = lis3lv02d_restore, -}; - -#define HP_ACCEL_PM (&hp_accel_pm) -#else -#define HP_ACCEL_PM NULL -#endif +static SIMPLE_DEV_PM_OPS(hp_accel_pm, lis3lv02d_suspend, lis3lv02d_resume);/* For the HP MDPS aka 3D Driveguard */ static struct platform_driver lis3lv02d_driver = {@@ -395,7 +376,7 @@ static struct platform_driver lis3lv02d_driver = { .remove = lis3lv02d_remove, .driver = { .name = "hp_accel", - .pm = HP_ACCEL_PM, + .pm = &hp_accel_pm, .acpi_match_table = lis3lv02d_device_ids, }, };