Quoting Dmitry Baryshkov (2021-06-29 13:39:19) > Properly remove registered genpds. Also remove the provider before > breaking parent/child links, so that the system is consistent at remove > time. > > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx> > --- > drivers/clk/qcom/gdsc.c | 11 ++++++++++- > 1 file changed, 10 insertions(+), 1 deletion(-) > > diff --git a/drivers/clk/qcom/gdsc.c b/drivers/clk/qcom/gdsc.c > index 241186d9d08c..4b211dd1764d 100644 > --- a/drivers/clk/qcom/gdsc.c > +++ b/drivers/clk/qcom/gdsc.c > @@ -475,6 +475,9 @@ void gdsc_unregister(struct gdsc_desc *desc) > struct gdsc **scs = desc->scs; > size_t num = desc->num; > > + /* Remove provider first */ but why? A better comment would be /* * Remove provider first so that we can remove the genpds * without worrying about consumers getting them during the * removal process. */ > + of_genpd_del_provider(dev->of_node); > + > /* Remove subdomains */ > for (i = 0; i < num; i++) { > if (!scs[i]) > @@ -482,7 +485,13 @@ void gdsc_unregister(struct gdsc_desc *desc) > if (scs[i]->parent) > pm_genpd_remove_subdomain(scs[i]->parent, &scs[i]->pd); > } > - of_genpd_del_provider(dev->of_node); > + > + /* Remove domains themselves */ > + for (i = 0; i < num; i++) { > + if (!scs[i]) > + continue; > + pm_genpd_remove(&scs[i]->pd); > + } > }