Skip to contentSkip to conversation

phy: ti-pipe3: make clk operations symmetric in probe and remove

PATCH In review Chuhong Yuan 2 participants 2 messages Dec 4, 2019 Generic PHY framework

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 phy: ti-pipe3: make clk operations symmetric in probe and remove

The driver calls clk_prepare_enable in probe but the corresponding clk_disable_unprepare() is in ti_pipe3_disable_clocks(). Move clk_disable_unprepare() to remove to make them symmetric.

---
Changes in v2:
- Modify commit message.
- Delete the clk_disable_unprepare() in ti_pipe3_disable_clocks().

 drivers/phy/ti/phy-ti-pipe3.c | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)
drivers/phy/ti/phy-ti-pipe3.c +7 -11
index edd6859afba8..a87946589eb7 100644
@@ -850,6 +850,12 @@ static int ti_pipe3_probe(struct platform_device *pdev)
 
 static int ti_pipe3_remove(struct platform_device *pdev)
 {
+	struct ti_pipe3 *phy = platform_get_drvdata(pdev);
+
+	if (phy->mode == PIPE3_MODE_SATA) {
+		clk_disable_unprepare(phy->refclk);
+		phy->sata_refclk_enabled = false;
+	}
 	pm_runtime_disable(&pdev->dev);
 
 	return 0;
@@ -900,18 +906,8 @@ static void ti_pipe3_disable_clocks(struct ti_pipe3 *phy)
 {
 	if (!IS_ERR(phy->wkupclk))
 		clk_disable_unprepare(phy->wkupclk);
-	if (!IS_ERR(phy->refclk)) {
+	if (!IS_ERR(phy->refclk))
 		clk_disable_unprepare(phy->refclk);
-		/*
-		 * SATA refclk needs an additional disable as we left it
-		 * on in probe to avoid Errata i783
-		 */
-		if (phy->sata_refclk_enabled) {
-			clk_disable_unprepare(phy->refclk);
-			phy->sata_refclk_enabled = false;
-		}
-	}
-
 	if (!IS_ERR(phy->div_clk))
 		clk_disable_unprepare(phy->div_clk);
 }
Signature · 1 line
2.24.0
Acked-by on v2 1/1
#1 lore raw
Quoted 5 lines · Chuhong Yuan

The driver calls clk_prepare_enable in probe but the corresponding clk_disable_unprepare() is in ti_pipe3_disable_clocks(). Move clk_disable_unprepare() to remove to make them symmetric.

Quoted 46 lines

---
Changes in v2:
- Modify commit message.
- Delete the clk_disable_unprepare() in ti_pipe3_disable_clocks().

  drivers/phy/ti/phy-ti-pipe3.c | 18 +++++++-----------
  1 file changed, 7 insertions(+), 11 deletions(-)
drivers/phy/ti/phy-ti-pipe3.c +7 -11
index edd6859afba8..a87946589eb7 100644
@@ -850,6 +850,12 @@ static int ti_pipe3_probe(struct platform_device *pdev)
 
  static int ti_pipe3_remove(struct platform_device *pdev)
  {
+	struct ti_pipe3 *phy = platform_get_drvdata(pdev);
+
+	if (phy->mode == PIPE3_MODE_SATA) {
+		clk_disable_unprepare(phy->refclk);
+		phy->sata_refclk_enabled = false;
+	}
  	pm_runtime_disable(&pdev->dev);
 
  	return 0;
@@ -900,18 +906,8 @@ static void ti_pipe3_disable_clocks(struct ti_pipe3 *phy)
  {
  	if (!IS_ERR(phy->wkupclk))
  		clk_disable_unprepare(phy->wkupclk);
-	if (!IS_ERR(phy->refclk)) {
+	if (!IS_ERR(phy->refclk))
  		clk_disable_unprepare(phy->refclk);
-		/*
-		 * SATA refclk needs an additional disable as we left it
-		 * on in probe to avoid Errata i783
-		 */
-		if (phy->sata_refclk_enabled) {
-			clk_disable_unprepare(phy->refclk);
-			phy->sata_refclk_enabled = false;
-		}
-	}
-
  	if (!IS_ERR(phy->div_clk))
  		clk_disable_unprepare(phy->div_clk);
  }
Signature · 4 lines
cheers,
-roger
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki