diff mbox series

clk: qcom: gdsc: treat optional supplies as optional

Message ID 20240325085835.26158-1-johan+linaro@kernel.org (mailing list archive)
State Accepted
Commit 6677196fb1932e60b88ad0794a7ae532df178654
Headers show
Series clk: qcom: gdsc: treat optional supplies as optional | expand

Commit Message

Johan Hovold March 25, 2024, 8:58 a.m. UTC
Since commit deebc79b28d6 ("clk: qcom: gpucc-sc8280xp: Add external
supply for GX gdsc") the GDSC supply must be treated as optional to
avoid warnings like:

	gpu_cc-sc8280xp 3d90000.clock-controller: supply vdd-gfx not found, using dummy regulator

on SC8280XP.

Fortunately, the driver is already prepared to handle this by checking
that the regulator pointer is non-NULL before use.

This also avoids triggering a potential deadlock on SC8280XP even if the
underlying issue still remains for the derivative platforms like SA8295P
that actually use the supply.

Fixes: deebc79b28d6 ("clk: qcom: gpucc-sc8280xp: Add external supply for GX gdsc")
Link: https://lore.kernel.org/lkml/Zf25Sv2x9WaCFuIH@hovoldconsulting.com/
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
 drivers/clk/qcom/gdsc.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

Comments

Bjorn Andersson March 25, 2024, 2:02 p.m. UTC | #1
On Mon, Mar 25, 2024 at 09:58:35AM +0100, Johan Hovold wrote:
> Since commit deebc79b28d6 ("clk: qcom: gpucc-sc8280xp: Add external
> supply for GX gdsc") the GDSC supply must be treated as optional to
> avoid warnings like:
> 
> 	gpu_cc-sc8280xp 3d90000.clock-controller: supply vdd-gfx not found, using dummy regulator
> 
> on SC8280XP.
> 
> Fortunately, the driver is already prepared to handle this by checking
> that the regulator pointer is non-NULL before use.
> 
> This also avoids triggering a potential deadlock on SC8280XP even if the
> underlying issue still remains for the derivative platforms like SA8295P
> that actually use the supply.
> 
> Fixes: deebc79b28d6 ("clk: qcom: gpucc-sc8280xp: Add external supply for GX gdsc")
> Link: https://lore.kernel.org/lkml/Zf25Sv2x9WaCFuIH@hovoldconsulting.com/
> Signed-off-by: Johan Hovold <johan+linaro@kernel.org>

Thanks for fixing this, it never made it off my todo list...

Reviewed-by: Bjorn Andersson <andersson@kernel.org>

Regards,
Bjorn

> ---
>  drivers/clk/qcom/gdsc.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/clk/qcom/gdsc.c b/drivers/clk/qcom/gdsc.c
> index e7a4068b9f39..df9618ab7eea 100644
> --- a/drivers/clk/qcom/gdsc.c
> +++ b/drivers/clk/qcom/gdsc.c
> @@ -487,9 +487,14 @@ int gdsc_register(struct gdsc_desc *desc,
>  		if (!scs[i] || !scs[i]->supply)
>  			continue;
>  
> -		scs[i]->rsupply = devm_regulator_get(dev, scs[i]->supply);
> -		if (IS_ERR(scs[i]->rsupply))
> -			return PTR_ERR(scs[i]->rsupply);
> +		scs[i]->rsupply = devm_regulator_get_optional(dev, scs[i]->supply);
> +		if (IS_ERR(scs[i]->rsupply)) {
> +			ret = PTR_ERR(scs[i]->rsupply);
> +			if (ret != -ENODEV)
> +				return ret;
> +
> +			scs[i]->rsupply = NULL;
> +		}
>  	}
>  
>  	data->num_domains = num;
> -- 
> 2.43.0
>
Bjorn Andersson April 4, 2024, 9:22 p.m. UTC | #2
On Mon, 25 Mar 2024 09:58:35 +0100, Johan Hovold wrote:
> Since commit deebc79b28d6 ("clk: qcom: gpucc-sc8280xp: Add external
> supply for GX gdsc") the GDSC supply must be treated as optional to
> avoid warnings like:
> 
> 	gpu_cc-sc8280xp 3d90000.clock-controller: supply vdd-gfx not found, using dummy regulator
> 
> on SC8280XP.
> 
> [...]

Applied, thanks!

[1/1] clk: qcom: gdsc: treat optional supplies as optional
      commit: 6677196fb1932e60b88ad0794a7ae532df178654

Best regards,
Thorsten Leemhuis April 22, 2024, 10:31 a.m. UTC | #3
On 04.04.24 23:22, Bjorn Andersson wrote:
> 
> On Mon, 25 Mar 2024 09:58:35 +0100, Johan Hovold wrote:
>> Since commit deebc79b28d6 ("clk: qcom: gpucc-sc8280xp: Add external
>> supply for GX gdsc") the GDSC supply must be treated as optional to
>> avoid warnings like:
>>
>> 	gpu_cc-sc8280xp 3d90000.clock-controller: supply vdd-gfx not found, using dummy regulator
>>
>> on SC8280XP.
>>
>> [...]
> 
> Applied, thanks!
> 
> [1/1] clk: qcom: gdsc: treat optional supplies as optional
>       commit: 6677196fb1932e60b88ad0794a7ae532df178654

Bjorn, quick question: this regression fix after more than two and a
half weeks is not yet mainlined. Is there a reason? Or am I missing
something here?

Ciao, Thorsten (wearing his 'the Linux kernel's regression tracker' hat)
--
Everything you wanna know about Linux kernel regression tracking:
https://linux-regtracking.leemhuis.info/about/#tldr
If I did something stupid, please tell me, as explained on that page.

#regzbot poke
Bjorn Andersson April 22, 2024, 6:31 p.m. UTC | #4
On Mon, Apr 22, 2024 at 12:31:37PM +0200, Linux regression tracking (Thorsten Leemhuis) wrote:
> On 04.04.24 23:22, Bjorn Andersson wrote:
> > 
> > On Mon, 25 Mar 2024 09:58:35 +0100, Johan Hovold wrote:
> >> Since commit deebc79b28d6 ("clk: qcom: gpucc-sc8280xp: Add external
> >> supply for GX gdsc") the GDSC supply must be treated as optional to
> >> avoid warnings like:
> >>
> >> 	gpu_cc-sc8280xp 3d90000.clock-controller: supply vdd-gfx not found, using dummy regulator
> >>
> >> on SC8280XP.
> >>
> >> [...]
> > 
> > Applied, thanks!
> > 
> > [1/1] clk: qcom: gdsc: treat optional supplies as optional
> >       commit: 6677196fb1932e60b88ad0794a7ae532df178654
> 
> Bjorn, quick question: this regression fix after more than two and a
> half weeks is not yet mainlined. Is there a reason? Or am I missing
> something here?
> 

I failed to propagate it, until only a few days back. It should show up
shortly.

Thanks,
Bjorn

> Ciao, Thorsten (wearing his 'the Linux kernel's regression tracker' hat)
> --
> Everything you wanna know about Linux kernel regression tracking:
> https://linux-regtracking.leemhuis.info/about/#tldr
> If I did something stupid, please tell me, as explained on that page.
> 
> #regzbot poke
diff mbox series

Patch

diff --git a/drivers/clk/qcom/gdsc.c b/drivers/clk/qcom/gdsc.c
index e7a4068b9f39..df9618ab7eea 100644
--- a/drivers/clk/qcom/gdsc.c
+++ b/drivers/clk/qcom/gdsc.c
@@ -487,9 +487,14 @@  int gdsc_register(struct gdsc_desc *desc,
 		if (!scs[i] || !scs[i]->supply)
 			continue;
 
-		scs[i]->rsupply = devm_regulator_get(dev, scs[i]->supply);
-		if (IS_ERR(scs[i]->rsupply))
-			return PTR_ERR(scs[i]->rsupply);
+		scs[i]->rsupply = devm_regulator_get_optional(dev, scs[i]->supply);
+		if (IS_ERR(scs[i]->rsupply)) {
+			ret = PTR_ERR(scs[i]->rsupply);
+			if (ret != -ENODEV)
+				return ret;
+
+			scs[i]->rsupply = NULL;
+		}
 	}
 
 	data->num_domains = num;