Skip to contentSkip to conversation

phy: qcom-qmp: pipe clock cleanups

PATCH Applied Johan Hovold 4 participants 9 messages Jun 23, 2022 – Jul 5, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover phy: qcom-qmp: pipe clock cleanups

Here are some follow-up cleanups after the recent driver split.

Johan

Johan Hovold (3):
phy: qcom-qmp-pcie: drop obsolete pipe clock type check
phy: qcom-qmp-pcie-msm8996: drop obsolete pipe clock type check
phy: qcom-qmp-usb: clean up pipe clock handling

 .../phy/qualcomm/phy-qcom-qmp-pcie-msm8996.c  | 19 ++-----------------
 drivers/phy/qualcomm/phy-qcom-qmp-pcie.c      | 19 ++-----------------
 drivers/phy/qualcomm/phy-qcom-qmp-usb.c       | 15 ++-------------
 3 files changed, 6 insertions(+), 47 deletions(-)
Signature · 1 line
2.35.1
#1 lore raw

PATCH 1/3 phy: qcom-qmp-pcie: drop obsolete pipe clock type check

Drop the obsolete pipe clock handling which was used to treat the pipe clock as optional for types other than PCIe and USB and which is no longer needed since splitting the PHY driver.

---
 drivers/phy/qualcomm/phy-qcom-qmp-pcie.c | 19 ++-----------------
 1 file changed, 2 insertions(+), 17 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-pcie.c +2 -17
