diff options
author | Sergio Paracuellos <sergio.paracuellos@gmail.com> | 2018-11-04 13:49:46 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-11-11 22:36:15 +0300 |
commit | cd910f19ac021307948c1169dc577cbaf89db015 (patch) | |
tree | 27e9626f432da838f5baede1069ebb5b5412a5a9 /drivers/staging/mt7621-pci | |
parent | e2200279af2f0e4132feaf5d609e3a82cc484acc (diff) | |
download | linux-cd910f19ac021307948c1169dc577cbaf89db015.tar.xz |
staging: mt7621-pci: factor out 'mt7621_pcie_init_ports' function
Instead of just inline this code in the probe driver function factor
out a new 'mt7621_pcie_init_ports' function to achieve this.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/mt7621-pci')
-rw-r--r-- | drivers/staging/mt7621-pci/pci-mt7621.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c b/drivers/staging/mt7621-pci/pci-mt7621.c index 50c439b4dbc0..cb677cd21792 100644 --- a/drivers/staging/mt7621-pci/pci-mt7621.c +++ b/drivers/staging/mt7621-pci/pci-mt7621.c @@ -612,6 +612,23 @@ static int mt7621_pcie_init_port(struct mt7621_pcie_port *port) return 0; } +static void mt7621_pcie_init_ports(struct mt7621_pcie *pcie) +{ + struct device *dev = pcie->dev; + struct mt7621_pcie_port *port, *tmp; + int err; + + list_for_each_entry_safe(port, tmp, &pcie->ports, list) { + u32 slot = port->slot; + + err = mt7621_pcie_init_port(port); + if (err) { + dev_err(dev, "Initiating port %d failed\n", slot); + list_del(&port->list); + } + } +} + static void mt7621_pcie_enable_ports(struct mt7621_pcie *pcie) { struct device *dev = pcie->dev; @@ -759,7 +776,6 @@ static int mt7621_pci_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct mt7621_pcie *pcie; struct pci_host_bridge *bridge; - struct mt7621_pcie_port *port, *tmp; int err; LIST_HEAD(res); @@ -794,15 +810,7 @@ static int mt7621_pci_probe(struct platform_device *pdev) mdelay(100); - list_for_each_entry_safe(port, tmp, &pcie->ports, list) { - u32 slot = port->slot; - - err = mt7621_pcie_init_port(port); - if (err) { - dev_err(dev, "enabling port %d failed\n", slot); - list_del(&port->list); - } - } + mt7621_pcie_init_ports(pcie); rt_sysc_m32(0, RALINK_PCIE_RST, RALINK_RSTCTRL); rt_sysc_m32(0x30, 2 << 4, SYSC_REG_SYSTEM_CONFIG1); |