diff options
author | Sergio Paracuellos <sergio.paracuellos@gmail.com> | 2020-11-23 10:36:36 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-11-26 09:12:18 +0100 |
commit | 108b2f2a9724548ffa64274731034d9723665c71 (patch) | |
tree | ed07a3d1806356e470b0a8472824d2cd70060bf1 /drivers | |
parent | 2fc0898bf3661ba576801acf214c08acdaf75761 (diff) | |
download | linux-stable-108b2f2a9724548ffa64274731034d9723665c71.tar.gz linux-stable-108b2f2a9724548ffa64274731034d9723665c71.tar.bz2 linux-stable-108b2f2a9724548ffa64274731034d9723665c71.zip |
staging: mt7621-pci: convert to use 'devm_platform_ioremap_resource'
Instead of getting resources parsing from DT first and remaping
afterwards, this can be done in one step using the kernel function
'devm_platform_ioremap_resource'. Hence, update to use it.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Link: https://lore.kernel.org/r/20201123093637.8300-7-sergio.paracuellos@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/mt7621-pci/pci-mt7621.c | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c b/drivers/staging/mt7621-pci/pci-mt7621.c index a0b3ec51c7d9..4cdaccbcc97c 100644 --- a/drivers/staging/mt7621-pci/pci-mt7621.c +++ b/drivers/staging/mt7621-pci/pci-mt7621.c @@ -337,28 +337,18 @@ static int mt7621_pci_parse_request_of_pci_ranges(struct pci_host_bridge *host) } static int mt7621_pcie_parse_port(struct mt7621_pcie *pcie, - struct device_node *node, int slot) { struct mt7621_pcie_port *port; struct device *dev = pcie->dev; struct platform_device *pdev = to_platform_device(dev); - struct device_node *pnode = dev->of_node; - struct resource regs; char name[10]; - int err; port = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL); if (!port) return -ENOMEM; - err = of_address_to_resource(pnode, slot + 1, ®s); - if (err) { - dev_err(dev, "missing \"reg\" property\n"); - return err; - } - - port->base = devm_ioremap_resource(dev, ®s); + port->base = devm_platform_ioremap_resource(pdev, slot + 1); if (IS_ERR(port->base)) return PTR_ERR(port->base); @@ -399,17 +389,11 @@ static int mt7621_pcie_parse_port(struct mt7621_pcie *pcie, static int mt7621_pcie_parse_dt(struct mt7621_pcie *pcie) { struct device *dev = pcie->dev; + struct platform_device *pdev = to_platform_device(dev); struct device_node *node = dev->of_node, *child; - struct resource regs; int err; - err = of_address_to_resource(node, 0, ®s); - if (err) { - dev_err(dev, "missing \"reg\" property\n"); - return err; - } - - pcie->base = devm_ioremap_resource(dev, ®s); + pcie->base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(pcie->base)) return PTR_ERR(pcie->base); @@ -425,7 +409,7 @@ static int mt7621_pcie_parse_dt(struct mt7621_pcie *pcie) slot = PCI_SLOT(err); - err = mt7621_pcie_parse_port(pcie, child, slot); + err = mt7621_pcie_parse_port(pcie, slot); if (err) { of_node_put(child); return err; |