diff mbox series

[v9,1/4] clk: qcom: gdsc: Release pm subdomains in reverse add order

Message ID 20241230-b4-linux-next-24-11-18-clock-multiple-power-domains-v9-1-f15fb405efa5@linaro.org (mailing list archive)
State Under Review
Headers show
Series clk: qcom: Add support for multiple power-domains for a clock controller. | expand

Commit Message

Bryan O'Donoghue Dec. 30, 2024, 1:30 p.m. UTC
gdsc_unregister() should release subdomains in the reverse order to the
order in which those subdomains were added.

Fixes: 1b771839de05 ("clk: qcom: gdsc: enable optional power domain support")
Cc: stable@vger.kernel.org
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 drivers/clk/qcom/gdsc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Bjorn Andersson Jan. 6, 2025, 4:53 p.m. UTC | #1
On Mon, Dec 30, 2024 at 01:30:18PM +0000, Bryan O'Donoghue wrote:
> gdsc_unregister() should release subdomains in the reverse order to the
> order in which those subdomains were added.
> 

This sounds very reasonable to me, but what's the actual reason?

> Fixes: 1b771839de05 ("clk: qcom: gdsc: enable optional power domain support")
> Cc: stable@vger.kernel.org

Without a reason it's hard to see why this needs to be backported.

Regards,
Bjorn

> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> ---
>  drivers/clk/qcom/gdsc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/qcom/gdsc.c b/drivers/clk/qcom/gdsc.c
> index fa5fe4c2a2ee7786c2e8858f3e41301f639e5d59..bc1b1e37bf4222017c172b77603f8dedba961ed5 100644
> --- a/drivers/clk/qcom/gdsc.c
> +++ b/drivers/clk/qcom/gdsc.c
> @@ -571,7 +571,7 @@ void gdsc_unregister(struct gdsc_desc *desc)
>  	size_t num = desc->num;
>  
>  	/* Remove subdomains */
> -	for (i = 0; i < num; i++) {
> +	for (i = num - 1; i >= 0; i--) {
>  		if (!scs[i])
>  			continue;
>  		if (scs[i]->parent)
> 
> -- 
> 2.45.2
>
Bryan O'Donoghue Jan. 6, 2025, 4:55 p.m. UTC | #2
On 06/01/2025 16:53, Bjorn Andersson wrote:
> This sounds very reasonable to me, but what's the actual reason?
> 
>> Fixes: 1b771839de05 ("clk: qcom: gdsc: enable optional power domain support")
>> Cc:stable@vger.kernel.org
> Without a reason it's hard to see why this needs to be backported.
> 
> Regards,
> Bjorn

The reason is it makes the next patch much cleaner and makes backporting 
the Fixes in the next patch cleaner too.

I could squash the two patches together as another option..
Bjorn Andersson Jan. 8, 2025, 4:28 a.m. UTC | #3
On Mon, Jan 06, 2025 at 04:55:18PM +0000, Bryan O'Donoghue wrote:
> On 06/01/2025 16:53, Bjorn Andersson wrote:
> > This sounds very reasonable to me, but what's the actual reason?
> > 
> > > Fixes: 1b771839de05 ("clk: qcom: gdsc: enable optional power domain support")
> > > Cc:stable@vger.kernel.org
> > Without a reason it's hard to see why this needs to be backported.
> > 
> > Regards,
> > Bjorn
> 
> The reason is it makes the next patch much cleaner and makes backporting the
> Fixes in the next patch cleaner too.
> 

That makes sense, but let's state that in the commit message then.

> I could squash the two patches together as another option..

That would work too. Although in the unexpected case that the order has
any impact on outcome it would still be nice to have a comment about why
it was done - and why it was flagged for stable backporting.

Regards,
Bjorn
diff mbox series

Patch

diff --git a/drivers/clk/qcom/gdsc.c b/drivers/clk/qcom/gdsc.c
index fa5fe4c2a2ee7786c2e8858f3e41301f639e5d59..bc1b1e37bf4222017c172b77603f8dedba961ed5 100644
--- a/drivers/clk/qcom/gdsc.c
+++ b/drivers/clk/qcom/gdsc.c
@@ -571,7 +571,7 @@  void gdsc_unregister(struct gdsc_desc *desc)
 	size_t num = desc->num;
 
 	/* Remove subdomains */
-	for (i = 0; i < num; i++) {
+	for (i = num - 1; i >= 0; i--) {
 		if (!scs[i])
 			continue;
 		if (scs[i]->parent)