[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bc6fc2fa-df9a-60cb-3929-9dd5808eced2@acm.org>
Date: Tue, 14 Jun 2022 09:33:57 -0700
From: Bart Van Assche <bvanassche@....org>
To: Stanley Chu <stanley.chu@...iatek.com>, 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 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;
> +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.
> +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.
> +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.
Thanks,
Bart.
Powered by blists - more mailing lists