mirror of
https://github.com/torvalds/linux.git
synced 2024-12-05 10:32:35 +00:00
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>
This commit is contained in:
parent
2fc0898bf3
commit
108b2f2a97
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user