Skip to content

Commit dc652a3

Browse files
committed
clk: remove round_rate() clk ops
The round_rate() clk ops is deprecated, and all in tree drivers have been converted, so let's go ahead and remove any references to the round_rate() clk ops. Signed-off-by: Brian Masney <bmasney@redhat.com>
1 parent 4ce1f19 commit dc652a3

3 files changed

Lines changed: 21 additions & 45 deletions

File tree

Documentation/driver-api/clk.rst

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,6 @@ the operations defined in clk-provider.h::
7777
void (*disable_unused)(struct clk_hw *hw);
7878
unsigned long (*recalc_rate)(struct clk_hw *hw,
7979
unsigned long parent_rate);
80-
long (*round_rate)(struct clk_hw *hw,
81-
unsigned long rate,
82-
unsigned long *parent_rate);
8380
int (*determine_rate)(struct clk_hw *hw,
8481
struct clk_rate_request *req);
8582
int (*set_parent)(struct clk_hw *hw, u8 index);
@@ -220,9 +217,7 @@ optional or must be evaluated on a case-by-case basis.
220217
+----------------+------+-------------+---------------+-------------+------+
221218
|.recalc_rate | | y | | | |
222219
+----------------+------+-------------+---------------+-------------+------+
223-
|.round_rate | | y [1]_ | | | |
224-
+----------------+------+-------------+---------------+-------------+------+
225-
|.determine_rate | | y [1]_ | | | |
220+
|.determine_rate | | y | | | |
226221
+----------------+------+-------------+---------------+-------------+------+
227222
|.set_rate | | y | | | |
228223
+----------------+------+-------------+---------------+-------------+------+
@@ -238,8 +233,6 @@ optional or must be evaluated on a case-by-case basis.
238233
|.init | | | | | |
239234
+----------------+------+-------------+---------------+-------------+------+
240235

241-
.. [1] either one of round_rate or determine_rate is required.
242-
243236
Finally, register your clock at run-time with a hardware-specific
244237
registration function. This function simply populates struct clk_foo's
245238
data and then passes the common struct clk parameters to the framework

