Re: [PATCH v1 2/4] usb: ehci-exynos: Switch from CONFIG_PM guards to pm_ptr()

From: Johan Hovold
Date: Mon Mar 04 2024 - 04:21:56 EST


On Sat, Mar 02, 2024 at 01:08:09AM +0530, Anand Moon wrote:
> Use the new PM macros for the suspend and resume functions to be
> automatically dropped by the compiler when CONFIG_PM are disabled,
> without having to use #ifdef guards. If CONFIG_PM unused,
> they will simply be discarded by the compiler.
>
> Use RUNTIME_PM_OPS runtime macro for suspend/resume function.
>
> Signed-off-by: Anand Moon <linux.amoon@xxxxxxxxx>
> ---
> drivers/usb/host/ehci-exynos.c | 10 ++--------
> 1 file changed, 2 insertions(+), 8 deletions(-)

> static const struct dev_pm_ops exynos_ehci_pm_ops = {
> - .suspend = exynos_ehci_suspend,
> - .resume = exynos_ehci_resume,
> + RUNTIME_PM_OPS(exynos_ehci_suspend, exynos_ehci_resume, NULL)
> };

This is also broken and clearly not tested. See the definition of
RUNTIME_PM_OPS() which sets the runtime pm callbacks, not the suspend
ones:

#define RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \
.runtime_suspend = suspend_fn, \
.runtime_resume = resume_fn, \
.runtime_idle = idle_fn,

Johan