Messages in this thread | | | Subject | Re: [PATCH] opp: Prepare for ->set_opp() helper to work without regulators | From | Dmitry Osipenko <> | Date | Tue, 19 Jan 2021 20:16:11 +0300 |
| |
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.
| |