drm/mediatek: remove unnecessary conversion to bool
Subsystems (3)
PATCH 1/1 drm/mediatek: remove unnecessary conversion to bool
In function mtk_dsi_clk_hs_state, remove unnecessary conversion to bool return, this change is to make the code a bit readable.
--- drivers/gpu/drm/mediatek/mtk_dsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/mediatek/mtk_dsi.c +1 -1
@@ -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 ); }static void mtk_dsi_clk_hs_mode (struct mtk_dsi *dsi,bool enter)
Signature · 1 line
2.17.1
Quoted 13 lines · Bernard Zhao
In function
mtk_dsi_clk_hs_state, remove unnecessary conversion to bool return, this change is to make the code a bit readable.Signed-off-by Bernard Zhao <[email protected]>--- drivers/gpu/drm/mediatek/mtk_dsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/mediatek/mtk_dsi.c +0
-0
drivers/gpu/drm/mediatek/mtk_dsi.c static bool mtk_dsi_clk_hs_state(struct mtk_dsi *dsi) · line 322
Quoted 5 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +1
-1@@ -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 );
FWIW the "== 1" is also redundant, not to mention a little confusing - unless you go and look up the definition of LC_HS_TX_EN, it looks like this is doing something more than simply testing if a single bit is set.
Robin.
drivers/gpu/drm/mediatek/mtk_dsi.c static bool mtk_dsi_clk_hs_state(struct mtk_dsi *dsi) · line 325
Quoted 4 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +0
-0}static void mtk_dsi_clk_hs_mode (struct mtk_dsi *dsi,bool enter)
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 2 lines · Bernard Zhao
In function
mtk_dsi_clk_hs_state, remove unnecessary conversion to bool return, this change is to make the code a bit readable.
[]
drivers/gpu/drm/mediatek/mtk_dsi.c
Quoted 1 line
drivers/gpu/drm/mediatek/mtk_dsi.c +0
-0
[]
drivers/gpu/drm/mediatek/mtk_dsi.c static bool mtk_dsi_clk_hs_state(struct mtk_dsi *dsi) · line 322
Quoted 6 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +1
-1@@ -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;
}Chun-Kuang Hu
maintainerJoe Perches <[email protected]> 於 2020年6月15日 週一 上午4:41寫道:
Quoted 20 lines · Bernard Zhao
Quoted 2 lines
In function
mtk_dsi_clk_hs_state, remove unnecessary conversion to bool return, this change is to make the code a bit readable.[]
drivers/gpu/drm/mediatek/mtk_dsi.c
Quoted 1 line
drivers/gpu/drm/mediatek/mtk_dsi.c +0
-0[]
drivers/gpu/drm/mediatek/mtk_dsi.c static bool mtk_dsi_clk_hs_state(struct mtk_dsi *dsi) · line 322
Quoted 6 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +1
-1@@ -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_ENBIT(0)This is likely clearer as
Quoted 8 lines
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.
Quoted 6 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
发件人:Chun-Kuang Hu <[email protected]>
发送日期:2020-06-15 22:00:52
收件人:Joe Perches <[email protected]>
抄送人:Bernard Zhao <[email protected]>,Chun-Kuang Hu <[email protected]>,Philipp Zabel <[email protected]>,David Airlie <[email protected]>,Daniel Vetter <[email protected]>,Matthias Brugger <[email protected]>,DRI Development <[email protected]>,Linux ARM <[email protected]>,"moderated list:ARM/Mediatek SoC support" <[email protected]>,linux-kernel <[email protected]>,[email protected] 主题:Re: [PATCH] drm/mediatek: remove unnecessary conversion to bool>Joe Perches <[email protected]> 於 2020年6月15日 週一 上午4:41寫道:
Quoted 22 lines
Quoted 22 lines · Bernard Zhao
Quoted 2 lines
In function
mtk_dsi_clk_hs_state, remove unnecessary conversion to bool return, this change is to make the code a bit readable.[]
drivers/gpu/drm/mediatek/mtk_dsi.c
Quoted 1 line
drivers/gpu/drm/mediatek/mtk_dsi.c +0
-0[]
drivers/gpu/drm/mediatek/mtk_dsi.c static bool mtk_dsi_clk_hs_state(struct mtk_dsi *dsi) · line 322
Quoted 6 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +1
-1@@ -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_ENBIT(0)This is likely clearer as
return tmp_reg1 & LC_HS_TX_EN;
Quoted 8 lines
Quoted 6 lines
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
Quoted 6 lines
Quoted 6 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek