Commit 692562ab authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Hans de Goede

platform/x86: hp_accel: Use SIMPLE_DEV_PM_OPS() for PM ops

After the commit 34570a89 ("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.
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20211206151521.22578-1-andriy.shevchenko@linux.intel.comReviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
parent 27247992
...@@ -355,39 +355,20 @@ static int lis3lv02d_remove(struct platform_device *device) ...@@ -355,39 +355,20 @@ static int lis3lv02d_remove(struct platform_device *device)
return 0; return 0;
} }
#ifdef CONFIG_PM_SLEEP static int __maybe_unused lis3lv02d_suspend(struct device *dev)
static int lis3lv02d_suspend(struct device *dev)
{ {
/* make sure the device is off when we suspend */ /* make sure the device is off when we suspend */
lis3lv02d_poweroff(&lis3_dev); lis3lv02d_poweroff(&lis3_dev);
return 0; return 0;
} }
static int lis3lv02d_resume(struct device *dev) static int __maybe_unused lis3lv02d_resume(struct device *dev)
{ {
lis3lv02d_poweron(&lis3_dev); lis3lv02d_poweron(&lis3_dev);
return 0; return 0;
} }
static int lis3lv02d_restore(struct device *dev) static SIMPLE_DEV_PM_OPS(hp_accel_pm, lis3lv02d_suspend, lis3lv02d_resume);
{
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
/* For the HP MDPS aka 3D Driveguard */ /* For the HP MDPS aka 3D Driveguard */
static struct platform_driver lis3lv02d_driver = { static struct platform_driver lis3lv02d_driver = {
...@@ -395,7 +376,7 @@ static struct platform_driver lis3lv02d_driver = { ...@@ -395,7 +376,7 @@ static struct platform_driver lis3lv02d_driver = {
.remove = lis3lv02d_remove, .remove = lis3lv02d_remove,
.driver = { .driver = {
.name = "hp_accel", .name = "hp_accel",
.pm = HP_ACCEL_PM, .pm = &hp_accel_pm,
.acpi_match_table = lis3lv02d_device_ids, .acpi_match_table = lis3lv02d_device_ids,
}, },
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment