Re: [PATCH v3 4/8] usb: cdns3-ti: support reset-on-resume behavior

From: Sergei Shtylyov
Date: Sat Feb 24 2024 - 04:09:19 EST


On 2/23/24 7:05 PM, Théo Lebrun wrote:

> Add match data support, with one boolean to indicate whether the
> hardware resets after a system-wide suspend. If hardware resets, we
> force execute ->runtime_resume() at system-wide resume to run the
> hardware init sequence.
>
> No compatible exploits this functionality, just yet.
>
> Signed-off-by: Théo Lebrun <theo.lebrun@xxxxxxxxxxx>
> ---
> drivers/usb/cdns3/cdns3-ti.c | 27 +++++++++++++++++++++++++++
> 1 file changed, 27 insertions(+)
>
> diff --git a/drivers/usb/cdns3/cdns3-ti.c b/drivers/usb/cdns3/cdns3-ti.c
> index 4c8a557e6a6f..f76327566798 100644
> --- a/drivers/usb/cdns3/cdns3-ti.c
> +++ b/drivers/usb/cdns3/cdns3-ti.c
[...]
> @@ -220,8 +226,29 @@ static int cdns_ti_runtime_resume(struct device *dev)
> return 0;
> }
>
> +static int cdns_ti_suspend(struct device *dev)
> +{
> + struct cdns_ti *data = dev_get_drvdata(dev);
> +
> + if (data->match_data && data->match_data->reset_on_resume)
> + return pm_runtime_force_suspend(dev);
> + else

Pointless *else* after *return*...

> + return 0;
> +}
> +
> +static int cdns_ti_resume(struct device *dev)
> +{
> + struct cdns_ti *data = dev_get_drvdata(dev);
> +
> + if (data->match_data && data->match_data->reset_on_resume)
> + return pm_runtime_force_resume(dev);
> + else

Here as well...

> + return 0;
> +}
> +
> static const struct dev_pm_ops cdns_ti_pm_ops = {
> RUNTIME_PM_OPS(NULL, cdns_ti_runtime_resume, NULL)
> + SYSTEM_SLEEP_PM_OPS(cdns_ti_suspend, cdns_ti_resume)
> };
>
> static const struct of_device_id cdns_ti_of_match[] = {

MBR, Sergey