{"id":818527,"url":"http://patchwork.ozlabs.org/api/patches/818527/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-pci/patch/c0279429-e0e4-096f-70be-7f89887bde4c@free.fr/","project":{"id":28,"url":"http://patchwork.ozlabs.org/api/projects/28/?format=json","name":"Linux PCI development","link_name":"linux-pci","list_id":"linux-pci.vger.kernel.org","list_email":"linux-pci@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<c0279429-e0e4-096f-70be-7f89887bde4c@free.fr>","list_archive_url":null,"date":"2017-09-26T10:26:55","name":"[RESEND,v11,2/3] PCI: Use of_pci_dma_range_parser_init API","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"c1a5d42d8f67802ca1351cb161c8650682078cd6","submitter":{"id":67482,"url":"http://patchwork.ozlabs.org/api/people/67482/?format=json","name":"Marc Gonzalez","email":"marc_gonzalez@sigmadesigns.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-pci/patch/c0279429-e0e4-096f-70be-7f89887bde4c@free.fr/mbox/","series":[{"id":5101,"url":"http://patchwork.ozlabs.org/api/series/5101/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-pci/list/?series=5101","date":"2017-09-26T10:21:13","name":"Tango PCIe host bridge MSI support + required API","version":11,"mbox":"http://patchwork.ozlabs.org/series/5101/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/818527/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/818527/checks/","tags":{},"related":[],"headers":{"Return-Path":"<linux-pci-owner@vger.kernel.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=linux-pci-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3y1dM05zZKz9tXH\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 26 Sep 2017 21:02:04 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S936972AbdIZLCE (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tTue, 26 Sep 2017 07:02:04 -0400","from smtp5-g21.free.fr ([212.27.42.5]:20724 \"EHLO\n\tsmtp5-g21.free.fr\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S935241AbdIZLCD (ORCPT <rfc822;linux-pci@vger.kernel.org>);\n\tTue, 26 Sep 2017 07:02:03 -0400","from [172.27.0.114] (unknown [92.154.11.170])\n\t(Authenticated sender: marc.w.gonzalez)\n\tby smtp5-g21.free.fr (Postfix) with ESMTPSA id E0E585FFCF;\n\tTue, 26 Sep 2017 13:01:44 +0200 (CEST)"],"From":"Marc Gonzalez <marc_gonzalez@sigmadesigns.com>","Subject":"[RESEND PATCH v11 2/3] PCI: Use of_pci_dma_range_parser_init API","To":"Bjorn Helgaas <helgaas@kernel.org>","Cc":"linux-pci <linux-pci@vger.kernel.org>,\n\tMarc Zyngier <marc.zyngier@arm.com>, Robin Murphy <robin.murphy@arm.com>,\n\tRob Herring <robh@kernel.org>, Linus Walleij <linus.walleij@linaro.org>,\n\tArd Biesheuvel <ard.biesheuvel@linaro.org>,\n\tArnd Bergmann <arnd@arndb.de>, Mason <slash.tmp@free.fr>","References":"<93a30f88-17e1-af14-0c50-54f829c1158b@free.fr>","Message-ID":"<c0279429-e0e4-096f-70be-7f89887bde4c@free.fr>","Date":"Tue, 26 Sep 2017 12:26:55 +0200","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tFirefox/52.0 SeaMonkey/2.49.1","MIME-Version":"1.0","In-Reply-To":"<93a30f88-17e1-af14-0c50-54f829c1158b@free.fr>","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"7bit","Sender":"linux-pci-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<linux-pci.vger.kernel.org>","X-Mailing-List":"linux-pci@vger.kernel.org"},"content":"Use the factorized implementation.\n\nAcked-by: Linus Walleij <linus.walleij@linaro.org>\nSigned-off-by: Marc Gonzalez <marc_gonzalez@sigmadesigns.com>\n---\n drivers/pci/host/pci-ftpci100.c  | 20 +-------------------\n drivers/pci/host/pci-rcar-gen2.c | 20 +-------------------\n drivers/pci/host/pci-xgene.c     | 20 +-------------------\n drivers/pci/host/pcie-iproc.c    | 20 +-------------------\n drivers/pci/host/pcie-rcar.c     | 20 +-------------------\n 5 files changed, 5 insertions(+), 95 deletions(-)","diff":"diff --git a/drivers/pci/host/pci-ftpci100.c b/drivers/pci/host/pci-ftpci100.c\nindex 5162dffc102b..12d78bba1bd3 100644\n--- a/drivers/pci/host/pci-ftpci100.c\n+++ b/drivers/pci/host/pci-ftpci100.c\n@@ -370,24 +370,6 @@ static int faraday_pci_setup_cascaded_irq(struct faraday_pci *p)\n \treturn 0;\n }\n \n-static int pci_dma_range_parser_init(struct of_pci_range_parser *parser,\n-\t\t\t\t     struct device_node *node)\n-{\n-\tconst int na = 3, ns = 2;\n-\tint rlen;\n-\n-\tparser->node = node;\n-\tparser->pna = of_n_addr_cells(node);\n-\tparser->np = parser->pna + na + ns;\n-\n-\tparser->range = of_get_property(node, \"dma-ranges\", &rlen);\n-\tif (!parser->range)\n-\t\treturn -ENOENT;\n-\tparser->end = parser->range + rlen / sizeof(__be32);\n-\n-\treturn 0;\n-}\n-\n static int faraday_pci_parse_map_dma_ranges(struct faraday_pci *p,\n \t\t\t\t\t    struct device_node *np)\n {\n@@ -402,7 +384,7 @@ static int faraday_pci_parse_map_dma_ranges(struct faraday_pci *p,\n \tint i = 0;\n \tu32 val;\n \n-\tif (pci_dma_range_parser_init(&parser, np)) {\n+\tif (of_pci_dma_range_parser_init(&parser, np)) {\n \t\tdev_err(dev, \"missing dma-ranges property\\n\");\n \t\treturn -EINVAL;\n \t}\ndiff --git a/drivers/pci/host/pci-rcar-gen2.c b/drivers/pci/host/pci-rcar-gen2.c\nindex 6f879685fedd..e46de69f0380 100644\n--- a/drivers/pci/host/pci-rcar-gen2.c\n+++ b/drivers/pci/host/pci-rcar-gen2.c\n@@ -293,24 +293,6 @@ static struct pci_ops rcar_pci_ops = {\n \t.write\t= pci_generic_config_write,\n };\n \n-static int pci_dma_range_parser_init(struct of_pci_range_parser *parser,\n-\t\t\t\t     struct device_node *node)\n-{\n-\tconst int na = 3, ns = 2;\n-\tint rlen;\n-\n-\tparser->node = node;\n-\tparser->pna = of_n_addr_cells(node);\n-\tparser->np = parser->pna + na + ns;\n-\n-\tparser->range = of_get_property(node, \"dma-ranges\", &rlen);\n-\tif (!parser->range)\n-\t\treturn -ENOENT;\n-\n-\tparser->end = parser->range + rlen / sizeof(__be32);\n-\treturn 0;\n-}\n-\n static int rcar_pci_parse_map_dma_ranges(struct rcar_pci_priv *pci,\n \t\t\t\t\t struct device_node *np)\n {\n@@ -320,7 +302,7 @@ static int rcar_pci_parse_map_dma_ranges(struct rcar_pci_priv *pci,\n \tint index = 0;\n \n \t/* Failure to parse is ok as we fall back to defaults */\n-\tif (pci_dma_range_parser_init(&parser, np))\n+\tif (of_pci_dma_range_parser_init(&parser, np))\n \t\treturn 0;\n \n \t/* Get the dma-ranges from DT */\ndiff --git a/drivers/pci/host/pci-xgene.c b/drivers/pci/host/pci-xgene.c\nindex bd897479a215..f660513946d3 100644\n--- a/drivers/pci/host/pci-xgene.c\n+++ b/drivers/pci/host/pci-xgene.c\n@@ -542,24 +542,6 @@ static void xgene_pcie_setup_ib_reg(struct xgene_pcie_port *port,\n \txgene_pcie_setup_pims(port, pim_reg, pci_addr, ~(size - 1));\n }\n \n-static int pci_dma_range_parser_init(struct of_pci_range_parser *parser,\n-\t\t\t\t     struct device_node *node)\n-{\n-\tconst int na = 3, ns = 2;\n-\tint rlen;\n-\n-\tparser->node = node;\n-\tparser->pna = of_n_addr_cells(node);\n-\tparser->np = parser->pna + na + ns;\n-\n-\tparser->range = of_get_property(node, \"dma-ranges\", &rlen);\n-\tif (!parser->range)\n-\t\treturn -ENOENT;\n-\tparser->end = parser->range + rlen / sizeof(__be32);\n-\n-\treturn 0;\n-}\n-\n static int xgene_pcie_parse_map_dma_ranges(struct xgene_pcie_port *port)\n {\n \tstruct device_node *np = port->node;\n@@ -568,7 +550,7 @@ static int xgene_pcie_parse_map_dma_ranges(struct xgene_pcie_port *port)\n \tstruct device *dev = port->dev;\n \tu8 ib_reg_mask = 0;\n \n-\tif (pci_dma_range_parser_init(&parser, np)) {\n+\tif (of_pci_dma_range_parser_init(&parser, np)) {\n \t\tdev_err(dev, \"missing dma-ranges property\\n\");\n \t\treturn -EINVAL;\n \t}\ndiff --git a/drivers/pci/host/pcie-iproc.c b/drivers/pci/host/pcie-iproc.c\nindex c57486348856..aa4f6d519053 100644\n--- a/drivers/pci/host/pcie-iproc.c\n+++ b/drivers/pci/host/pcie-iproc.c\n@@ -1000,24 +1000,6 @@ static int iproc_pcie_setup_ib(struct iproc_pcie *pcie,\n \treturn ret;\n }\n \n-static int pci_dma_range_parser_init(struct of_pci_range_parser *parser,\n-\t\t\t\t     struct device_node *node)\n-{\n-\tconst int na = 3, ns = 2;\n-\tint rlen;\n-\n-\tparser->node = node;\n-\tparser->pna = of_n_addr_cells(node);\n-\tparser->np = parser->pna + na + ns;\n-\n-\tparser->range = of_get_property(node, \"dma-ranges\", &rlen);\n-\tif (!parser->range)\n-\t\treturn -ENOENT;\n-\n-\tparser->end = parser->range + rlen / sizeof(__be32);\n-\treturn 0;\n-}\n-\n static int iproc_pcie_map_dma_ranges(struct iproc_pcie *pcie)\n {\n \tstruct of_pci_range range;\n@@ -1025,7 +1007,7 @@ static int iproc_pcie_map_dma_ranges(struct iproc_pcie *pcie)\n \tint ret;\n \n \t/* Get the dma-ranges from DT */\n-\tret = pci_dma_range_parser_init(&parser, pcie->dev->of_node);\n+\tret = of_pci_dma_range_parser_init(&parser, pcie->dev->of_node);\n \tif (ret)\n \t\treturn ret;\n \ndiff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c\nindex 246d485b24c6..7975b10e21e8 100644\n--- a/drivers/pci/host/pcie-rcar.c\n+++ b/drivers/pci/host/pcie-rcar.c\n@@ -1029,24 +1029,6 @@ static int rcar_pcie_inbound_ranges(struct rcar_pcie *pcie,\n \treturn 0;\n }\n \n-static int pci_dma_range_parser_init(struct of_pci_range_parser *parser,\n-\t\t\t\t     struct device_node *node)\n-{\n-\tconst int na = 3, ns = 2;\n-\tint rlen;\n-\n-\tparser->node = node;\n-\tparser->pna = of_n_addr_cells(node);\n-\tparser->np = parser->pna + na + ns;\n-\n-\tparser->range = of_get_property(node, \"dma-ranges\", &rlen);\n-\tif (!parser->range)\n-\t\treturn -ENOENT;\n-\n-\tparser->end = parser->range + rlen / sizeof(__be32);\n-\treturn 0;\n-}\n-\n static int rcar_pcie_parse_map_dma_ranges(struct rcar_pcie *pcie,\n \t\t\t\t\t  struct device_node *np)\n {\n@@ -1055,7 +1037,7 @@ static int rcar_pcie_parse_map_dma_ranges(struct rcar_pcie *pcie,\n \tint index = 0;\n \tint err;\n \n-\tif (pci_dma_range_parser_init(&parser, np))\n+\tif (of_pci_dma_range_parser_init(&parser, np))\n \t\treturn -EINVAL;\n \n \t/* Get the dma-ranges from DT */\n","prefixes":["RESEND","v11","2/3"]}