[PATCH v2 1/9] ufs: host: mediatek: Remove unnecessary boolean conversion

Peter Wang (王信友) peter.wang at mediatek.com
Mon Jul 21 00:30:18 PDT 2025


On Fri, 2025-07-18 at 08:13 -0700, Bart Van Assche wrote:
> 
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
> 
> 
> On 7/18/25 2:51 AM, peter.wang at mediatek.com wrote:
> > This patch removes unnecessary boolean conversions to ensure
> > consistency
> > with other usages in ufs-mediatek.c. The changes simplify the code
> > by
> > directly returning the result of bitwise operations without
> > converting
> > them to boolean values.
> 
> Hmm ... the conversion to boolean still happens but now happens
> implicitly (by the compiler) instead of explicitly (via !!).

> > diff --git a/drivers/ufs/host/ufs-mediatek.c
> > b/drivers/ufs/host/ufs-mediatek.c
> > index 182f58d0c9db..14f0130da653 100644
> > --- a/drivers/ufs/host/ufs-mediatek.c
> > +++ b/drivers/ufs/host/ufs-mediatek.c
> > @@ -96,28 +96,28 @@ static bool
> > ufs_mtk_is_boost_crypt_enabled(struct ufs_hba *hba)
> >   {
> >       struct ufs_mtk_host *host = ufshcd_get_variant(hba);
> > 
> > -     return !!(host->caps & UFS_MTK_CAP_BOOST_CRYPT_ENGINE);
> > +     return (host->caps & UFS_MTK_CAP_BOOST_CRYPT_ENGINE);
> >   }
> 
> How about removing the parentheses too since this patch makes the
> parentheses unnecessary?
> 
> Otherwise this patch looks good to me.

Hi Bart,

Removing the parentheses does make it cleaner. I will remove
them in the next version.

Thanks
Peter



> 
> Thanks,
> 
> Bart.
> 



More information about the Linux-mediatek mailing list