Re: [PATCH] opp: Prepare for ->set_opp() helper to work without regulators

Dmitry Osipenko
2021-01-19T18:28:52Z

19.01.2021 09:35, Viresh Kumar пишет:
> + mutex_lock(&opp_table->lock);
> + opp_table->set_opp_data = data;
> + if (opp_table->sod_supplies) {
> + data->old_opp.supplies = opp_table->sod_supplies;
> + data->new_opp.supplies = opp_table->sod_supplies +
> + opp_table->regulator_count;
> + }
> + mutex_unlock(&opp_table->lock);

Why do we need all these locks in this patch?

The OPP API isn't thread-safe, these locks won't make the API
thread-safe. At least both sod_supplies and set_opp() pointers should be
set and unset under the lock.

If you're about to make OPP thread-safe, then I suggest to do it
separately from this change. Otherwise this patch looks good to me.