phone-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] soc: qcom: pmic_glink_altmode: Print error when retimer setup fails
@ 2023-10-13 13:56 Luca Weiss
  2023-10-13 22:58 ` Konrad Dybcio
  2023-10-16  3:18 ` Bjorn Andersson
  0 siblings, 2 replies; 5+ messages in thread
From: Luca Weiss @ 2023-10-13 13:56 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Konrad Dybcio
  Cc: ~postmarketos/upstreaming, phone-devel, linux-arm-msm,
	linux-kernel, Luca Weiss

It can be useful to know with which return value the retimer_set call
failed, so include this info in the dev_err print.

Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
---
 drivers/soc/qcom/pmic_glink_altmode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/soc/qcom/pmic_glink_altmode.c b/drivers/soc/qcom/pmic_glink_altmode.c
index 9569d999391d..136713e1155e 100644
--- a/drivers/soc/qcom/pmic_glink_altmode.c
+++ b/drivers/soc/qcom/pmic_glink_altmode.c
@@ -168,7 +168,7 @@ static void pmic_glink_altmode_enable_dp(struct pmic_glink_altmode *altmode,
 
 	ret = typec_retimer_set(port->typec_retimer, &port->retimer_state);
 	if (ret)
-		dev_err(altmode->dev, "failed to setup retimer to DP\n");
+		dev_err(altmode->dev, "failed to setup retimer to DP: %d\n", ret);
 }
 
 static void pmic_glink_altmode_enable_usb(struct pmic_glink_altmode *altmode,

---
base-commit: e3b18f7200f45d66f7141136c25554ac1e82009b
change-id: 20231013-glink-altmode-ret-3911e6c1eab5

Best regards,
-- 
Luca Weiss <luca.weiss@fairphone.com>


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] soc: qcom: pmic_glink_altmode: Print error when retimer setup fails
  2023-10-13 13:56 [PATCH] soc: qcom: pmic_glink_altmode: Print error when retimer setup fails Luca Weiss
@ 2023-10-13 22:58 ` Konrad Dybcio
  2023-10-16  3:18 ` Bjorn Andersson
  1 sibling, 0 replies; 5+ messages in thread
From: Konrad Dybcio @ 2023-10-13 22:58 UTC (permalink / raw)
  To: Luca Weiss, Andy Gross, Bjorn Andersson
  Cc: ~postmarketos/upstreaming, phone-devel, linux-arm-msm, linux-kernel

On 13.10.2023 15:56, Luca Weiss wrote:
> It can be useful to know with which return value the retimer_set call
> failed, so include this info in the dev_err print.
> 
> Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
> ---
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>

Konrad

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] soc: qcom: pmic_glink_altmode: Print error when retimer setup fails
  2023-10-13 13:56 [PATCH] soc: qcom: pmic_glink_altmode: Print error when retimer setup fails Luca Weiss
  2023-10-13 22:58 ` Konrad Dybcio
@ 2023-10-16  3:18 ` Bjorn Andersson
  2023-10-16  6:56   ` Luca Weiss
  1 sibling, 1 reply; 5+ messages in thread
From: Bjorn Andersson @ 2023-10-16  3:18 UTC (permalink / raw)
  To: Luca Weiss
  Cc: Andy Gross, Konrad Dybcio, ~postmarketos/upstreaming,
	phone-devel, linux-arm-msm, linux-kernel

On Fri, Oct 13, 2023 at 03:56:40PM +0200, Luca Weiss wrote:
> It can be useful to know with which return value the retimer_set call
> failed, so include this info in the dev_err print.
> 

Is this useful during development, or during normal execution etc. How
about using kretprobe or similar tools?


If you insist, could you please make sure that the style matches across
the various typec_*_set() calls in the driver?

Regards,
Bjorn

> Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
> ---
>  drivers/soc/qcom/pmic_glink_altmode.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/soc/qcom/pmic_glink_altmode.c b/drivers/soc/qcom/pmic_glink_altmode.c
> index 9569d999391d..136713e1155e 100644
> --- a/drivers/soc/qcom/pmic_glink_altmode.c
> +++ b/drivers/soc/qcom/pmic_glink_altmode.c
> @@ -168,7 +168,7 @@ static void pmic_glink_altmode_enable_dp(struct pmic_glink_altmode *altmode,
>  
>  	ret = typec_retimer_set(port->typec_retimer, &port->retimer_state);
>  	if (ret)
> -		dev_err(altmode->dev, "failed to setup retimer to DP\n");
> +		dev_err(altmode->dev, "failed to setup retimer to DP: %d\n", ret);
>  }
>  
>  static void pmic_glink_altmode_enable_usb(struct pmic_glink_altmode *altmode,
> 
> ---
> base-commit: e3b18f7200f45d66f7141136c25554ac1e82009b
> change-id: 20231013-glink-altmode-ret-3911e6c1eab5
> 
> Best regards,
> -- 
> Luca Weiss <luca.weiss@fairphone.com>
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] soc: qcom: pmic_glink_altmode: Print error when retimer setup fails
  2023-10-16  3:18 ` Bjorn Andersson
