From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D804ECA9EA1 for ; Fri, 18 Oct 2019 12:09:55 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A693721925 for ; Fri, 18 Oct 2019 12:09:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="MLNkEbLw" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A693721925 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=1coxWkfOyICst17mHy1zHg34qIQ99YEnRZLhTuHqf78=; b=MLNkEbLwDUWmqx 4bSpNnUaFd4fvYrTq0PjDMnWnxXlXRCZDjjoIEMZ5lyRxI9zQOI2chtC1JITqbSGa1TjTY53d8rw5 VWbAB2cClyBZ7eEqixVFV56Z8zXYchpJ20BoSEUDDRtueUEZuEYughhJ+QX32xyUrV9nanUCWXVw8 QS17xneBHjnHzJUH9TwCFqoMm5z4uJYK7T4pelzp4yNmTvEHqM2Xwg2Y82HvRWj8sKo/YvkgLN5KV 2RKf5Jj5OetzD+1OdwyklDPKCNSBXM+w66bTprCmljQBnZll6qdEjAw9sGv1Slox3E6YMttjr+T0V tnBY7qkzuem0l2Ua0T5Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iLR4k-0003Ke-Le; Fri, 18 Oct 2019 12:09:46 +0000 Received: from [217.140.110.172] (helo=foss.arm.com) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iLR4h-0003JM-AN; Fri, 18 Oct 2019 12:09:45 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AE0EFCA3; Fri, 18 Oct 2019 05:09:32 -0700 (PDT) Received: from localhost (unknown [10.37.6.20]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 104C03F6C4; Fri, 18 Oct 2019 05:09:32 -0700 (PDT) Date: Fri, 18 Oct 2019 13:09:30 +0100 From: Andrew Murray To: Rob Herring Subject: Re: [PATCH v2 04/25] PCI: altera: Use pci_parse_request_of_pci_ranges() Message-ID: <20191018120930.GE47056@e119886-lin.cambridge.arm.com> References: <20191016200647.32050-1-robh@kernel.org> <20191016200647.32050-5-robh@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20191016200647.32050-5-robh@kernel.org> User-Agent: Mutt/1.10.1+81 (426a6c1) (2018-08-26) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191018_050943_405958_C744DD00 X-CRM114-Status: GOOD ( 19.65 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Heiko Stuebner , Karthikeyan Mitran , linux-pci@vger.kernel.org, Shawn Lin , Matthias Brugger , Thomas Petazzoni , Toan Le , Will Deacon , Lorenzo Pieralisi , Michal Simek , linux-rockchip@lists.infradead.org, bcm-kernel-feedback-list@broadcom.com, Linus Walleij , Ray Jui , Hou Zhiqiang , Ryder Lee , linux-mediatek@lists.infradead.org, Bjorn Helgaas , linux-arm-kernel@lists.infradead.org, Scott Branden , Jingoo Han , rfi@lists.rocketboards.org, linux-renesas-soc@vger.kernel.org, Tom Joseph , Simon Horman , Srinath Mannam , Gustavo Pimentel , Ley Foon Tan Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Oct 16, 2019 at 03:06:26PM -0500, Rob Herring wrote: > Convert altera host bridge to use the common > pci_parse_request_of_pci_ranges(). > > There's no need to assign the resources to a temporary list first. Just > use bridge->windows directly and remove all the temporary list handling. > > If an I/O range is present, then it will now be mapped. It's expected > that h/w which doesn't support I/O range will not define one. > > Cc: Ley Foon Tan > Cc: Lorenzo Pieralisi > Cc: Bjorn Helgaas > Cc: rfi@lists.rocketboards.org > Signed-off-by: Rob Herring > --- Reviewed-by: Andrew Murray > v2: > - Remove temporary resource list > --- > drivers/pci/controller/pcie-altera.c | 41 ++-------------------------- > 1 file changed, 2 insertions(+), 39 deletions(-) > > diff --git a/drivers/pci/controller/pcie-altera.c b/drivers/pci/controller/pcie-altera.c > index d2497ca43828..ba025efeae28 100644 > --- a/drivers/pci/controller/pcie-altera.c > +++ b/drivers/pci/controller/pcie-altera.c > @@ -92,7 +92,6 @@ struct altera_pcie { > u8 root_bus_nr; > struct irq_domain *irq_domain; > struct resource bus_range; > - struct list_head resources; > const struct altera_pcie_data *pcie_data; > }; > > @@ -670,39 +669,6 @@ static void altera_pcie_isr(struct irq_desc *desc) > chained_irq_exit(chip, desc); > } > > -static int altera_pcie_parse_request_of_pci_ranges(struct altera_pcie *pcie) > -{ > - int err, res_valid = 0; > - struct device *dev = &pcie->pdev->dev; > - struct resource_entry *win; > - > - err = devm_of_pci_get_host_bridge_resources(dev, 0, 0xff, > - &pcie->resources, NULL); > - if (err) > - return err; > - > - err = devm_request_pci_bus_resources(dev, &pcie->resources); > - if (err) > - goto out_release_res; > - > - resource_list_for_each_entry(win, &pcie->resources) { > - struct resource *res = win->res; > - > - if (resource_type(res) == IORESOURCE_MEM) > - res_valid |= !(res->flags & IORESOURCE_PREFETCH); > - } > - > - if (res_valid) > - return 0; > - > - dev_err(dev, "non-prefetchable memory resource required\n"); > - err = -EINVAL; > - > -out_release_res: > - pci_free_resource_list(&pcie->resources); > - return err; > -} > - > static int altera_pcie_init_irq_domain(struct altera_pcie *pcie) > { > struct device *dev = &pcie->pdev->dev; > @@ -833,9 +799,8 @@ static int altera_pcie_probe(struct platform_device *pdev) > return ret; > } > > - INIT_LIST_HEAD(&pcie->resources); > - > - ret = altera_pcie_parse_request_of_pci_ranges(pcie); > + ret = pci_parse_request_of_pci_ranges(dev, &bridge->windows, > + NULL); > if (ret) { > dev_err(dev, "Failed add resources\n"); > return ret; > @@ -853,7 +818,6 @@ static int altera_pcie_probe(struct platform_device *pdev) > cra_writel(pcie, P2A_INT_ENA_ALL, P2A_INT_ENABLE); > altera_pcie_host_init(pcie); > > - list_splice_init(&pcie->resources, &bridge->windows); > bridge->dev.parent = dev; > bridge->sysdata = pcie; > bridge->busnr = pcie->root_bus_nr; > @@ -884,7 +848,6 @@ static int altera_pcie_remove(struct platform_device *pdev) > > pci_stop_root_bus(bridge->bus); > pci_remove_root_bus(bridge->bus); > - pci_free_resource_list(&pcie->resources); > altera_pcie_irq_teardown(pcie); > > return 0; > -- > 2.20.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel