usb: dwc3: imx8mp: Switch to RUNTIME/SYSTEM_SLEEP_PM_OPS()
Subsystems (3)
Fabio Estevam
reviewerPATCH 1/1 usb: dwc3: imx8mp: Switch to RUNTIME/SYSTEM_SLEEP_PM_OPS()
From: Fabio Estevam <[email protected]>
Replace SET_RUNTIME_PM_OPS()/SET SYSTEM_SLEEP_PM_OPS() with their modern RUNTIME_PM_OPS() and SYSTEM_SLEEP_PM_OPS() alternatives.
The combined usage of pm_ptr() and RUNTIME_PM_OPS/SYSTEM_SLEEP_PM_OPS() allows the compiler to evaluate if the runtime suspend/resume() functions are used at build time or are simply dead code.
This allows removing the __maybe_unused notation from the runtime suspend/resume() functions.
--- drivers/usb/dwc3/dwc3-imx8mp.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-)
drivers/usb/dwc3/dwc3-imx8mp.c +10 -12
@@ -282,8 +282,7 @@ static void dwc3_imx8mp_remove(struct platform_device *pdev)pm_runtime_put_noidle (dev); } -static int __maybe_unused dwc3_imx8mp_suspend (struct dwc3_imx8mp *dwc3_imx, -pm_message_t msg) +static int dwc3_imx8mp_suspend (struct dwc3_imx8mp *dwc3_imx,pm_message_t msg) {if (dwc3_imx->pm_suspended)return 0 ;
@@ -297,8 +296,7 @@ static int __maybe_unused dwc3_imx8mp_suspend(struct dwc3_imx8mp *dwc3_imx,return 0 ; } -static int __maybe_unused dwc3_imx8mp_resume (struct dwc3_imx8mp *dwc3_imx, -pm_message_t msg) +static int dwc3_imx8mp_resume (struct dwc3_imx8mp *dwc3_imx,pm_message_t msg) {struct dwc3 *dwc =platform_get_drvdata (dwc3_imx->dwc3);int ret =0 ;
@@ -331,7 +329,7 @@ static int __maybe_unused dwc3_imx8mp_resume(struct dwc3_imx8mp *dwc3_imx,return ret; } -static int __maybe_unused dwc3_imx8mp_pm_suspend (struct device *dev) +static int dwc3_imx8mp_pm_suspend (struct device *dev) {struct dwc3_imx8mp *dwc3_imx =dev_get_drvdata (dev);int ret;
@@ -349,7 +347,7 @@ static int __maybe_unused dwc3_imx8mp_pm_suspend(struct device *dev)return ret; } -static int __maybe_unused dwc3_imx8mp_pm_resume (struct device *dev) +static int dwc3_imx8mp_pm_resume (struct device *dev) {struct dwc3_imx8mp *dwc3_imx =dev_get_drvdata (dev);int ret;
@@ -379,7 +377,7 @@ static int __maybe_unused dwc3_imx8mp_pm_resume(struct device *dev)return ret; } -static int __maybe_unused dwc3_imx8mp_runtime_suspend (struct device *dev) +static int dwc3_imx8mp_runtime_suspend (struct device *dev) {struct dwc3_imx8mp *dwc3_imx =dev_get_drvdata (dev);
@@ -388,7 +386,7 @@ static int __maybe_unused dwc3_imx8mp_runtime_suspend(struct device *dev)return dwc3_imx8mp_suspend (dwc3_imx,PMSG_AUTO_SUSPEND ); } -static int __maybe_unused dwc3_imx8mp_runtime_resume (struct device *dev) +static int dwc3_imx8mp_runtime_resume (struct device *dev) {struct dwc3_imx8mp *dwc3_imx =dev_get_drvdata (dev);
@@ -398,9 +396,9 @@ static int __maybe_unused dwc3_imx8mp_runtime_resume(struct device *dev) }static const struct dev_pm_ops dwc3_imx8mp_dev_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(dwc3_imx8mp_pm_suspend, dwc3_imx8mp_pm_resume) -SET_RUNTIME_PM_OPS (dwc3_imx8mp_runtime_suspend, - dwc3_imx8mp_runtime_resume,NULL ) + SYSTEM_SLEEP_PM_OPS(dwc3_imx8mp_pm_suspend, dwc3_imx8mp_pm_resume) +RUNTIME_PM_OPS (dwc3_imx8mp_runtime_suspend, dwc3_imx8mp_runtime_resume, +NULL ) };static const struct of_device_id dwc3_imx8mp_of_match[] = {
@@ -414,7 +412,7 @@ static struct platform_driver dwc3_imx8mp_driver = { .remove_new = dwc3_imx8mp_remove, .driver = { .name = "imx8mp-dwc3", - .pm = &dwc3_imx8mp_dev_pm_ops, + .pm = pm_ptr(&dwc3_imx8mp_dev_pm_ops), .of_match_table = dwc3_imx8mp_of_match, }, };
Signature · 1 line
2.34.1
Quoted 102 lines · Fabio Estevam
From: Fabio Estevam <[email protected]>
Replace SET_RUNTIME_PM_OPS()/SET
SYSTEM_SLEEP_PM_OPS()with their modernRUNTIME_PM_OPS()andSYSTEM_SLEEP_PM_OPS()alternatives.The combined usage of
pm_ptr()and RUNTIME_PM_OPS/SYSTEM_SLEEP_PM_OPS() allows the compiler to evaluate if the runtime suspend/resume() functions are used at build time or are simply dead code.This allows removing the
__maybe_unusednotation from the runtime suspend/resume() functions.Signed-off-by Fabio Estevam <[email protected]>--- drivers/usb/dwc3/dwc3-imx8mp.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-)drivers/usb/dwc3/dwc3-imx8mp.c +10
-12@@ -282,8 +282,7 @@ static void dwc3_imx8mp_remove(struct platform_device *pdev)pm_runtime_put_noidle (dev); } -static int __maybe_unused dwc3_imx8mp_suspend (struct dwc3_imx8mp *dwc3_imx, -pm_message_t msg) +static int dwc3_imx8mp_suspend (struct dwc3_imx8mp *dwc3_imx,pm_message_t msg) {if (dwc3_imx->pm_suspended)return 0 ;@@ -297,8 +296,7 @@ static int __maybe_unused dwc3_imx8mp_suspend(struct dwc3_imx8mp *dwc3_imx,return 0 ; } -static int __maybe_unused dwc3_imx8mp_resume (struct dwc3_imx8mp *dwc3_imx, -pm_message_t msg) +static int dwc3_imx8mp_resume (struct dwc3_imx8mp *dwc3_imx,pm_message_t msg) {struct dwc3 *dwc =platform_get_drvdata (dwc3_imx->dwc3);int ret =0 ;@@ -331,7 +329,7 @@ static int __maybe_unused dwc3_imx8mp_resume(struct dwc3_imx8mp *dwc3_imx,return ret; } -static int __maybe_unused dwc3_imx8mp_pm_suspend (struct device *dev) +static int dwc3_imx8mp_pm_suspend (struct device *dev) {struct dwc3_imx8mp *dwc3_imx =dev_get_drvdata (dev);int ret;@@ -349,7 +347,7 @@ static int __maybe_unused dwc3_imx8mp_pm_suspend(struct device *dev)return ret; } -static int __maybe_unused dwc3_imx8mp_pm_resume (struct device *dev) +static int dwc3_imx8mp_pm_resume (struct device *dev) {struct dwc3_imx8mp *dwc3_imx =dev_get_drvdata (dev);int ret;@@ -379,7 +377,7 @@ static int __maybe_unused dwc3_imx8mp_pm_resume(struct device *dev)return ret; } -static int __maybe_unused dwc3_imx8mp_runtime_suspend (struct device *dev) +static int dwc3_imx8mp_runtime_suspend (struct device *dev) {struct dwc3_imx8mp *dwc3_imx =dev_get_drvdata (dev);@@ -388,7 +386,7 @@ static int __maybe_unused dwc3_imx8mp_runtime_suspend(struct device *dev)return dwc3_imx8mp_suspend (dwc3_imx,PMSG_AUTO_SUSPEND ); } -static int __maybe_unused dwc3_imx8mp_runtime_resume (struct device *dev) +static int dwc3_imx8mp_runtime_resume (struct device *dev) {struct dwc3_imx8mp *dwc3_imx =dev_get_drvdata (dev);@@ -398,9 +396,9 @@ static int __maybe_unused dwc3_imx8mp_runtime_resume(struct device *dev) }static const struct dev_pm_ops dwc3_imx8mp_dev_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(dwc3_imx8mp_pm_suspend, dwc3_imx8mp_pm_resume) -SET_RUNTIME_PM_OPS (dwc3_imx8mp_runtime_suspend, - dwc3_imx8mp_runtime_resume,NULL ) + SYSTEM_SLEEP_PM_OPS(dwc3_imx8mp_pm_suspend, dwc3_imx8mp_pm_resume) +RUNTIME_PM_OPS (dwc3_imx8mp_runtime_suspend, dwc3_imx8mp_runtime_resume, +NULL ) };static const struct of_device_id dwc3_imx8mp_of_match[] = {@@ -414,7 +412,7 @@ static struct platform_driver dwc3_imx8mp_driver = { .remove_new = dwc3_imx8mp_remove, .driver = { .name = "imx8mp-dwc3", - .pm = &dwc3_imx8mp_dev_pm_ops, + .pm = pm_ptr(&dwc3_imx8mp_dev_pm_ops), .of_match_table = dwc3_imx8mp_of_match, }, };Signature · 1 line
2.34.1
Thanks,
Thinh