@ 2023-10-16  6:56   ` Luca Weiss
  2023-10-16 18:38     ` Bjorn Andersson
  0 siblings, 1 reply; 5+ messages in thread
From: Luca Weiss @ 2023-10-16  6:56 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Andy Gross, Konrad Dybcio, ~postmarketos/upstreaming,
	phone-devel, linux-arm-msm, linux-kernel

On Mon Oct 16, 2023 at 5:18 AM CEST, Bjorn Andersson wrote:
> On Fri, Oct 13, 2023 at 03:56:40PM +0200, Luca Weiss wrote:
> > It can be useful to know with which return value the retimer_set call
> > failed, so include this info in the dev_err print.
> > 
>
> Is this useful during development, or during normal execution etc. How
> about using kretprobe or similar tools?

Hi Bjorn,

IIRC I encountered this during development of my retimer driver, where
the op in that driver failed for some reason and it was very useful to
get the return value to debug that.

And sure, I guess kretprobe might be also useful here but I think it's
very common to include the return value in the error message when
something fails, no?

> If you insist, could you please make sure that the style matches across
> the various typec_*_set() calls in the driver?

Do you mean adding the return value to the other dev_err prints after
typec_*_set() calls also?

Regards
Luca

>
> Regards,
> Bjorn
>
> > Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
> > ---
> >  drivers/soc/qcom/pmic_glink_altmode.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/soc/qcom/pmic_glink_altmode.c b/drivers/soc/qcom/pmic_glink_altmode.c
> > index 9569d999391d..136713e1155e 100644
> > --- a/drivers/soc/qcom/pmic_glink_altmode.c
> > +++ b/drivers/soc/qcom/pmic_glink_altmode.c
> > @@ -168,7 +168,7 @@ static void pmic_glink_altmode_enable_dp(struct pmic_glink_altmode *altmode,
> >  
> >  	ret = typec_retimer_set(port->typec_retimer, &port->retimer_state);
> >  	if (ret)
> > -		dev_err(altmode->dev, "failed to setup retimer to DP\n");
> > +		dev_err(altmode->dev, "failed to setup retimer to DP: %d\n", ret);
> >  }
> >  
> >  static void pmic_glink_altmode_enable_usb(struct pmic_glink_altmode *altmode,
> > 
> > ---
> > base-commit: e3b18f7200f45d66f7141136c25554ac1e82009b
> > change-id: 20231013-glink-altmode-ret-3911e6c1eab5
> > 
> > Best regards,
> > -- 
> > Luca Weiss <luca.weiss@fairphone.com>
> > 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] soc: qcom: pmic_glink_altmode: Print error when retimer setup fails
  2023-10-16  6:56   ` Luca Weiss
@ 2023-10-16 18:38     ` Bjorn Andersson
  0 siblings, 0 replies; 5+ messages in thread
From: Bjorn Andersson @ 2023-10-16 18:38 UTC (permalink / raw)
  To: Luca Weiss
  Cc: Andy Gross, Konrad Dybcio, ~postmarketos/upstreaming,
	phone-devel, linux-arm-msm, linux-kernel

On Mon, Oct 16, 2023 at 08:56:31AM +0200, Luca Weiss wrote:
> On Mon Oct 16, 2023 at 5:18 AM CEST, Bjorn Andersson wrote:
> > On Fri, Oct 13, 2023 at 03:56:40PM +0200, Luca Weiss wrote:
> > > It can be useful to know with which return value the retimer_set call
> > > failed, so include this info in the dev_err print.
> > > 
> >
> > Is this useful during development, or during normal execution etc. How
> > about using kretprobe or similar tools?
> 
> Hi Bjorn,
> 
> IIRC I encountered this during development of my retimer driver, where
> the op in that driver failed for some reason and it was very useful to
> get the return value to debug that.
> 
> And sure, I guess kretprobe might be also useful here but I think it's
> very common to include the return value in the error message when
> something fails, no?
> 

The problem with the error message is that you often get some generic
error code, but don't know where it came from anyway. So, I typically
use function_graph and set_graph_function to capture the path through
the called function(s)...

But that said, it is fairly common to include the error value, so I am
not against it.

> > If you insist, could you please make sure that the style matches across
> > the various typec_*_set() calls in the driver?
> 
> Do you mean adding the return value to the other dev_err prints after
> typec_*_set() calls also?
> 

I mean that we should be consistent across the error prints, and either
include the error value in all or none of the typec error prints.

Regards,
Bjorn

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-10-16 18:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-13 13:56 [PATCH] soc: qcom: pmic_glink_altmode: Print error when retimer setup fails Luca Weiss
2023-10-13 22:58 ` Konrad Dybcio
2023-10-16  3:18 ` Bjorn Andersson
2023-10-16  6:56   ` Luca Weiss
2023-10-16 18:38     ` Bjorn Andersson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).