summaryrefslogtreecommitdiffstats
path: root/drivers/pci/host/pcie-rockchip.c
diff options
context:
space:
mode:
authorShawn Lin <shawn.lin@rock-chips.com>2017-08-23 15:02:28 +0800
committerBjorn Helgaas <bhelgaas@google.com>2017-08-29 13:18:07 -0500
commit41b70b2c6f10de4a3fcf1954bf00c8e620aed67d (patch)
tree2a2aea9cb2941813a1b3e38c15bf2cbd172491f9 /drivers/pci/host/pcie-rockchip.c
parent09df7bc40a15823e1b3e30135fc0f22eb97a0abb (diff)
downloadblackbird-op-linux-41b70b2c6f10de4a3fcf1954bf00c8e620aed67d.tar.gz
blackbird-op-linux-41b70b2c6f10de4a3fcf1954bf00c8e620aed67d.zip
PCI: rockchip: Factor out rockchip_pcie_disable_clocks()
Factor out rockchip_pcie_disable_clocks() so it can be reused by other functions. No functional change intended, but it does change the order of unpreparing clocks in the rockchip_pcie_resume_noirq() error path so it matches the other paths. Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci/host/pcie-rockchip.c')
-rw-r--r--drivers/pci/host/pcie-rockchip.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/drivers/pci/host/pcie-rockchip.c b/drivers/pci/host/pcie-rockchip.c
index 3b1802c39adc..1797b4ee8223 100644
--- a/drivers/pci/host/pcie-rockchip.c
+++ b/drivers/pci/host/pcie-rockchip.c
@@ -1417,6 +1417,16 @@ err_aclk_perf_pcie:
return err;
}
+static void rockchip_pcie_disable_clocks(void *data)
+{
+ struct rockchip_pcie *rockchip = data;
+
+ clk_disable_unprepare(rockchip->clk_pcie_pm);
+ clk_disable_unprepare(rockchip->hclk_pcie);
+ clk_disable_unprepare(rockchip->aclk_perf_pcie);
+ clk_disable_unprepare(rockchip->aclk_pcie);
+}
+
static int __maybe_unused rockchip_pcie_suspend_noirq(struct device *dev)
{
struct rockchip_pcie *rockchip = dev_get_drvdata(dev);
@@ -1440,10 +1450,7 @@ static int __maybe_unused rockchip_pcie_suspend_noirq(struct device *dev)
phy_exit(rockchip->phys[i]);
}
- clk_disable_unprepare(rockchip->clk_pcie_pm);
- clk_disable_unprepare(rockchip->hclk_pcie);
- clk_disable_unprepare(rockchip->aclk_perf_pcie);
- clk_disable_unprepare(rockchip->aclk_pcie);
+ rockchip_pcie_disable_clocks(rockchip);
if (!IS_ERR(rockchip->vpcie0v9))
regulator_disable(rockchip->vpcie0v9);
@@ -1483,10 +1490,7 @@ static int __maybe_unused rockchip_pcie_resume_noirq(struct device *dev)
return 0;
err_pcie_resume:
- clk_disable_unprepare(rockchip->aclk_pcie);
- clk_disable_unprepare(rockchip->aclk_perf_pcie);
- clk_disable_unprepare(rockchip->hclk_pcie);
- clk_disable_unprepare(rockchip->clk_pcie_pm);
+ rockchip_pcie_disable_clocks(rockchip);
return err;
}
@@ -1625,10 +1629,7 @@ err_vpcie:
if (!IS_ERR(rockchip->vpcie0v9))
regulator_disable(rockchip->vpcie0v9);
err_set_vpcie:
- clk_disable_unprepare(rockchip->clk_pcie_pm);
- clk_disable_unprepare(rockchip->hclk_pcie);
- clk_disable_unprepare(rockchip->aclk_perf_pcie);
- clk_disable_unprepare(rockchip->aclk_pcie);
+ rockchip_pcie_disable_clocks(rockchip);
return err;
}
@@ -1650,10 +1651,7 @@ static int rockchip_pcie_remove(struct platform_device *pdev)
phy_exit(rockchip->phys[i]);
}
- clk_disable_unprepare(rockchip->clk_pcie_pm);
- clk_disable_unprepare(rockchip->hclk_pcie);
- clk_disable_unprepare(rockchip->aclk_perf_pcie);
- clk_disable_unprepare(rockchip->aclk_pcie);
+ rockchip_pcie_disable_clocks(rockchip);
if (!IS_ERR(rockchip->vpcie12v))
regulator_disable(rockchip->vpcie12v);
OpenPOWER on IntegriCloud