Select the types of activity you want to include in your feed.
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.
···7777 void (*disable_unused)(struct clk_hw *hw);7878 unsigned long (*recalc_rate)(struct clk_hw *hw,7979 unsigned long parent_rate);8080- long (*round_rate)(struct clk_hw *hw,8181- unsigned long rate,8282- 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);···217220 +----------------+------+-------------+---------------+-------------+------+218221 |.recalc_rate | | y | | | |219222 +----------------+------+-------------+---------------+-------------+------+220220- |.round_rate | | y [1]_ | | | |221221- +----------------+------+-------------+---------------+-------------+------+222222- |.determine_rate | | y [1]_ | | | |223223+ |.determine_rate | | y | | | |223224 +----------------+------+-------------+---------------+-------------+------+224225 |.set_rate | | y | | | |225226 +----------------+------+-------------+---------------+-------------+------+···232237 +----------------+------+-------------+---------------+-------------+------+233238 |.init | | | | | |234239 +----------------+------+-------------+---------------+-------------+------+235235-236236-.. [1] either one of round_rate or determine_rate is required.237240238241Finally, register your clock at run-time with a hardware-specific239242registration function. This function simply populates struct clk_foo's
+14-25
drivers/clk/clk.c
···15601560static int clk_core_determine_round_nolock(struct clk_core *core,15611561 struct clk_rate_request *req)15621562{15631563- long rate;15641564-15651563 lockdep_assert_held(&prepare_lock);1566156415671565 if (!core)···15891591 req->rate = core->rate;15901592 } else if (core->ops->determine_rate) {15911593 return core->ops->determine_rate(core->hw, req);15921592- } else if (core->ops->round_rate) {15931593- rate = core->ops->round_rate(core->hw, req->rate,15941594- &req->best_parent_rate);15951595- if (rate < 0)15961596- return rate;15971597-15981598- req->rate = rate;15991594 } else {16001595 return -EINVAL;16011596 }···1673168216741683static bool clk_core_can_round(struct clk_core * const core)16751684{16761676- return core->ops->determine_rate || core->ops->round_rate;16851685+ return core->ops->determine_rate;16771686}1678168716791688static int clk_core_round_rate_nolock(struct clk_core *core,···17411750 * use.17421751 *17431752 * Context: prepare_lock must be held.17441744- * For clk providers to call from within clk_ops such as .round_rate,17531753+ * For clk providers to call from within clk_ops such as17451754 * .determine_rate.17461755 *17471747- * Return: returns rounded rate of hw clk if clk supports round_rate operation17481748- * else returns the parent rate.17561756+ * Return: returns rounded rate of hw clk if clk supports determine_rate17571757+ * operation; else returns the parent rate.17491758 */17501759unsigned long clk_hw_round_rate(struct clk_hw *hw, unsigned long rate)17511760{···25602569 *25612570 * Setting the CLK_SET_RATE_PARENT flag allows the rate change operation to25622571 * propagate up to clk's parent; whether or not this happens depends on the25632563- * outcome of clk's .round_rate implementation. If *parent_rate is unchanged25642564- * after calling .round_rate then upstream parent propagation is ignored. If25652565- * *parent_rate comes back with a new rate for clk's parent then we propagate25662566- * up to clk's parent and set its rate. Upward propagation will continue25672567- * until either a clk does not support the CLK_SET_RATE_PARENT flag or25682568- * .round_rate stops requesting changes to clk's parent_rate.25722572+ * outcome of clk's .determine_rate implementation. If req->best_parent_rate25732573+ * is unchanged after calling .determine_rate then upstream parent propagation25742574+ * is ignored. If req->best_parent_rate comes back with a new rate for clk's25752575+ * parent then we propagate up to clk's parent and set its rate. Upward25762576+ * propagation will continue until either a clk does not support the25772577+ * CLK_SET_RATE_PARENT flag or .determine_rate stops requesting changes to25782578+ * clk's parent_rate.25692579 *25702580 * Rate changes are accomplished via tree traversal that also recalculates the25712581 * rates for the clocks and fires off POST_RATE_CHANGE notifiers.···26952703 * FIXME:26962704 * There is a catch. It may fail for the usual reason (clock26972705 * broken, clock protected, etc) but also because:26982698- * - round_rate() was not favorable and fell on the wrong26992699- * side of the boundary27002706 * - the determine_rate() callback does not really check for27012707 * this corner case when determining the rate27022708 */···39053915 }3906391639073917 /* check that clk_ops are sane. See Documentation/driver-api/clk.rst */39083908- if (core->ops->set_rate &&39093909- !((core->ops->round_rate || core->ops->determine_rate) &&39103910- core->ops->recalc_rate)) {39113911- pr_err("%s: %s must implement .round_rate or .determine_rate in addition to .recalc_rate\n",39183918+ if (core->ops->set_rate && !core->ops->determine_rate &&39193919+ core->ops->recalc_rate) {39203920+ pr_err("%s: %s must implement .determine_rate in addition to .recalc_rate\n",39123921 __func__, core->name);39133922 ret = -EINVAL;39143923 goto out;
+6-12
include/linux/clk-provider.h
···136136 * 0. Returns the calculated rate. Optional, but recommended - if137137 * this op is not set then clock rate will be initialized to 0.138138 *139139- * @round_rate: Given a target rate as input, returns the closest rate actually140140- * supported by the clock. The parent rate is an input/output141141- * parameter.142142- *143139 * @determine_rate: Given a target rate as input, returns the closest rate144140 * actually supported by the clock, and optionally the parent clock145141 * that should be used to provide the clock rate.···159163 *160164 * @set_rate: Change the rate of this clock. The requested rate is specified161165 * by the second argument, which should typically be the return162162- * of .round_rate call. The third argument gives the parent rate163163- * which is likely helpful for most .set_rate implementation.166166+ * of .determine_rate call. The third argument gives the parent167167+ * rate which is likely helpful for most .set_rate implementation.164168 * Returns 0 on success, -EERROR otherwise.165169 *166170 * @set_rate_and_parent: Change the rate and the parent of this clock. The167171 * requested rate is specified by the second argument, which168168- * should typically be the return of .round_rate call. The172172+ * should typically be the return of clk_round_rate() call. The169173 * third argument gives the parent rate which is likely helpful170174 * for most .set_rate_and_parent implementation. The fourth171175 * argument gives the parent index. This callback is optional (and···240244 void (*restore_context)(struct clk_hw *hw);241245 unsigned long (*recalc_rate)(struct clk_hw *hw,242246 unsigned long parent_rate);243243- long (*round_rate)(struct clk_hw *hw, unsigned long rate,244244- unsigned long *parent_rate);245247 int (*determine_rate)(struct clk_hw *hw,246248 struct clk_rate_request *req);247249 int (*set_parent)(struct clk_hw *hw, u8 index);···673679 * @lock: register lock674680 *675681 * Clock with an adjustable divider affecting its output frequency. Implements676676- * .recalc_rate, .set_rate and .round_rate682682+ * .recalc_rate, .set_rate and .determine_rate677683 *678684 * @flags:679685 * CLK_DIVIDER_ONE_BASED - by default the divisor is the value read from the···11201126 *11211127 * Clock with a fixed multiplier and divider. The output frequency is the11221128 * parent clock rate divided by div and multiplied by mult.11231123- * Implements .recalc_rate, .set_rate, .round_rate and .recalc_accuracy11291129+ * Implements .recalc_rate, .set_rate, .determine_rate and .recalc_accuracy11241130 *11251131 * Flags:11261132 * * CLK_FIXED_FACTOR_FIXED_ACCURACY - Use the value in @acc instead of the···12481254 * @lock: register lock12491255 *12501256 * Clock with an adjustable multiplier affecting its output frequency.12511251- * Implements .recalc_rate, .set_rate and .round_rate12571257+ * Implements .recalc_rate, .set_rate and .determine_rate12521258 *12531259 * @flags:12541260 * CLK_MULTIPLIER_ZERO_BYPASS - By default, the multiplier is the value read