Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: dwc3: imx8mp: Switch to RUNTIME/SYSTEM_SLEEP_PM_OPS()

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.

Signed-off-by: Fabio Estevam <festevam@denx.de>
Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/20240806114231.2603055-1-festevam@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Fabio Estevam and committed by
Greg Kroah-Hartman
89b75391 26012615

+10 -12
+10 -12
drivers/usb/dwc3/dwc3-imx8mp.c
··· 282 282 pm_runtime_put_noidle(dev); 283 283 } 284 284 285 - static int __maybe_unused dwc3_imx8mp_suspend(struct dwc3_imx8mp *dwc3_imx, 286 - pm_message_t msg) 285 + static int dwc3_imx8mp_suspend(struct dwc3_imx8mp *dwc3_imx, pm_message_t msg) 287 286 { 288 287 if (dwc3_imx->pm_suspended) 289 288 return 0; ··· 296 297 return 0; 297 298 } 298 299 299 - static int __maybe_unused dwc3_imx8mp_resume(struct dwc3_imx8mp *dwc3_imx, 300 - pm_message_t msg) 300 + static int dwc3_imx8mp_resume(struct dwc3_imx8mp *dwc3_imx, pm_message_t msg) 301 301 { 302 302 struct dwc3 *dwc = platform_get_drvdata(dwc3_imx->dwc3); 303 303 int ret = 0; ··· 329 331 return ret; 330 332 } 331 333 332 - static int __maybe_unused dwc3_imx8mp_pm_suspend(struct device *dev) 334 + static int dwc3_imx8mp_pm_suspend(struct device *dev) 333 335 { 334 336 struct dwc3_imx8mp *dwc3_imx = dev_get_drvdata(dev); 335 337 int ret; ··· 347 349 return ret; 348 350 } 349 351 350 - static int __maybe_unused dwc3_imx8mp_pm_resume(struct device *dev) 352 + static int dwc3_imx8mp_pm_resume(struct device *dev) 351 353 { 352 354 struct dwc3_imx8mp *dwc3_imx = dev_get_drvdata(dev); 353 355 int ret; ··· 377 379 return ret; 378 380 } 379 381 380 - static int __maybe_unused dwc3_imx8mp_runtime_suspend(struct device *dev) 382 + static int dwc3_imx8mp_runtime_suspend(struct device *dev) 381 383 { 382 384 struct dwc3_imx8mp *dwc3_imx = dev_get_drvdata(dev); 383 385 ··· 386 388 return dwc3_imx8mp_suspend(dwc3_imx, PMSG_AUTO_SUSPEND); 387 389 } 388 390 389 - static int __maybe_unused dwc3_imx8mp_runtime_resume(struct device *dev) 391 + static int dwc3_imx8mp_runtime_resume(struct device *dev) 390 392 { 391 393 struct dwc3_imx8mp *dwc3_imx = dev_get_drvdata(dev); 392 394 ··· 396 398 } 397 399 398 400 static const struct dev_pm_ops dwc3_imx8mp_dev_pm_ops = { 399 - SET_SYSTEM_SLEEP_PM_OPS(dwc3_imx8mp_pm_suspend, dwc3_imx8mp_pm_resume) 400 - SET_RUNTIME_PM_OPS(dwc3_imx8mp_runtime_suspend, 401 - dwc3_imx8mp_runtime_resume, NULL) 401 + SYSTEM_SLEEP_PM_OPS(dwc3_imx8mp_pm_suspend, dwc3_imx8mp_pm_resume) 402 + RUNTIME_PM_OPS(dwc3_imx8mp_runtime_suspend, dwc3_imx8mp_runtime_resume, 403 + NULL) 402 404 }; 403 405 404 406 static const struct of_device_id dwc3_imx8mp_of_match[] = { ··· 412 414 .remove_new = dwc3_imx8mp_remove, 413 415 .driver = { 414 416 .name = "imx8mp-dwc3", 415 - .pm = &dwc3_imx8mp_dev_pm_ops, 417 + .pm = pm_ptr(&dwc3_imx8mp_dev_pm_ops), 416 418 .of_match_table = dwc3_imx8mp_of_match, 417 419 }, 418 420 };