drivers/clk/clk.c

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1560,8 +1560,6 @@ late_initcall_sync(clk_disable_unused);
15601560
static int clk_core_determine_round_nolock(struct clk_core *core,
15611561
struct clk_rate_request *req)
15621562
{
1563-
long rate;
1564-
15651563
lockdep_assert_held(&prepare_lock);
15661564

15671565
if (!core)
@@ -1591,13 +1589,6 @@ static int clk_core_determine_round_nolock(struct clk_core *core,
15911589
req->rate = core->rate;
15921590
} else if (core->ops->determine_rate) {
15931591
return core->ops->determine_rate(core->hw, req);
1594-
} else if (core->ops->round_rate) {
1595-
rate = core->ops->round_rate(core->hw, req->rate,
1596-
&req->best_parent_rate);
1597-
if (rate < 0)
1598-
return rate;
1599-
1600-
req->rate = rate;
16011592
} else {
16021593
return -EINVAL;
16031594
}
@@ -1682,7 +1673,7 @@ EXPORT_SYMBOL_GPL(clk_hw_forward_rate_request);
16821673

16831674
static bool clk_core_can_round(struct clk_core * const core)
16841675
{
1685-
return core->ops->determine_rate || core->ops->round_rate;
1676+
return core->ops->determine_rate;
16861677
}
16871678

16881679
static int clk_core_round_rate_nolock(struct clk_core *core,
@@ -1750,11 +1741,11 @@ EXPORT_SYMBOL_GPL(__clk_determine_rate);
17501741
* use.
17511742
*
17521743
* Context: prepare_lock must be held.
1753-
* For clk providers to call from within clk_ops such as .round_rate,
1744+
* For clk providers to call from within clk_ops such as
17541745
* .determine_rate.
17551746
*
1756-
* Return: returns rounded rate of hw clk if clk supports round_rate operation
1757-
* else returns the parent rate.
1747+
* Return: returns rounded rate of hw clk if clk supports determine_rate
1748+
* operation; else returns the parent rate.
17581749
*/
17591750
unsigned long clk_hw_round_rate(struct clk_hw *hw, unsigned long rate)
17601751
{
@@ -2569,12 +2560,13 @@ static int clk_core_set_rate_nolock(struct clk_core *core,
25692560
*
25702561
* Setting the CLK_SET_RATE_PARENT flag allows the rate change operation to
25712562
* propagate up to clk's parent; whether or not this happens depends on the
2572-
* outcome of clk's .round_rate implementation. If *parent_rate is unchanged
2573-
* after calling .round_rate then upstream parent propagation is ignored. If
2574-
* *parent_rate comes back with a new rate for clk's parent then we propagate
2575-
* up to clk's parent and set its rate. Upward propagation will continue
2576-
* until either a clk does not support the CLK_SET_RATE_PARENT flag or
2577-
* .round_rate stops requesting changes to clk's parent_rate.
2563+
* outcome of clk's .determine_rate implementation. If req->best_parent_rate
2564+
* is unchanged after calling .determine_rate then upstream parent propagation
2565+
* is ignored. If req->best_parent_rate comes back with a new rate for clk's
2566+
* parent then we propagate up to clk's parent and set its rate. Upward
2567+
* propagation will continue until either a clk does not support the
2568+
* CLK_SET_RATE_PARENT flag or .determine_rate stops requesting changes to
2569+
* clk's parent_rate.
25782570
*
25792571
* Rate changes are accomplished via tree traversal that also recalculates the
25802572
* rates for the clocks and fires off POST_RATE_CHANGE notifiers.
@@ -2703,8 +2695,6 @@ static int clk_set_rate_range_nolock(struct clk *clk,
27032695
* FIXME:
27042696
* There is a catch. It may fail for the usual reason (clock
27052697
* broken, clock protected, etc) but also because:
2706-
* - round_rate() was not favorable and fell on the wrong
2707-
* side of the boundary
27082698
* - the determine_rate() callback does not really check for
27092699
* this corner case when determining the rate
27102700
*/
@@ -3915,10 +3905,9 @@ static int __clk_core_init(struct clk_core *core)
39153905
}
39163906

39173907
/* check that clk_ops are sane. See Documentation/driver-api/clk.rst */
3918-
if (core->ops->set_rate &&
3919-
!((core->ops->round_rate || core->ops->determine_rate) &&
3920-
core->ops->recalc_rate)) {
3921-
pr_err("%s: %s must implement .round_rate or .determine_rate in addition to .recalc_rate\n",
3908+
if (core->ops->set_rate && !core->ops->determine_rate &&
3909+
core->ops->recalc_rate) {
3910+
pr_err("%s: %s must implement .determine_rate in addition to .recalc_rate\n",
39223911
__func__, core->name);
39233912
ret = -EINVAL;
39243913
goto out;

include/linux/clk-provider.h

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,6 @@ struct clk_duty {
136136
* 0. Returns the calculated rate. Optional, but recommended - if
137137
* this op is not set then clock rate will be initialized to 0.
138138
*
139-
* @round_rate: Given a target rate as input, returns the closest rate actually
140-
* supported by the clock. The parent rate is an input/output
141-
* parameter.
142-
*
143139
* @determine_rate: Given a target rate as input, returns the closest rate
144140
* actually supported by the clock, and optionally the parent clock
145141
* that should be used to provide the clock rate.
@@ -163,13 +159,13 @@ struct clk_duty {
163159
*
164160
* @set_rate: Change the rate of this clock. The requested rate is specified
165161
* by the second argument, which should typically be the return
166-
* of .round_rate call. The third argument gives the parent rate
167-
* which is likely helpful for most .set_rate implementation.
162+
* of .determine_rate call. The third argument gives the parent
163+
* rate which is likely helpful for most .set_rate implementation.
168164
* Returns 0 on success, -EERROR otherwise.
169165
*
170166
* @set_rate_and_parent: Change the rate and the parent of this clock. The
171167
* requested rate is specified by the second argument, which
172-
* should typically be the return of .round_rate call. The
168+
* should typically be the return of clk_round_rate() call. The
173169
* third argument gives the parent rate which is likely helpful
174170
* for most .set_rate_and_parent implementation. The fourth
175171
* argument gives the parent index. This callback is optional (and
@@ -244,8 +240,6 @@ struct clk_ops {
244240
void (*restore_context)(struct clk_hw *hw);
245241
unsigned long (*recalc_rate)(struct clk_hw *hw,
246242
unsigned long parent_rate);
247-
long (*round_rate)(struct clk_hw *hw, unsigned long rate,
248-
unsigned long *parent_rate);
249243
int (*determine_rate)(struct clk_hw *hw,
250244
struct clk_rate_request *req);
251245
int (*set_parent)(struct clk_hw *hw, u8 index);
@@ -679,7 +673,7 @@ struct clk_div_table {
679673
* @lock: register lock
680674
*
681675
* Clock with an adjustable divider affecting its output frequency. Implements
682-
* .recalc_rate, .set_rate and .round_rate
676+
* .recalc_rate, .set_rate and .determine_rate
683677
*
684678
* @flags:
685679
* CLK_DIVIDER_ONE_BASED - by default the divisor is the value read from the
@@ -1126,7 +1120,7 @@ void of_fixed_factor_clk_setup(struct device_node *node);
11261120
*
11271121
* Clock with a fixed multiplier and divider. The output frequency is the
11281122
* parent clock rate divided by div and multiplied by mult.
1129-
* Implements .recalc_rate, .set_rate, .round_rate and .recalc_accuracy
1123+
* Implements .recalc_rate, .set_rate, .determine_rate and .recalc_accuracy
11301124
*
11311125
* Flags:
11321126
* * CLK_FIXED_FACTOR_FIXED_ACCURACY - Use the value in @acc instead of the
@@ -1254,7 +1248,7 @@ void clk_hw_unregister_fractional_divider(struct clk_hw *hw);
12541248
* @lock: register lock
12551249
*
12561250
* Clock with an adjustable multiplier affecting its output frequency.
1257-
* Implements .recalc_rate, .set_rate and .round_rate
1251+
* Implements .recalc_rate, .set_rate and .determine_rate
12581252
*
12591253
* @flags:
12601254
* CLK_MULTIPLIER_ZERO_BYPASS - By default, the multiplier is the value read

0 commit comments

Comments
 (0)