Message ID | 20250218-videocc-pll-multi-pd-voting-v1-3-cfe6289ea29b@quicinc.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | clk: qcom: Add support to attach multiple power domains in cc probe | expand |
On Tue, Feb 18, 2025 at 07:56:48PM +0530, Jagadeesh Kona wrote: > Attach clock power domains in qcom_cc_really_probe() only > if the clock controller has not already attached to them. Squash this to the previous patch and call the new function. No need to duplicate the code. > > Signed-off-by: Jagadeesh Kona <quic_jkona@quicinc.com> > --- > drivers/clk/qcom/common.c | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > diff --git a/drivers/clk/qcom/common.c b/drivers/clk/qcom/common.c > index ec27f70b24bdec24edd2f6b3df0d766fc1cdcbf0..eb7e2a56d1d135f839fd9bd470ba6231ce775a8c 100644 > --- a/drivers/clk/qcom/common.c > +++ b/drivers/clk/qcom/common.c > @@ -300,9 +300,12 @@ int qcom_cc_really_probe(struct device *dev, > if (!cc) > return -ENOMEM; > > - ret = devm_pm_domain_attach_list(dev, NULL, &cc->pd_list); > - if (ret < 0 && ret != -EEXIST) > - return ret; > + cc->pd_list = desc->pd_list; > + if (!cc->pd_list) { > + ret = devm_pm_domain_attach_list(dev, NULL, &cc->pd_list); > + if (ret < 0 && ret != -EEXIST) > + return ret; > + } > > reset = &cc->reset; > reset->rcdev.of_node = dev->of_node; > > -- > 2.34.1 >
On 2/18/2025 10:48 PM, Dmitry Baryshkov wrote: > On Tue, Feb 18, 2025 at 07:56:48PM +0530, Jagadeesh Kona wrote: >> Attach clock power domains in qcom_cc_really_probe() only >> if the clock controller has not already attached to them. > > Squash this to the previous patch and call the new function. No need to > duplicate the code. > I tried calling the new function here instead of duplicating code, but that is leading to below warning since the desc passed to qcom_cc_really_probe() has a const qualifier and hence we cannot update desc->pd_list inside qcom_cc_really_probe(). drivers/clk/qcom/common.c:305:33: WARNING : passing argument 2 of ‘qcom_cc_attach_pds’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] Thanks, Jagadeesh >> >> Signed-off-by: Jagadeesh Kona <quic_jkona@quicinc.com> >> --- >> drivers/clk/qcom/common.c | 9 ++++++--- >> 1 file changed, 6 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/clk/qcom/common.c b/drivers/clk/qcom/common.c >> index ec27f70b24bdec24edd2f6b3df0d766fc1cdcbf0..eb7e2a56d1d135f839fd9bd470ba6231ce775a8c 100644 >> --- a/drivers/clk/qcom/common.c >> +++ b/drivers/clk/qcom/common.c >> @@ -300,9 +300,12 @@ int qcom_cc_really_probe(struct device *dev, >> if (!cc) >> return -ENOMEM; >> >> - ret = devm_pm_domain_attach_list(dev, NULL, &cc->pd_list); >> - if (ret < 0 && ret != -EEXIST) >> - return ret; >> + cc->pd_list = desc->pd_list; >> + if (!cc->pd_list) { >> + ret = devm_pm_domain_attach_list(dev, NULL, &cc->pd_list); >> + if (ret < 0 && ret != -EEXIST) >> + return ret; >> + } >> >> reset = &cc->reset; >> reset->rcdev.of_node = dev->of_node; >> >> -- >> 2.34.1 >> >
On Wed, Feb 19, 2025 at 05:06:11PM +0530, Jagadeesh Kona wrote: > > > On 2/18/2025 10:48 PM, Dmitry Baryshkov wrote: > > On Tue, Feb 18, 2025 at 07:56:48PM +0530, Jagadeesh Kona wrote: > >> Attach clock power domains in qcom_cc_really_probe() only > >> if the clock controller has not already attached to them. > > > > Squash this to the previous patch and call the new function. No need to > > duplicate the code. > > > > I tried calling the new function here instead of duplicating code, but that > is leading to below warning since the desc passed to qcom_cc_really_probe() > has a const qualifier and hence we cannot update desc->pd_list inside > qcom_cc_really_probe(). > > drivers/clk/qcom/common.c:305:33: WARNING : passing argument 2 of ‘qcom_cc_attach_pds’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] It sounds like this can be fixed with a one-line patch. > > Thanks, > Jagadeesh > > >> > >> Signed-off-by: Jagadeesh Kona <quic_jkona@quicinc.com> > >> --- > >> drivers/clk/qcom/common.c | 9 ++++++--- > >> 1 file changed, 6 insertions(+), 3 deletions(-) > >> > >> diff --git a/drivers/clk/qcom/common.c b/drivers/clk/qcom/common.c > >> index ec27f70b24bdec24edd2f6b3df0d766fc1cdcbf0..eb7e2a56d1d135f839fd9bd470ba6231ce775a8c 100644 > >> --- a/drivers/clk/qcom/common.c > >> +++ b/drivers/clk/qcom/common.c > >> @@ -300,9 +300,12 @@ int qcom_cc_really_probe(struct device *dev, > >> if (!cc) > >> return -ENOMEM; > >> > >> - ret = devm_pm_domain_attach_list(dev, NULL, &cc->pd_list); > >> - if (ret < 0 && ret != -EEXIST) > >> - return ret; > >> + cc->pd_list = desc->pd_list; > >> + if (!cc->pd_list) { > >> + ret = devm_pm_domain_attach_list(dev, NULL, &cc->pd_list); > >> + if (ret < 0 && ret != -EEXIST) > >> + return ret; > >> + } > >> > >> reset = &cc->reset; > >> reset->rcdev.of_node = dev->of_node; > >> > >> -- > >> 2.34.1 > >> > >
On 2/19/2025 5:27 PM, Dmitry Baryshkov wrote: > On Wed, Feb 19, 2025 at 05:06:11PM +0530, Jagadeesh Kona wrote: >> >> >> On 2/18/2025 10:48 PM, Dmitry Baryshkov wrote: >>> On Tue, Feb 18, 2025 at 07:56:48PM +0530, Jagadeesh Kona wrote: >>>> Attach clock power domains in qcom_cc_really_probe() only >>>> if the clock controller has not already attached to them. >>> >>> Squash this to the previous patch and call the new function. No need to >>> duplicate the code. >>> >> >> I tried calling the new function here instead of duplicating code, but that >> is leading to below warning since the desc passed to qcom_cc_really_probe() >> has a const qualifier and hence we cannot update desc->pd_list inside >> qcom_cc_really_probe(). >> >> drivers/clk/qcom/common.c:305:33: WARNING : passing argument 2 of ‘qcom_cc_attach_pds’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] > > It sounds like this can be fixed with a one-line patch. > Removing const qualifier to qcom_cc_really_probe() will fix this, but that requires changes in many other drivers which are currently passing const descriptor to it. But I can squash this to my previous patch by updating my qcom_cc_attach_pds() function prototype as below and then calling that new function here -int qcom_cc_attach_pds(struct device *dev, struct qcom_cc_desc *desc) +int qcom_cc_attach_pds(struct device *dev, struct dev_pm_domain_list *pd_list) - ret = devm_pm_domain_attach_list(dev, NULL, &cc->pd_list); - if (ret < 0 && ret != -EEXIST) + ret = qcom_cc_attach_pds(dev, cc->pd_list); + if (ret) Thanks, Jagadeesh >> >> Thanks, >> Jagadeesh >> >>>> >>>> Signed-off-by: Jagadeesh Kona <quic_jkona@quicinc.com> >>>> --- >>>> drivers/clk/qcom/common.c | 9 ++++++--- >>>> 1 file changed, 6 insertions(+), 3 deletions(-) >>>> >>>> diff --git a/drivers/clk/qcom/common.c b/drivers/clk/qcom/common.c >>>> index ec27f70b24bdec24edd2f6b3df0d766fc1cdcbf0..eb7e2a56d1d135f839fd9bd470ba6231ce775a8c 100644 >>>> --- a/drivers/clk/qcom/common.c >>>> +++ b/drivers/clk/qcom/common.c >>>> @@ -300,9 +300,12 @@ int qcom_cc_really_probe(struct device *dev, >>>> if (!cc) >>>> return -ENOMEM; >>>> >>>> - ret = devm_pm_domain_attach_list(dev, NULL, &cc->pd_list); >>>> - if (ret < 0 && ret != -EEXIST) >>>> - return ret; >>>> + cc->pd_list = desc->pd_list; >>>> + if (!cc->pd_list) { >>>> + ret = devm_pm_domain_attach_list(dev, NULL, &cc->pd_list); >>>> + if (ret < 0 && ret != -EEXIST) >>>> + return ret; >>>> + } >>>> >>>> reset = &cc->reset; >>>> reset->rcdev.of_node = dev->of_node; >>>> >>>> -- >>>> 2.34.1 >>>> >>> >
On Thu, Feb 20, 2025 at 12:43:42PM +0530, Jagadeesh Kona wrote: > > > On 2/19/2025 5:27 PM, Dmitry Baryshkov wrote: > > On Wed, Feb 19, 2025 at 05:06:11PM +0530, Jagadeesh Kona wrote: > >> > >> > >> On 2/18/2025 10:48 PM, Dmitry Baryshkov wrote: > >>> On Tue, Feb 18, 2025 at 07:56:48PM +0530, Jagadeesh Kona wrote: > >>>> Attach clock power domains in qcom_cc_really_probe() only > >>>> if the clock controller has not already attached to them. > >>> > >>> Squash this to the previous patch and call the new function. No need to > >>> duplicate the code. > >>> > >> > >> I tried calling the new function here instead of duplicating code, but that > >> is leading to below warning since the desc passed to qcom_cc_really_probe() > >> has a const qualifier and hence we cannot update desc->pd_list inside > >> qcom_cc_really_probe(). > >> > >> drivers/clk/qcom/common.c:305:33: WARNING : passing argument 2 of ‘qcom_cc_attach_pds’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] > > > > It sounds like this can be fixed with a one-line patch. > > > > Removing const qualifier to qcom_cc_really_probe() will fix this, but that requires changes in > many other drivers which are currently passing const descriptor to it. And this points out that the pd_list should not be a part of the struct qcom_cc_desc. You are not using it in the code, so allocate that memory on the fly, pass it to devm_pm_domain_attach_list() and then forget about it. > > But I can squash this to my previous patch by updating my qcom_cc_attach_pds() function > prototype as below and then calling that new function here > > -int qcom_cc_attach_pds(struct device *dev, struct qcom_cc_desc *desc) > +int qcom_cc_attach_pds(struct device *dev, struct dev_pm_domain_list *pd_list) > > - ret = devm_pm_domain_attach_list(dev, NULL, &cc->pd_list); > - if (ret < 0 && ret != -EEXIST) > + ret = qcom_cc_attach_pds(dev, cc->pd_list); > + if (ret) > > Thanks, > Jagadeesh > > >> > >> Thanks, > >> Jagadeesh > >> > >>>> > >>>> Signed-off-by: Jagadeesh Kona <quic_jkona@quicinc.com> > >>>> --- > >>>> drivers/clk/qcom/common.c | 9 ++++++--- > >>>> 1 file changed, 6 insertions(+), 3 deletions(-) > >>>> > >>>> diff --git a/drivers/clk/qcom/common.c b/drivers/clk/qcom/common.c > >>>> index ec27f70b24bdec24edd2f6b3df0d766fc1cdcbf0..eb7e2a56d1d135f839fd9bd470ba6231ce775a8c 100644 > >>>> --- a/drivers/clk/qcom/common.c > >>>> +++ b/drivers/clk/qcom/common.c > >>>> @@ -300,9 +300,12 @@ int qcom_cc_really_probe(struct device *dev, > >>>> if (!cc) > >>>> return -ENOMEM; > >>>> > >>>> - ret = devm_pm_domain_attach_list(dev, NULL, &cc->pd_list); > >>>> - if (ret < 0 && ret != -EEXIST) > >>>> - return ret; > >>>> + cc->pd_list = desc->pd_list; > >>>> + if (!cc->pd_list) { > >>>> + ret = devm_pm_domain_attach_list(dev, NULL, &cc->pd_list); > >>>> + if (ret < 0 && ret != -EEXIST) > >>>> + return ret; > >>>> + } > >>>> > >>>> reset = &cc->reset; > >>>> reset->rcdev.of_node = dev->of_node; > >>>> > >>>> -- > >>>> 2.34.1 > >>>> > >>> > >
diff --git a/drivers/clk/qcom/common.c b/drivers/clk/qcom/common.c index ec27f70b24bdec24edd2f6b3df0d766fc1cdcbf0..eb7e2a56d1d135f839fd9bd470ba6231ce775a8c 100644 --- a/drivers/clk/qcom/common.c +++ b/drivers/clk/qcom/common.c @@ -300,9 +300,12 @@ int qcom_cc_really_probe(struct device *dev, if (!cc) return -ENOMEM; - ret = devm_pm_domain_attach_list(dev, NULL, &cc->pd_list); - if (ret < 0 && ret != -EEXIST) - return ret; + cc->pd_list = desc->pd_list; + if (!cc->pd_list) { + ret = devm_pm_domain_attach_list(dev, NULL, &cc->pd_list); + if (ret < 0 && ret != -EEXIST) + return ret; + } reset = &cc->reset; reset->rcdev.of_node = dev->of_node;
Attach clock power domains in qcom_cc_really_probe() only if the clock controller has not already attached to them. Signed-off-by: Jagadeesh Kona <quic_jkona@quicinc.com> --- drivers/clk/qcom/common.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)