Message ID | 1441893321-4563-1-git-send-email-thierry.reding@gmail.com (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers | show |
On 09/10, Thierry Reding wrote: > > Signed-off-by: Thierry Reding <treding@nvidia.com> Fixes: ? > --- > drivers/clk/tegra/clk-dfll.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/drivers/clk/tegra/clk-dfll.c b/drivers/clk/tegra/clk-dfll.c > index aa026bcf5b00..8e25bd52da8c 100644 > --- a/drivers/clk/tegra/clk-dfll.c > +++ b/drivers/clk/tegra/clk-dfll.c > @@ -632,11 +632,15 @@ static int find_lut_index_for_rate(struct tegra_dfll *td, unsigned long rate) > struct dev_pm_opp *opp; > int i, uv; > > + rcu_read_lock(); > + > opp = dev_pm_opp_find_freq_ceil(td->soc->dev, &rate); > if (IS_ERR(opp)) > return PTR_ERR(opp); > uv = dev_pm_opp_get_voltage(opp); > > + rcu_read_unlock(); > + > for (i = 0; i < td->i2c_lut_size; i++) { > if (regulator_list_voltage(td->vdd_reg, td->i2c_lut[i]) == uv) > return i; > @@ -1450,6 +1454,8 @@ static int dfll_build_i2c_lut(struct tegra_dfll *td) > td->i2c_lut[0] = lut; > > for (j = 1, rate = 0; ; rate++) { > + rcu_read_lock(); Don't we already have an rcu_read_lock() at the beginning of this function? I don't understand why we need to nest them in the same function.
On 10-09-15, 10:51, Stephen Boyd wrote: > Don't we already have an rcu_read_lock() at the beginning of this > function? I don't understand why we need to nest them in the same > function. +1
On Fri, Sep 11, 2015 at 08:05:27AM +0530, Viresh Kumar wrote: > On 10-09-15, 10:51, Stephen Boyd wrote: > > Don't we already have an rcu_read_lock() at the beginning of this > > function? I don't understand why we need to nest them in the same > > function. > > +1 My bad, I wasn't looking closely enough. The second hunk can be dropped. Thierry
On 09/11, Thierry Reding wrote: > On Fri, Sep 11, 2015 at 08:05:27AM +0530, Viresh Kumar wrote: > > On 10-09-15, 10:51, Stephen Boyd wrote: > > > Don't we already have an rcu_read_lock() at the beginning of this > > > function? I don't understand why we need to nest them in the same > > > function. > > > > +1 > > My bad, I wasn't looking closely enough. The second hunk can be dropped. > Ok. I applied the first hunk to clk-fixes.
diff --git a/drivers/clk/tegra/clk-dfll.c b/drivers/clk/tegra/clk-dfll.c index aa026bcf5b00..8e25bd52da8c 100644 --- a/drivers/clk/tegra/clk-dfll.c +++ b/drivers/clk/tegra/clk-dfll.c @@ -632,11 +632,15 @@ static int find_lut_index_for_rate(struct tegra_dfll *td, unsigned long rate) struct dev_pm_opp *opp; int i, uv; + rcu_read_lock(); + opp = dev_pm_opp_find_freq_ceil(td->soc->dev, &rate); if (IS_ERR(opp)) return PTR_ERR(opp); uv = dev_pm_opp_get_voltage(opp); + rcu_read_unlock(); + for (i = 0; i < td->i2c_lut_size; i++) { if (regulator_list_voltage(td->vdd_reg, td->i2c_lut[i]) == uv) return i; @@ -1450,6 +1454,8 @@ static int dfll_build_i2c_lut(struct tegra_dfll *td) td->i2c_lut[0] = lut; for (j = 1, rate = 0; ; rate++) { + rcu_read_lock(); + opp = dev_pm_opp_find_freq_ceil(td->soc->dev, &rate); if (IS_ERR(opp)) break; @@ -1458,6 +1464,8 @@ static int dfll_build_i2c_lut(struct tegra_dfll *td) if (v_opp <= td->soc->min_millivolts * 1000) td->dvco_rate_min = dev_pm_opp_get_freq(opp); + rcu_read_unlock(); + for (;;) { v += max(1, (v_max - v) / (MAX_DFLL_VOLTAGES - j)); if (v >= v_opp)