lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <AM6PR04MB56232E15368E80791C48C58AF3119@AM6PR04MB5623.eurprd04.prod.outlook.com>
Date:   Fri, 16 Jul 2021 08:43:09 +0000
From:   Clark Wang <xiaoning.wang@....com>
To:     Miquel Raynal <miquel.raynal@...tlin.com>
CC:     "conor.culhane@...vaco.com" <conor.culhane@...vaco.com>,
        "alexandre.belloni@...tlin.com" <alexandre.belloni@...tlin.com>,
        "linux-i3c@...ts.infradead.org" <linux-i3c@...ts.infradead.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH V2 5/5] i3c: master: svc: add runtime pm support


> -----Original Message-----
> From: Miquel Raynal <miquel.raynal@...tlin.com>
> Sent: Friday, July 16, 2021 16:00
> To: Clark Wang <xiaoning.wang@....com>
> Cc: conor.culhane@...vaco.com; alexandre.belloni@...tlin.com; linux-
> i3c@...ts.infradead.org; linux-kernel@...r.kernel.org
> Subject: Re: [PATCH V2 5/5] i3c: master: svc: add runtime pm support
> 
> Hi Clark,
> 
> 
> > @@ -1431,7 +1502,7 @@ static int svc_i3c_master_probe(struct
> platform_device *pdev)
> >  					 GFP_KERNEL);
> >  	if (!master->ibi.slots) {
> >  		ret = -ENOMEM;
> > -		goto err_disable_sclk;
> > +		goto rpm_disable;
> >  	}
> >
> >  	platform_set_drvdata(pdev, master);
> > @@ -1442,18 +1513,17 @@ static int svc_i3c_master_probe(struct
> platform_device *pdev)
> >  	ret = i3c_master_register(&master->base, &pdev->dev,
> >  				  &svc_i3c_master_ops, false);
> >  	if (ret)
> > -		goto err_disable_sclk;
> > +		goto rpm_disable;
> >
> > -	return 0;
> > -
> > -err_disable_sclk:
> > -	clk_disable_unprepare(master->sclk);
> > +	pm_runtime_mark_last_busy(&pdev->dev);
> > +	pm_runtime_put_autosuspend(&pdev->dev);
> >
> > -err_disable_fclk:
> > -	clk_disable_unprepare(master->fclk);
> > +	return 0;
> >
> > -err_disable_pclk:
> > -	clk_disable_unprepare(master->pclk);
> 
> It's not clear to me why you drop the disable_*clk labels to move them back
> in place? I would rather prefer to keep a clean error path.

Hi Miquel,

Yes it is. This change is indeed not very clear.
I have restored the error path.
And I found that it is not necessary to enable runtime pm so early.

Please check V3.

Thanks.

Best Regards,
Clark Wang

> 
> > +rpm_disable:
> > +	pm_runtime_dont_use_autosuspend(&pdev->dev);
> > +	pm_runtime_put_sync(&pdev->dev);
> > +	pm_runtime_disable(&pdev->dev);
> >
> >  	return ret;
> >  }
> > @@ -1467,13 +1537,57 @@ static int svc_i3c_master_remove(struct
> platform_device *pdev)
> >  	if (ret)
> >  		return ret;
> >
> > +	pm_runtime_dont_use_autosuspend(&pdev->dev);
> > +	pm_runtime_disable(&pdev->dev);
> > +
> > +	return 0;
> > +}
> > +
> > +static int __maybe_unused svc_i3c_runtime_suspend(struct device *dev)
> > +{
> > +	struct svc_i3c_master *master = dev_get_drvdata(dev);
> > +
> >  	clk_disable_unprepare(master->pclk);
> >  	clk_disable_unprepare(master->fclk);
> >  	clk_disable_unprepare(master->sclk);
> > +	pinctrl_pm_select_sleep_state(dev);
> >
> >  	return 0;
> >  }
> >
> > +static int __maybe_unused svc_i3c_runtime_resume(struct device *dev)
> > +{
> > +	struct svc_i3c_master *master = dev_get_drvdata(dev);
> > +	int ret = 0;
> > +
> > +	pinctrl_pm_select_default_state(dev);
> > +	ret = clk_prepare_enable(master->pclk);
> > +	if (ret)
> > +		return ret;
> > +
> > +	ret = clk_prepare_enable(master->fclk);
> > +	if (ret) {
> > +		clk_disable_unprepare(master->pclk);
> > +		return ret;
> > +	}
> > +
> > +	ret = clk_prepare_enable(master->sclk);
> > +	if (ret) {
> > +		clk_disable_unprepare(master->pclk);
> > +		clk_disable_unprepare(master->fclk);
> > +		return ret;
> > +	}
> > +
> > +	return ret;
> > +}
> > +
> > +static const struct dev_pm_ops svc_i3c_pm_ops = {
> > +	SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
> > +				      pm_runtime_force_resume)
> > +	SET_RUNTIME_PM_OPS(svc_i3c_runtime_suspend,
> > +			   svc_i3c_runtime_resume, NULL)
> > +};
> > +
> >  static const struct of_device_id svc_i3c_master_of_match_tbl[] = {
> >  	{ .compatible = "silvaco,i3c-master" },
> >  	{ /* sentinel */ },
> > @@ -1485,6 +1599,7 @@ static struct platform_driver svc_i3c_master = {
> >  	.driver = {
> >  		.name = "silvaco-i3c-master",
> >  		.of_match_table = svc_i3c_master_of_match_tbl,
> > +		.pm = &svc_i3c_pm_ops,
> >  	},
> >  };
> >  module_platform_driver(svc_i3c_master);
> 
> Thanks,
> Miquèl

Download attachment "smime.p7s" of type "application/pkcs7-signature" (9583 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