[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f51578a139b028f2fa85e738d52f50356027bb26.camel@mediatek.com>
Date: Wed, 15 Jun 2022 11:49:14 +0800
From: Stanley Chu <stanley.chu@...iatek.com>
To: Bart Van Assche <bvanassche@....org>, <linux-scsi@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <martin.petersen@...cle.com>,
<avri.altman@....com>, <alim.akhtar@...sung.com>,
<jejb@...ux.ibm.com>
CC: <peter.wang@...iatek.com>, <chun-hung.wu@...iatek.com>,
<alice.chao@...iatek.com>, <powen.kao@...iatek.com>,
<mason.zhang@...iatek.com>, <qilin.tan@...iatek.com>,
<lin.gui@...iatek.com>, <eddie.huang@...iatek.com>,
<tun-yu.yu@...iatek.com>, <cc.chou@...iatek.com>,
<chaotian.jing@...iatek.com>, <jiajie.hao@...iatek.com>
Subject: Re: [PATCH v3 04/10] scsi: ufs-mediatek: Fix the timing of
configuring device regulators
On Tue, 2022-06-14 at 09:33 -0700, Bart Van Assche wrote:
> On 6/14/22 07:16, Stanley Chu wrote:
> > +int ufs_mtk_system_suspend(struct device *dev)
> > +{
> > + int ret = 0;
> > + struct ufs_hba *hba = dev_get_drvdata(dev);
> > +
> > + ret = ufshcd_system_suspend(dev);
> > +
> > + if (!ret)
> > + ufs_mtk_vreg_set_lpm(hba, true);
> > +
> > + return ret;
> > +}
>
>
> Please use the traditional kernel coding style and return early in
> case
> of an error. For the above code, that means to rewrite it as follows:
>
> struct ufs_hba *hba = dev_get_drvdata(dev);
> int ret;
>
> ret = ufshcd_system_suspend(dev);
> if (ret)
> return ret;
>
> ufs_mtk_vreg_set_lpm(hba, true);
>
> return 0;
OK! Fixed in v4.
>
> > +int ufs_mtk_system_resume(struct device *dev)
> > +{
> > + int ret = 0;
> > + struct ufs_hba *hba = dev_get_drvdata(dev);
> > +
> > + ufs_mtk_vreg_set_lpm(hba, false);
> > +
> > + ret = ufshcd_system_resume(dev);
> > +
> > + return ret;
> > +}
>
> Please remove the variable 'ret' from the above function.
OK! Fixed in v4.
>
> > +int ufs_mtk_runtime_suspend(struct device *dev)
> > +{
> > + struct ufs_hba *hba = dev_get_drvdata(dev);
> > + int ret = 0;
> > +
> > + ret = ufshcd_runtime_suspend(dev);
> > +
> > + if (!ret)
> > + ufs_mtk_vreg_set_lpm(hba, true);
> > +
> > + return ret;
> > +}
>
> Please use the "early return" style.
OK! Fixed in v4.
>
> > +int ufs_mtk_runtime_resume(struct device *dev)
> > +{
> > + struct ufs_hba *hba = dev_get_drvdata(dev);
> > + int ret = 0;
> > +
> > + ufs_mtk_vreg_set_lpm(hba, false);
> > +
> > + ret = ufshcd_runtime_resume(dev);
> > +
> > + return ret;
> > +}
>
> Please remove the variable 'ret' from the above function.
OK! Fixed in v4.
>
> Thanks,
>
> Bart.
Powered by blists - more mailing lists