Skip to content

Commit 00d08cd

Browse files
Linus Walleijbebarino
authored andcommitted
clk: ux500: Drop .is_prepared state from PRCMU clocks
The core already keeps a software prepare count. Drop this custom software prepare count. The only semantic difference is that if disabling the clock fails, .is_prepared() will still return 1, but this will only serve to confuse the framework, the error message is sufficient. Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20220414221751.323525-4-linus.walleij@linaro.org Signed-off-by: Stephen Boyd <sboyd@kernel.org>
1 parent 801179b commit 00d08cd

1 file changed

Lines changed: 2 additions & 27 deletions

File tree

drivers/clk/ux500/clk-prcmu.c

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -18,38 +18,24 @@
1818
struct clk_prcmu {
1919
struct clk_hw hw;
2020
u8 cg_sel;
21-
int is_prepared;
2221
int opp_requested;
2322
};
2423

2524
/* PRCMU clock operations. */
2625

2726
static int clk_prcmu_prepare(struct clk_hw *hw)
2827
{
29-
int ret;
3028
struct clk_prcmu *clk = to_clk_prcmu(hw);
3129

32-
ret = prcmu_request_clock(clk->cg_sel, true);
33-
if (!ret)
34-
clk->is_prepared = 1;
35-
36-
return ret;
30+
return prcmu_request_clock(clk->cg_sel, true);
3731
}
3832

3933
static void clk_prcmu_unprepare(struct clk_hw *hw)
4034
{
4135
struct clk_prcmu *clk = to_clk_prcmu(hw);
4236
if (prcmu_request_clock(clk->cg_sel, false))
4337
pr_err("clk_prcmu: %s failed to disable %s.\n", __func__,
44-
clk_hw_get_name(hw));
45-
else
46-
clk->is_prepared = 0;
47-
}
48-
49-
static int clk_prcmu_is_prepared(struct clk_hw *hw)
50-
{
51-
struct clk_prcmu *clk = to_clk_prcmu(hw);
52-
return clk->is_prepared;
38+
clk_hw_get_name(hw));
5339
}
5440

5541
static unsigned long clk_prcmu_recalc_rate(struct clk_hw *hw,
@@ -98,7 +84,6 @@ static int clk_prcmu_opp_prepare(struct clk_hw *hw)
9884
return err;
9985
}
10086

101-
clk->is_prepared = 1;
10287
return 0;
10388
}
10489

@@ -117,8 +102,6 @@ static void clk_prcmu_opp_unprepare(struct clk_hw *hw)
117102
(char *)clk_hw_get_name(hw));
118103
clk->opp_requested = 0;
119104
}
120-
121-
clk->is_prepared = 0;
122105
}
123106

124107
static int clk_prcmu_opp_volt_prepare(struct clk_hw *hw)
@@ -143,7 +126,6 @@ static int clk_prcmu_opp_volt_prepare(struct clk_hw *hw)
143126
return err;
144127
}
145128

146-
clk->is_prepared = 1;
147129
return 0;
148130
}
149131

@@ -161,14 +143,11 @@ static void clk_prcmu_opp_volt_unprepare(struct clk_hw *hw)
161143
prcmu_request_ape_opp_100_voltage(false);
162144
clk->opp_requested = 0;
163145
}
164-
165-
clk->is_prepared = 0;
166146
}
167147

168148
static const struct clk_ops clk_prcmu_scalable_ops = {
169149
.prepare = clk_prcmu_prepare,
170150
.unprepare = clk_prcmu_unprepare,
171-
.is_prepared = clk_prcmu_is_prepared,
172151
.recalc_rate = clk_prcmu_recalc_rate,
173152
.round_rate = clk_prcmu_round_rate,
174153
.set_rate = clk_prcmu_set_rate,
@@ -177,7 +156,6 @@ static const struct clk_ops clk_prcmu_scalable_ops = {
177156
static const struct clk_ops clk_prcmu_gate_ops = {
178157
.prepare = clk_prcmu_prepare,
179158
.unprepare = clk_prcmu_unprepare,
180-
.is_prepared = clk_prcmu_is_prepared,
181159
.recalc_rate = clk_prcmu_recalc_rate,
182160
};
183161

@@ -194,14 +172,12 @@ static const struct clk_ops clk_prcmu_rate_ops = {
194172
static const struct clk_ops clk_prcmu_opp_gate_ops = {
195173
.prepare = clk_prcmu_opp_prepare,
196174
.unprepare = clk_prcmu_opp_unprepare,
197-
.is_prepared = clk_prcmu_is_prepared,
198175
.recalc_rate = clk_prcmu_recalc_rate,
199176
};
200177

201178
static const struct clk_ops clk_prcmu_opp_volt_scalable_ops = {
202179
.prepare = clk_prcmu_opp_volt_prepare,
203180
.unprepare = clk_prcmu_opp_volt_unprepare,
204-
.is_prepared = clk_prcmu_is_prepared,
205181
.recalc_rate = clk_prcmu_recalc_rate,
206182
.round_rate = clk_prcmu_round_rate,
207183
.set_rate = clk_prcmu_set_rate,
@@ -228,7 +204,6 @@ static struct clk *clk_reg_prcmu(const char *name,
228204
return ERR_PTR(-ENOMEM);
229205

230206
clk->cg_sel = cg_sel;
231-
clk->is_prepared = 1;
232207
clk->opp_requested = 0;
233208
/* "rate" can be used for changing the initial frequency */
234209
if (rate)

0 commit comments

Comments
 (0)