public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Chen <peter.chen@kernel.org>
To: Fabio Estevam <festevam@gmail.com>
Cc: gregkh@linuxfoundation.org, thierry.reding@gmail.com,
	linux-usb@vger.kernel.org, Fabio Estevam <festevam@denx.de>
Subject: Re: [PATCH 1/2] usb: chipidea: ci_hdrc_imx: Switch to RUNTIME/SYSTEM_SLEEP_PM_OPS()
Date: Wed, 10 Jul 2024 09:51:08 +0800	[thread overview]
Message-ID: <20240710015108.GB2914204@nchen-desktop> (raw)
In-Reply-To: <20240625231023.436403-1-festevam@gmail.com>

On 24-06-25 20:10:22, Fabio Estevam wrote:
> From: Fabio Estevam <festevam@denx.de>
> 
> 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: Peter Chen <peter.chen@kernel.org>

> ---
>  drivers/usb/chipidea/ci_hdrc_imx.c | 19 +++++++++----------
>  1 file changed, 9 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c
> index a17b6d619305..bdc04ce919f7 100644
> --- a/drivers/usb/chipidea/ci_hdrc_imx.c
> +++ b/drivers/usb/chipidea/ci_hdrc_imx.c
> @@ -557,7 +557,7 @@ static void ci_hdrc_imx_shutdown(struct platform_device *pdev)
>  	ci_hdrc_imx_remove(pdev);
>  }
>  
> -static int __maybe_unused imx_controller_suspend(struct device *dev,
> +static int imx_controller_suspend(struct device *dev,
>  						 pm_message_t msg)
>  {
>  	struct ci_hdrc_imx_data *data = dev_get_drvdata(dev);
> @@ -582,7 +582,7 @@ static int __maybe_unused imx_controller_suspend(struct device *dev,
>  	return 0;
>  }
>  
> -static int __maybe_unused imx_controller_resume(struct device *dev,
> +static int imx_controller_resume(struct device *dev,
>  						pm_message_t msg)
>  {
>  	struct ci_hdrc_imx_data *data = dev_get_drvdata(dev);
> @@ -618,7 +618,7 @@ static int __maybe_unused imx_controller_resume(struct device *dev,
>  	return ret;
>  }
>  
> -static int __maybe_unused ci_hdrc_imx_suspend(struct device *dev)
> +static int ci_hdrc_imx_suspend(struct device *dev)
>  {
>  	int ret;
>  
> @@ -636,7 +636,7 @@ static int __maybe_unused ci_hdrc_imx_suspend(struct device *dev)
>  	return ret;
>  }
>  
> -static int __maybe_unused ci_hdrc_imx_resume(struct device *dev)
> +static int ci_hdrc_imx_resume(struct device *dev)
>  {
>  	struct ci_hdrc_imx_data *data = dev_get_drvdata(dev);
>  	int ret;
> @@ -652,7 +652,7 @@ static int __maybe_unused ci_hdrc_imx_resume(struct device *dev)
>  	return ret;
>  }
>  
> -static int __maybe_unused ci_hdrc_imx_runtime_suspend(struct device *dev)
> +static int ci_hdrc_imx_runtime_suspend(struct device *dev)
>  {
>  	struct ci_hdrc_imx_data *data = dev_get_drvdata(dev);
>  
> @@ -664,15 +664,14 @@ static int __maybe_unused ci_hdrc_imx_runtime_suspend(struct device *dev)
>  	return imx_controller_suspend(dev, PMSG_AUTO_SUSPEND);
>  }
>  
> -static int __maybe_unused ci_hdrc_imx_runtime_resume(struct device *dev)
> +static int ci_hdrc_imx_runtime_resume(struct device *dev)
>  {
>  	return imx_controller_resume(dev, PMSG_AUTO_RESUME);
>  }
>  
>  static const struct dev_pm_ops ci_hdrc_imx_pm_ops = {
> -	SET_SYSTEM_SLEEP_PM_OPS(ci_hdrc_imx_suspend, ci_hdrc_imx_resume)
> -	SET_RUNTIME_PM_OPS(ci_hdrc_imx_runtime_suspend,
> -			ci_hdrc_imx_runtime_resume, NULL)
> +	SYSTEM_SLEEP_PM_OPS(ci_hdrc_imx_suspend, ci_hdrc_imx_resume)
> +	RUNTIME_PM_OPS(ci_hdrc_imx_runtime_suspend, ci_hdrc_imx_runtime_resume, NULL)
>  };
>  static struct platform_driver ci_hdrc_imx_driver = {
>  	.probe = ci_hdrc_imx_probe,
> @@ -681,7 +680,7 @@ static struct platform_driver ci_hdrc_imx_driver = {
>  	.driver = {
>  		.name = "imx_usb",
>  		.of_match_table = ci_hdrc_imx_dt_ids,
> -		.pm = &ci_hdrc_imx_pm_ops,
> +		.pm = pm_ptr(&ci_hdrc_imx_pm_ops),
>  	 },
>  };
>  
> -- 
> 2.34.1
> 

      parent reply	other threads:[~2024-07-10  1:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-25 23:10 [PATCH 1/2] usb: chipidea: ci_hdrc_imx: Switch to RUNTIME/SYSTEM_SLEEP_PM_OPS() Fabio Estevam
2024-06-25 23:10 ` [PATCH 2/2] usb: chipidea: ci_hdrc_tegra: Switch to RUNTIME_PM_OPS() Fabio Estevam
2024-07-10  1:51   ` Peter Chen
2024-07-10  1:51 ` Peter Chen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240710015108.GB2914204@nchen-desktop \
    --to=peter.chen@kernel.org \
    --cc=festevam@denx.de \
    --cc=festevam@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=thierry.reding@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox