Move suspend/resume functions to dev_pm_ops

Replace deprecated interface functions with newer PM interface.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
This commit is contained in:
Tim Crawford 2025-06-10 15:12:58 -06:00
parent 3fa766c549
commit 293de8964e
No known key found for this signature in database
GPG Key ID: 68E558D2BBD856E3
1 changed files with 13 additions and 4 deletions

View File

@ -246,7 +246,7 @@ static int s76_remove(struct platform_device *dev)
#endif #endif
} }
static int s76_suspend(struct platform_device *dev, pm_message_t status) static int s76_suspend(struct device *dev)
{ {
pr_debug("%s\n", __func__); pr_debug("%s\n", __func__);
@ -257,7 +257,7 @@ static int s76_suspend(struct platform_device *dev, pm_message_t status)
return 0; return 0;
} }
static int s76_resume(struct platform_device *dev) static int s76_resume(struct device *dev)
{ {
pr_debug("%s\n", __func__); pr_debug("%s\n", __func__);
@ -281,13 +281,22 @@ static int s76_resume(struct platform_device *dev)
return 0; return 0;
} }
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17, 0)
static DEFINE_SIMPLE_DEV_PM_OPS(s76_pm, s76_suspend, s76_resume);
#else
static SIMPLE_DEV_PM_OPS(s76_pm, s76_suspend, s76_resume);
#endif
static struct platform_driver s76_platform_driver = { static struct platform_driver s76_platform_driver = {
.remove = s76_remove, .remove = s76_remove,
.suspend = s76_suspend,
.resume = s76_resume,
.driver = { .driver = {
.name = S76_DRIVER_NAME, .name = S76_DRIVER_NAME,
.owner = THIS_MODULE, .owner = THIS_MODULE,
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17, 0)
.pm = pm_sleep_ptr(&s76_pm),
#else
.pm = pm_ptr(&s76_pm),
#endif
}, },
}; };