index b2cd0cf965d8..385ea3d8de08 100644
@@ -2210,26 +2210,11 @@ int qcom_qmp_phy_pcie_create(struct device *dev, struct device_node *np, int id,
 	if (!qphy->pcs_misc)
 		dev_vdbg(dev, "PHY pcs_misc-reg not used\n");
 
-	/*
-	 * Get PHY's Pipe clock, if any. USB3 and PCIe are PIPE3
-	 * based phys, so they essentially have pipe clock. So,
-	 * we return error in case phy is USB3 or PIPE type.
-	 * Otherwise, we initialize pipe clock to NULL for
-	 * all phys that don't need this.
-	 */
 	snprintf(prop_name, sizeof(prop_name), "pipe%d", id);
 	qphy->pipe_clk = devm_get_clk_from_child(dev, np, prop_name);
 	if (IS_ERR(qphy->pipe_clk)) {
-		if (cfg->type == PHY_TYPE_PCIE ||
-		    cfg->type == PHY_TYPE_USB3) {
-			ret = PTR_ERR(qphy->pipe_clk);
-			if (ret != -EPROBE_DEFER)
-				dev_err(dev,
-					"failed to get lane%d pipe_clk, %d\n",
-					id, ret);
-			return ret;
-		}
-		qphy->pipe_clk = NULL;
+		return dev_err_probe(dev, PTR_ERR(qphy->pipe_clk),
+				     "failed to get lane%d pipe clock\n", id);
 	}
 
 	generic_phy = devm_phy_create(dev, np, &qcom_qmp_phy_pcie_ops);
Signature · 1 line
2.35.1
Reviewed-by on v1 1/3
#2 lore raw

Re: [PATCH 1/3] phy: qcom-qmp-pcie: drop obsolete pipe clock type check

Quoted 31 lines · Johan Hovold

Drop the obsolete pipe clock handling which was used to treat the pipe clock as optional for types other than PCIe and USB and which is no longer needed since splitting the PHY driver.

---
 drivers/phy/qualcomm/phy-qcom-qmp-pcie.c | 19 ++-----------------
 1 file changed, 2 insertions(+), 17 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-pcie.c +0 -10
index b2cd0cf965d8..385ea3d8de08 100644
@@ -2210,26 +2210,11 @@ int qcom_qmp_phy_pcie_create(struct device *dev, struct device_node *np, int id,
        if (!qphy->pcs_misc)
                dev_vdbg(dev, "PHY pcs_misc-reg not used\n");
 
-       /*
-        * Get PHY's Pipe clock, if any. USB3 and PCIe are PIPE3
-        * based phys, so they essentially have pipe clock. So,
-        * we return error in case phy is USB3 or PIPE type.
-        * Otherwise, we initialize pipe clock to NULL for
-        * all phys that don't need this.
-        */
        snprintf(prop_name, sizeof(prop_name), "pipe%d", id);
        qphy->pipe_clk = devm_get_clk_from_child(dev, np, prop_name);
        if (IS_ERR(qphy->pipe_clk)) {
-               if (cfg->type == PHY_TYPE_PCIE ||
-                   cfg->type == PHY_TYPE_USB3) {
-                       ret = PTR_ERR(qphy->pipe_clk);

drivers/phy/qualcomm/phy-qcom-qmp-pcie.c int qcom_qmp_phy_pcie_create(struct device *dev, struct device_node *np, int id, · line 2218

Quoted 10 lines
drivers/phy/qualcomm/phy-qcom-qmp-pcie.c +2 -7
-                       if (ret != -EPROBE_DEFER)
-                               dev_err(dev,
-                                       "failed to get lane%d pipe_clk, %d\n",
-                                       id, ret);
-                       return ret;
-               }
-               qphy->pipe_clk = NULL;
+               return dev_err_probe(dev, PTR_ERR(qphy->pipe_clk),
+                                    "failed to get lane%d pipe clock\n", id);
        }

Please remove the brackets around a single statement. With that fixed:

Quoted 5 lines
drivers/phy/qualcomm/phy-qcom-qmp-pcie.c +0 -1
        generic_phy = devm_phy_create(dev, np, &qcom_qmp_phy_pcie_ops);
--

2.35.1

Signature · 2 lines
With best wishes
Dmitry
#3 lore raw

Re: [PATCH 1/3] phy: qcom-qmp-pcie: drop obsolete pipe clock type check

Quoted 18 lines · Dmitry Baryshkov
Quoted 17 lines · Johan Hovold

Drop the obsolete pipe clock handling which was used to treat the pipe clock as optional for types other than PCIe and USB and which is no longer needed since splitting the PHY driver.

---

drivers/phy/qualcomm/phy-qcom-qmp-pcie.c +0 -7
        if (IS_ERR(qphy->pipe_clk)) {
-               if (cfg->type == PHY_TYPE_PCIE ||
-                   cfg->type == PHY_TYPE_USB3) {
-                       ret = PTR_ERR(qphy->pipe_clk);
-                       if (ret != -EPROBE_DEFER)
-                               dev_err(dev,
-                                       "failed to get lane%d pipe_clk, %d\n",
-                                       id, ret);
Quoted 8 lines

drivers/phy/qualcomm/phy-qcom-qmp-pcie.c int qcom_qmp_phy_pcie_create(struct device *dev, struct device_node *np, int id, · line 2218

Quoted 6 lines
drivers/phy/qualcomm/phy-qcom-qmp-pcie.c +2 -3
-                       return ret;
-               }
-               qphy->pipe_clk = NULL;
+               return dev_err_probe(dev, PTR_ERR(qphy->pipe_clk),
+                                    "failed to get lane%d pipe clock\n", id);
        }

Please remove the brackets around a single statement.

For readability reasons I prefer keeping brackets around statements spanning multiple lines instead of relying on indentation.

Johan

#4 lore raw

PATCH 2/3 phy: qcom-qmp-pcie-msm8996: drop obsolete pipe clock type check

In reply to Johan Hovold

Drop the obsolete pipe clock handling which was used to treat the pipe clock as optional for types other than PCIe and USB and which is no longer needed since splitting the PHY driver.

---
 .../phy/qualcomm/phy-qcom-qmp-pcie-msm8996.c  | 19 ++-----------------
 1 file changed, 2 insertions(+), 17 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-pcie-msm8996.c +2 -17
index 48ea1de81d7c..812d14afb5ec 100644
@@ -904,26 +904,11 @@ int qcom_qmp_phy_pcie_msm8996_create(struct device *dev, struct device_node *np,
 	if (!qphy->pcs_misc)
 		dev_vdbg(dev, "PHY pcs_misc-reg not used\n");
 
-	/*
-	 * Get PHY's Pipe clock, if any. USB3 and PCIe are PIPE3
-	 * based phys, so they essentially have pipe clock. So,
-	 * we return error in case phy is USB3 or PIPE type.
-	 * Otherwise, we initialize pipe clock to NULL for
-	 * all phys that don't need this.
-	 */
 	snprintf(prop_name, sizeof(prop_name), "pipe%d", id);
 	qphy->pipe_clk = devm_get_clk_from_child(dev, np, prop_name);
 	if (IS_ERR(qphy->pipe_clk)) {
-		if (cfg->type == PHY_TYPE_PCIE ||
-		    cfg->type == PHY_TYPE_USB3) {
-			ret = PTR_ERR(qphy->pipe_clk);
-			if (ret != -EPROBE_DEFER)
-				dev_err(dev,
-					"failed to get lane%d pipe_clk, %d\n",
-					id, ret);
-			return ret;
-		}
-		qphy->pipe_clk = NULL;
+		return dev_err_probe(dev, PTR_ERR(qphy->pipe_clk),
+				     "failed to get lane%d pipe clock\n", id);
 	}
 
 	/* Get lane reset, if any */
Signature · 1 line
2.35.1
Reviewed-by on v1 2/3
#5 lore raw

Re: [PATCH 2/3] phy: qcom-qmp-pcie-msm8996: drop obsolete pipe clock type check

Quoted 31 lines · Johan Hovold

Drop the obsolete pipe clock handling which was used to treat the pipe clock as optional for types other than PCIe and USB and which is no longer needed since splitting the PHY driver.

---
 .../phy/qualcomm/phy-qcom-qmp-pcie-msm8996.c  | 19 ++-----------------
 1 file changed, 2 insertions(+), 17 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-pcie-msm8996.c +0 -10
index 48ea1de81d7c..812d14afb5ec 100644
@@ -904,26 +904,11 @@ int qcom_qmp_phy_pcie_msm8996_create(struct device *dev, struct device_node *np,
        if (!qphy->pcs_misc)
                dev_vdbg(dev, "PHY pcs_misc-reg not used\n");
 
-       /*
-        * Get PHY's Pipe clock, if any. USB3 and PCIe are PIPE3
-        * based phys, so they essentially have pipe clock. So,
-        * we return error in case phy is USB3 or PIPE type.
-        * Otherwise, we initialize pipe clock to NULL for
-        * all phys that don't need this.
-        */
        snprintf(prop_name, sizeof(prop_name), "pipe%d", id);
        qphy->pipe_clk = devm_get_clk_from_child(dev, np, prop_name);
        if (IS_ERR(qphy->pipe_clk)) {
-               if (cfg->type == PHY_TYPE_PCIE ||
-                   cfg->type == PHY_TYPE_USB3) {
-                       ret = PTR_ERR(qphy->pipe_clk);

drivers/phy/qualcomm/phy-qcom-qmp-pcie-msm8996.c int qcom_qmp_phy_pcie_msm8996_create(struct device *dev, struct device_node *np, · line 912

Quoted 10 lines
drivers/phy/qualcomm/phy-qcom-qmp-pcie-msm8996.c +2 -7
-                       if (ret != -EPROBE_DEFER)
-                               dev_err(dev,
-                                       "failed to get lane%d pipe_clk, %d\n",
-                                       id, ret);
-                       return ret;
-               }
-               qphy->pipe_clk = NULL;
+               return dev_err_probe(dev, PTR_ERR(qphy->pipe_clk),
+                                    "failed to get lane%d pipe clock\n", id);
        }

Same comment. Please remove brackets. With that fixed:

Quoted 5 lines
drivers/phy/qualcomm/phy-qcom-qmp-pcie-msm8996.c +0 -1
        /* Get lane reset, if any */
--

2.35.1

Signature · 2 lines
With best wishes
Dmitry
#6 lore raw

PATCH 3/3 phy: qcom-qmp-usb: clean up pipe clock handling

In reply to Johan Hovold

Clean up the pipe clock handling by using dev_err_probe() to handle probe deferral and dropping the obsolete comment that claimed that the pipe clock was optional for some other PHY types.

---
 drivers/phy/qualcomm/phy-qcom-qmp-usb.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-usb.c +2 -13
index aebe5ed4e4e3..40e87f75ec4a 100644
@@ -2530,22 +2530,11 @@ int qcom_qmp_phy_usb_create(struct device *dev, struct device_node *np, int id,
 	if (!qphy->pcs_misc)
 		dev_vdbg(dev, "PHY pcs_misc-reg not used\n");
 
-	/*
-	 * Get PHY's Pipe clock, if any. USB3 and PCIe are PIPE3
-	 * based phys, so they essentially have pipe clock. So,
-	 * we return error in case phy is USB3 or PIPE type.
-	 * Otherwise, we initialize pipe clock to NULL for
-	 * all phys that don't need this.
-	 */
 	snprintf(prop_name, sizeof(prop_name), "pipe%d", id);
 	qphy->pipe_clk = devm_get_clk_from_child(dev, np, prop_name);
 	if (IS_ERR(qphy->pipe_clk)) {
-		ret = PTR_ERR(qphy->pipe_clk);
-		if (ret != -EPROBE_DEFER)
-			dev_err(dev,
-				"failed to get lane%d pipe_clk, %d\n",
-				id, ret);
-		return ret;
+		return dev_err_probe(dev, PTR_ERR(qphy->pipe_clk),
+				     "failed to get lane%d pipe clock\n", id);
 	}
 
 	generic_phy = devm_phy_create(dev, np, &qcom_qmp_phy_usb_ops);
Signature · 7 lines
2.35.1


-- 
linux-phy mailing list
[email protected]
https://lists.infradead.org/mailman/listinfo/linux-phy
Reviewed-by on v1 3/3
#7 lore raw

Re: [PATCH 3/3] phy: qcom-qmp-usb: clean up pipe clock handling

Quoted 27 lines · Johan Hovold

Clean up the pipe clock handling by using dev_err_probe() to handle probe deferral and dropping the obsolete comment that claimed that the pipe clock was optional for some other PHY types.

---
 drivers/phy/qualcomm/phy-qcom-qmp-usb.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-usb.c +0 -7
index aebe5ed4e4e3..40e87f75ec4a 100644
@@ -2530,22 +2530,11 @@ int qcom_qmp_phy_usb_create(struct device *dev, struct device_node *np, int id,
        if (!qphy->pcs_misc)
                dev_vdbg(dev, "PHY pcs_misc-reg not used\n");
 
-       /*
-        * Get PHY's Pipe clock, if any. USB3 and PCIe are PIPE3
-        * based phys, so they essentially have pipe clock. So,
-        * we return error in case phy is USB3 or PIPE type.
-        * Otherwise, we initialize pipe clock to NULL for
-        * all phys that don't need this.
-        */
        snprintf(prop_name, sizeof(prop_name), "pipe%d", id);
        qphy->pipe_clk = devm_get_clk_from_child(dev, np, prop_name);

drivers/phy/qualcomm/phy-qcom-qmp-usb.c int qcom_qmp_phy_usb_create(struct device *dev, struct device_node *np, int id, · line 2538

Quoted 10 lines
drivers/phy/qualcomm/phy-qcom-qmp-usb.c +2 -6
        if (IS_ERR(qphy->pipe_clk)) {
-               ret = PTR_ERR(qphy->pipe_clk);
-               if (ret != -EPROBE_DEFER)
-                       dev_err(dev,
-                               "failed to get lane%d pipe_clk, %d\n",
-                               id, ret);
-               return ret;
+               return dev_err_probe(dev, PTR_ERR(qphy->pipe_clk),
+                                    "failed to get lane%d pipe clock\n", id);
        }

And here too. Afterwards:

Quoted 5 lines
drivers/phy/qualcomm/phy-qcom-qmp-usb.c +0 -1
        generic_phy = devm_phy_create(dev, np, &qcom_qmp_phy_usb_ops);
--

2.35.1

Signature · 2 lines
With best wishes
Dmitry
maintainer Applied
#8 lore raw
In reply to Johan Hovold
Quoted 1 line · Johan Hovold

Here are some follow-up cleanups after the recent driver split.

Applied, thanks

Signature · 6 lines
~Vinod

-- 
linux-phy mailing list
[email protected]
https://lists.infradead.org/mailman/listinfo/linux-phy