diff mbox series

scsi: ufs: ufs-mediatek: Modify the return value

Message ID 20221118045242.2770-1-cw9316.lee@samsung.com (mailing list archive)
State Accepted
Headers show
Series scsi: ufs: ufs-mediatek: Modify the return value | expand

Commit Message

Chanwoo Lee Nov. 18, 2022, 4:52 a.m. UTC
From: ChanWoo Lee <cw9316.lee@samsung.com>

Change the same as the other code to return bool type.
  91: 	return !!(host->caps & UFS_MTK_CAP_BOOST_CRYPT_ENGINE);
  98: 	return !!(host->caps & UFS_MTK_CAP_VA09_PWR_CTRL);
  105:	return !!(host->caps & UFS_MTK_CAP_BROKEN_VCC);

Signed-off-by: ChanWoo Lee <cw9316.lee@samsung.com>
---
 drivers/ufs/host/ufs-mediatek.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Stanley Jhu Nov. 18, 2022, 5:42 a.m. UTC | #1
On Fri, Nov 18, 2022 at 12:57 PM Chanwoo Lee <cw9316.lee@samsung.com> wrote:
>
> From: ChanWoo Lee <cw9316.lee@samsung.com>
>
> Change the same as the other code to return bool type.
>   91:   return !!(host->caps & UFS_MTK_CAP_BOOST_CRYPT_ENGINE);
>   98:   return !!(host->caps & UFS_MTK_CAP_VA09_PWR_CTRL);
>   105:  return !!(host->caps & UFS_MTK_CAP_BROKEN_VCC);
>
> Signed-off-by: ChanWoo Lee <cw9316.lee@samsung.com>

Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
AngeloGioacchino Del Regno Nov. 18, 2022, 10:39 a.m. UTC | #2
Il 18/11/22 05:52, Chanwoo Lee ha scritto:
> From: ChanWoo Lee <cw9316.lee@samsung.com>
> 
> Change the same as the other code to return bool type.
>    91: 	return !!(host->caps & UFS_MTK_CAP_BOOST_CRYPT_ENGINE);
>    98: 	return !!(host->caps & UFS_MTK_CAP_VA09_PWR_CTRL);
>    105:	return !!(host->caps & UFS_MTK_CAP_BROKEN_VCC);
> 
> Signed-off-by: ChanWoo Lee <cw9316.lee@samsung.com>
> Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Bart Van Assche Nov. 18, 2022, 5:30 p.m. UTC | #3
On 11/17/22 20:52, Chanwoo Lee wrote:
> From: ChanWoo Lee <cw9316.lee@samsung.com>
> 
> Change the same as the other code to return bool type.
>    91: 	return !!(host->caps & UFS_MTK_CAP_BOOST_CRYPT_ENGINE);
>    98: 	return !!(host->caps & UFS_MTK_CAP_VA09_PWR_CTRL);
>    105:	return !!(host->caps & UFS_MTK_CAP_BROKEN_VCC);
> 
> Signed-off-by: ChanWoo Lee <cw9316.lee@samsung.com>
> ---
>   drivers/ufs/host/ufs-mediatek.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/ufs/host/ufs-mediatek.c b/drivers/ufs/host/ufs-mediatek.c
> index 7d13878dff47..ef5816d82326 100644
> --- a/drivers/ufs/host/ufs-mediatek.c
> +++ b/drivers/ufs/host/ufs-mediatek.c
> @@ -109,7 +109,7 @@ static bool ufs_mtk_is_pmc_via_fastauto(struct ufs_hba *hba)
>   {
>   	struct ufs_mtk_host *host = ufshcd_get_variant(hba);
>   
> -	return (host->caps & UFS_MTK_CAP_PMC_VIA_FASTAUTO);
> +	return !!(host->caps & UFS_MTK_CAP_PMC_VIA_FASTAUTO);
>   }

Hi ChanWoo,

Please drop this patch and instead remove the !! from the other functions
that have return type 'bool'. There is more Linux kernel code that relies on
the implicit conversion from type 'int' to 'bool' than code that converts
explicitly from 'int' to 'bool'.

Thanks,

Bart.
Finn Thain Nov. 18, 2022, 9:34 p.m. UTC | #4
On Fri, 18 Nov 2022, Bart Van Assche wrote:

> There is more Linux kernel code that [...] than code that [...]. 

Thus mediocrity prevails.
Bart Van Assche Nov. 18, 2022, 9:44 p.m. UTC | #5
On 11/18/22 13:34, Finn Thain wrote:
> On Fri, 18 Nov 2022, Bart Van Assche wrote:
> 
>> There is more Linux kernel code that [...] than code that [...].
> 
> Thus mediocrity prevails.

Mediocrity? I don't understand the above comment. Personally I prefer 
the style without !! and I don't think that it's a mediocre style.

Bart.
Finn Thain Nov. 18, 2022, 10:29 p.m. UTC | #6
On Fri, 18 Nov 2022, Bart Van Assche wrote:

> On 11/18/22 13:34, Finn Thain wrote:
> > On Fri, 18 Nov 2022, Bart Van Assche wrote:
> > 
> >> There is more Linux kernel code that [...] than code that [...].
> > 
> > Thus mediocrity prevails.
> 
> Mediocrity? I don't understand the above comment. 

I'm afraid it was poorly expressed.

> Personally I prefer the style without !! and I don't think that it's a 
> mediocre style.
> 

My comment goes to the rationale you gave not the decision you made.

Regarding the decision, it's a choice between "explicit is better than 
implicit" and "brevity is better than redundancy". The patch opted for the 
former, you opted for the latter. I also have an opinion, but I'm not the 
maintainer so I'll keep it to myself.

Regarding the rationale, a maintainer who merely follows the majority is 
not actually doing code review. This will lead to mediocrity.
Martin K. Petersen Nov. 26, 2022, 2:11 a.m. UTC | #7
Chanwoo,

> Change the same as the other code to return bool type.

Applied to 6.2/scsi-staging, thanks!
Martin K. Petersen Dec. 1, 2022, 3:45 a.m. UTC | #8
On Fri, 18 Nov 2022 13:52:42 +0900, Chanwoo Lee wrote:

> From: ChanWoo Lee <cw9316.lee@samsung.com>
> 
> Change the same as the other code to return bool type.
>   91: 	return !!(host->caps & UFS_MTK_CAP_BOOST_CRYPT_ENGINE);
>   98: 	return !!(host->caps & UFS_MTK_CAP_VA09_PWR_CTRL);
>   105:	return !!(host->caps & UFS_MTK_CAP_BROKEN_VCC);
> 
> [...]

Applied to 6.2/scsi-queue, thanks!

[1/1] scsi: ufs: ufs-mediatek: Modify the return value
      https://git.kernel.org/mkp/scsi/c/96a2dfa1df4b
diff mbox series

Patch

diff --git a/drivers/ufs/host/ufs-mediatek.c b/drivers/ufs/host/ufs-mediatek.c
index 7d13878dff47..ef5816d82326 100644
--- a/drivers/ufs/host/ufs-mediatek.c
+++ b/drivers/ufs/host/ufs-mediatek.c
@@ -109,7 +109,7 @@  static bool ufs_mtk_is_pmc_via_fastauto(struct ufs_hba *hba)
 {
 	struct ufs_mtk_host *host = ufshcd_get_variant(hba);
 
-	return (host->caps & UFS_MTK_CAP_PMC_VIA_FASTAUTO);
+	return !!(host->caps & UFS_MTK_CAP_PMC_VIA_FASTAUTO);
 }
 
 static void ufs_mtk_cfg_unipro_cg(struct ufs_hba *hba, bool enable)