Skip to content

Commit 4233463

Browse files
AngeloGioacchino Del Regnobebarino
authored andcommitted
clk: mediatek: clk-gate: Shrink by adding clockgating bit check helper
Add a clockgating bit check helper and use it in functions mtk_cg_bit_is_cleared(), mtk_cg_bit_is_set() to shrink the file size. Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Link: https://lore.kernel.org/r/20220103143712.46675-1-angelogioacchino.delregno@collabora.com Signed-off-by: Stephen Boyd <sboyd@kernel.org>
1 parent fa55b7d commit 4233463

1 file changed

Lines changed: 7 additions & 11 deletions

File tree

drivers/clk/mediatek/clk-gate.c

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,28 +16,24 @@
1616
#include "clk-mtk.h"
1717
#include "clk-gate.h"
1818

19-
static int mtk_cg_bit_is_cleared(struct clk_hw *hw)
19+
static u32 mtk_get_clockgating(struct clk_hw *hw)
2020
{
2121
struct mtk_clk_gate *cg = to_mtk_clk_gate(hw);
2222
u32 val;
2323

2424
regmap_read(cg->regmap, cg->sta_ofs, &val);
2525

26-
val &= BIT(cg->bit);
26+
return val & BIT(cg->bit);
27+
}
2728

28-
return val == 0;
29+
static int mtk_cg_bit_is_cleared(struct clk_hw *hw)
30+
{
31+
return mtk_get_clockgating(hw) == 0;
2932
}
3033

3134
static int mtk_cg_bit_is_set(struct clk_hw *hw)
3235
{
33-
struct mtk_clk_gate *cg = to_mtk_clk_gate(hw);
34-
u32 val;
35-
36-
regmap_read(cg->regmap, cg->sta_ofs, &val);
37-
38-
val &= BIT(cg->bit);
39-
40-
return val != 0;
36+
return mtk_get_clockgating(hw) != 0;
4137
}
4238

4339
static void mtk_cg_set_bit(struct clk_hw *hw)

0 commit comments

Comments
 (0)