Re:Re: [PATCH] drm/mediatek: remove unnecessary conversion to bool
From: Bernard
Date: Mon Jun 15 2020 - 22:24:37 EST
åääïChun-Kuang Hu <chunkuang.hu@xxxxxxxxxx>
åéææï2020-06-15 22:00:52
æääïJoe Perches <joe@xxxxxxxxxxx>
æéäïBernard Zhao <bernard@xxxxxxxx>,Chun-Kuang Hu <chunkuang.hu@xxxxxxxxxx>,Philipp Zabel <p.zabel@xxxxxxxxxxxxxx>,David Airlie <airlied@xxxxxxxx>,Daniel Vetter <daniel@xxxxxxxx>,Matthias Brugger <matthias.bgg@xxxxxxxxx>,DRI Development <dri-devel@xxxxxxxxxxxxxxxxxxxxx>,Linux ARM <linux-arm-kernel@xxxxxxxxxxxxxxxxxxx>,"moderated list:ARM/Mediatek SoC support" <linux-mediatek@xxxxxxxxxxxxxxxxxxx>,linux-kernel <linux-kernel@xxxxxxxxxxxxxxx>,opensource.kernel@xxxxxxxx
äéïRe: [PATCH] drm/mediatek: remove unnecessary conversion to bool>Joe Perches <joe@xxxxxxxxxxx> æ 2020å6æ15æ éä äå4:41åéï
>>
>> On Fri, 2020-06-12 at 20:40 +0800, Bernard Zhao wrote:
>> > In function mtk_dsi_clk_hs_state, remove unnecessary conversion
>> > to bool return, this change is to make the code a bit readable.
>> []
>> > diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
>> []
>> > @@ -319,7 +319,7 @@ static bool mtk_dsi_clk_hs_state(struct mtk_dsi *dsi)
>> > u32 tmp_reg1;
>> >
>> > tmp_reg1 = readl(dsi->regs + DSI_PHY_LCCON);
>> > - return ((tmp_reg1 & LC_HS_TX_EN) == 1) ? true : false;
>> > + return ((tmp_reg1 & LC_HS_TX_EN) == 1);
>>
>> Given:
>>
>> drivers/gpu/drm/mediatek/mtk_dsi.c:#define LC_HS_TX_EN BIT(0)
>>
>> This is likely clearer as
>>
>> return tmp_reg1 & LC_HS_TX_EN;
>>
>> or even
>>
>> static bool mtk_dsi_clk_hs_state(struct mtk_dsi *dsi)
>> {
>> return readl(dsi->regs + DSI_PHY_LCCON) & LC_HS_TX_EN;
>> }
>
>I like the second one.
Hi:
This modification is clear and easy to understand.
I will update the patch and resubmit.
Thanks!
BR//Bernard
>>
>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@xxxxxxxxxxxxxxxxxxxxx
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel