diff options
author | Marc Gonzalez <marc_gonzalez@sigmadesigns.com> | 2017-09-26 12:26:55 +0200 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2017-10-05 15:52:34 -0500 |
commit | 1e61a57cac560844580ab532a4e2f5061ef77039 (patch) | |
tree | 5326edc886070c8c09829c3ade143be234acbb98 /drivers/pci/host/pci-xgene.c | |
parent | a060c2104ef83e62346b7e893947a940471c0d7c (diff) |
PCI: Use of_pci_dma_range_parser_init() to reduce duplication
Use the new of_pci_dma_range_parser_init() to reduce code duplication.
Signed-off-by: Marc Gonzalez <marc_gonzalez@sigmadesigns.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pci/host/pci-xgene.c')
-rw-r--r-- | drivers/pci/host/pci-xgene.c | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/drivers/pci/host/pci-xgene.c b/drivers/pci/host/pci-xgene.c index 087645116ecb..8fc45d95edab 100644 --- a/drivers/pci/host/pci-xgene.c +++ b/drivers/pci/host/pci-xgene.c @@ -542,24 +542,6 @@ static void xgene_pcie_setup_ib_reg(struct xgene_pcie_port *port, xgene_pcie_setup_pims(port, pim_reg, pci_addr, ~(size - 1)); } -static int pci_dma_range_parser_init(struct of_pci_range_parser *parser, - struct device_node *node) -{ - const int na = 3, ns = 2; - int rlen; - - parser->node = node; - parser->pna = of_n_addr_cells(node); - parser->np = parser->pna + na + ns; - - parser->range = of_get_property(node, "dma-ranges", &rlen); - if (!parser->range) - return -ENOENT; - parser->end = parser->range + rlen / sizeof(__be32); - - return 0; -} - static int xgene_pcie_parse_map_dma_ranges(struct xgene_pcie_port *port) { struct device_node *np = port->node; @@ -568,7 +550,7 @@ static int xgene_pcie_parse_map_dma_ranges(struct xgene_pcie_port *port) struct device *dev = port->dev; u8 ib_reg_mask = 0; - if (pci_dma_range_parser_init(&parser, np)) { + if (of_pci_dma_range_parser_init(&parser, np)) { dev_err(dev, "missing dma-ranges property\n"); return -EINVAL; } |