diff mbox series

[v1] phy/qcom-qmp-combo: propagate correct return value at phy_power_on()

Message ID 1711660035-9656-1-git-send-email-quic_khsieh@quicinc.com (mailing list archive)
State New, archived
Headers show
Series [v1] phy/qcom-qmp-combo: propagate correct return value at phy_power_on() | expand

Commit Message

Kuogee Hsieh March 28, 2024, 9:07 p.m. UTC
Currently qmp_combo_dp_power_on() always return 0 in regardless of
return value of cfg->configure_dp_phy(). This patch propagate
return value of cfg->configure_dp_phy() all the way back to caller.

Signed-off-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
---
 drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Abhinav Kumar March 28, 2024, 9:36 p.m. UTC | #1
On 3/28/2024 2:07 PM, Kuogee Hsieh wrote:
> Currently qmp_combo_dp_power_on() always return 0 in regardless of
> return value of cfg->configure_dp_phy(). This patch propagate
> return value of cfg->configure_dp_phy() all the way back to caller.
> 

This is good. But I am also thinking if we should add some prints in 
this driver like it doesnt even tell where it failed like here


         ret = qmp_v456_configure_dp_phy(qmp);
         if (ret < 0)
                 return ret;

> Signed-off-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
> ---
>   drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 

Also, I think we should have

Fixes: 94a407cc17a4 ("phy: qcom-qmp: create copies of QMP PHY driver")

If there is a better fixes tag for this, please let me know.

> diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
> index 36632fa..884973a 100644
> --- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
> +++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
> @@ -2754,6 +2754,7 @@ static int qmp_combo_dp_power_on(struct phy *phy)
>   	const struct qmp_phy_cfg *cfg = qmp->cfg;
>   	void __iomem *tx = qmp->dp_tx;
>   	void __iomem *tx2 = qmp->dp_tx2;
> +	int ret = 0;
>   
>   	mutex_lock(&qmp->phy_mutex);
>   
> @@ -2766,11 +2767,11 @@ static int qmp_combo_dp_power_on(struct phy *phy)
>   	cfg->configure_dp_tx(qmp);
>   
>   	/* Configure link rate, swing, etc. */
> -	cfg->configure_dp_phy(qmp);
> +	ret = cfg->configure_dp_phy(qmp);
>   
>   	mutex_unlock(&qmp->phy_mutex);
>   
> -	return 0;
> +	return ret;
>   }
>   
>   static int qmp_combo_dp_power_off(struct phy *phy)
Dmitry Baryshkov March 28, 2024, 10:36 p.m. UTC | #2
On Thu, 28 Mar 2024 at 23:36, Abhinav Kumar <quic_abhinavk@quicinc.com> wrote:
>
>
>
> On 3/28/2024 2:07 PM, Kuogee Hsieh wrote:
> > Currently qmp_combo_dp_power_on() always return 0 in regardless of
> > return value of cfg->configure_dp_phy(). This patch propagate
> > return value of cfg->configure_dp_phy() all the way back to caller.
> >
>
> This is good. But I am also thinking if we should add some prints in
> this driver like it doesnt even tell where it failed like here
>
>
>          ret = qmp_v456_configure_dp_phy(qmp);
>          if (ret < 0)
>                  return ret;
>
> > Signed-off-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
> > ---
> >   drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 5 +++--
> >   1 file changed, 3 insertions(+), 2 deletions(-)
> >
>
> Also, I think we should have
>
> Fixes: 94a407cc17a4 ("phy: qcom-qmp: create copies of QMP PHY driver")
>
> If there is a better fixes tag for this, please let me know.

Fixes: 52e013d0bffa ("phy: qcom-qmp: Add support for DP in USB3+DP combo phy")

Otherwise LGTM

>
> > diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
> > index 36632fa..884973a 100644
> > --- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
> > +++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
> > @@ -2754,6 +2754,7 @@ static int qmp_combo_dp_power_on(struct phy *phy)
> >       const struct qmp_phy_cfg *cfg = qmp->cfg;
> >       void __iomem *tx = qmp->dp_tx;
> >       void __iomem *tx2 = qmp->dp_tx2;
> > +     int ret = 0;
> >
> >       mutex_lock(&qmp->phy_mutex);
> >
> > @@ -2766,11 +2767,11 @@ static int qmp_combo_dp_power_on(struct phy *phy)
> >       cfg->configure_dp_tx(qmp);
> >
> >       /* Configure link rate, swing, etc. */
> > -     cfg->configure_dp_phy(qmp);
> > +     ret = cfg->configure_dp_phy(qmp);
> >
> >       mutex_unlock(&qmp->phy_mutex);
> >
> > -     return 0;
> > +     return ret;
> >   }
> >
> >   static int qmp_combo_dp_power_off(struct phy *phy)
Stephen Boyd March 29, 2024, 12:24 a.m. UTC | #3
Quoting Kuogee Hsieh (2024-03-28 14:07:15)
> diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
> index 36632fa..884973a 100644
> --- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
> +++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
> @@ -2754,6 +2754,7 @@ static int qmp_combo_dp_power_on(struct phy *phy)
>         const struct qmp_phy_cfg *cfg = qmp->cfg;
>         void __iomem *tx = qmp->dp_tx;
>         void __iomem *tx2 = qmp->dp_tx2;
> +       int ret = 0;

Please don't initialize locals that are unused before being assigned
unconditionally.

>
>         mutex_lock(&qmp->phy_mutex);
>
> @@ -2766,11 +2767,11 @@ static int qmp_combo_dp_power_on(struct phy *phy)
>         cfg->configure_dp_tx(qmp);
>
>         /* Configure link rate, swing, etc. */
> -       cfg->configure_dp_phy(qmp);
> +       ret = cfg->configure_dp_phy(qmp);
>
>         mutex_unlock(&qmp->phy_mutex);
>
> -       return 0;
> +       return ret;
>  }
diff mbox series

Patch

diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
index 36632fa..884973a 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
@@ -2754,6 +2754,7 @@  static int qmp_combo_dp_power_on(struct phy *phy)
 	const struct qmp_phy_cfg *cfg = qmp->cfg;
 	void __iomem *tx = qmp->dp_tx;
 	void __iomem *tx2 = qmp->dp_tx2;
+	int ret = 0;
 
 	mutex_lock(&qmp->phy_mutex);
 
@@ -2766,11 +2767,11 @@  static int qmp_combo_dp_power_on(struct phy *phy)
 	cfg->configure_dp_tx(qmp);
 
 	/* Configure link rate, swing, etc. */
-	cfg->configure_dp_phy(qmp);
+	ret = cfg->configure_dp_phy(qmp);
 
 	mutex_unlock(&qmp->phy_mutex);
 
-	return 0;
+	return ret;
 }
 
 static int qmp_combo_dp_power_off(struct phy *phy)