lkml.org 
[lkml]   [2021]   [Oct]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v15 10/13] PCI: kirin: Move the power-off code to a common routine
Date
Instead of having two copies of the same logic, place the power-off
logic on a separate function.

No functional changes.

Acked-by: Xiaowei Song <songxiaowei@hisilicon.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
---

To mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH v15 00/13] at: https://lore.kernel.org/all/cover.1634812676.git.mchehab+huawei@kernel.org/

drivers/pci/controller/dwc/pcie-kirin.c | 26 ++++++++++++++-----------
1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/drivers/pci/controller/dwc/pcie-kirin.c b/drivers/pci/controller/dwc/pcie-kirin.c
index 64221a204db2..f4ea27b37968 100644
--- a/drivers/pci/controller/dwc/pcie-kirin.c
+++ b/drivers/pci/controller/dwc/pcie-kirin.c
@@ -680,6 +680,19 @@ static const struct dw_pcie_host_ops kirin_pcie_host_ops = {
.host_init = kirin_pcie_host_init,
};

+static int kirin_pcie_power_off(struct kirin_pcie *kirin_pcie)
+{
+ int i;
+
+ if (kirin_pcie->type == PCIE_KIRIN_INTERNAL_PHY)
+ return hi3660_pcie_phy_power_off(kirin_pcie);
+
+ phy_power_off(kirin_pcie->phy);
+ phy_exit(kirin_pcie->phy);
+
+ return 0;
+}
+
static int kirin_pcie_power_on(struct platform_device *pdev,
struct kirin_pcie *kirin_pcie)
{
@@ -725,12 +738,7 @@ static int kirin_pcie_power_on(struct platform_device *pdev,

return 0;
err:
- if (kirin_pcie->type == PCIE_KIRIN_INTERNAL_PHY) {
- hi3660_pcie_phy_power_off(kirin_pcie);
- } else {
- phy_power_off(kirin_pcie->phy);
- phy_exit(kirin_pcie->phy);
- }
+ kirin_pcie_power_off(kirin_pcie);

return ret;
}
@@ -739,11 +747,7 @@ static int __exit kirin_pcie_remove(struct platform_device *pdev)
{
struct kirin_pcie *kirin_pcie = platform_get_drvdata(pdev);

- if (kirin_pcie->type == PCIE_KIRIN_INTERNAL_PHY)
- return hi3660_pcie_phy_power_off(kirin_pcie);
-
- phy_power_off(kirin_pcie->phy);
- phy_exit(kirin_pcie->phy);
+ kirin_pcie_power_off(kirin_pcie);

return 0;
}
--
2.31.1
\
 
 \ /
  Last update: 2021-10-21 12:46    [W:0.213 / U:0.500 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site