From patchwork Mon Aug 26 09:11:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 2849467 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D330E9F2F4 for ; Mon, 26 Aug 2013 09:12:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A760C20186 for ; Mon, 26 Aug 2013 09:12:20 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4D49920308 for ; Mon, 26 Aug 2013 09:12:19 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VDsqO-0002Gg-M5; Mon, 26 Aug 2013 09:12:16 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VDsqM-0000zH-Ia; Mon, 26 Aug 2013 09:12:14 +0000 Received: from mail-bk0-x22b.google.com ([2a00:1450:4008:c01::22b]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VDsqJ-0000y6-F9 for linux-arm-kernel@lists.infradead.org; Mon, 26 Aug 2013 09:12:12 +0000 Received: by mail-bk0-f43.google.com with SMTP id mz13so978047bkb.2 for ; Mon, 26 Aug 2013 02:11:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=aAKN5RwLnKllXTT2CzFdA4/tgzFzs4AjLaV6TF77Svo=; b=AS8zgE6OLLc0SrT7nh6sX9V0UgeS8QJJzZ0e4f+vDVqNQ4uHyewY5l46tT4FaFy7li RcSW6sH00X7nvAoJxRLff0Nwa0KCAwTSJefVukDN1BizVk23aOrFRq3rdsTIPtlZ5cL1 g9phUUU6Vx/dmZNdRjwRKlgddllX+SYpUt2bBvnHXqnqMdyqcrs4+42K32ie9BN3QI0V LdIPWCN9tZcdo/N85DlkKROm4Xj8fM9j37XHcUtSt+y8/UM8oCPOQOiwgdgH/YcdJbiq xkVjhjBNXim/4jUJE/4hoMsEK725kLHo1OSkST6CDDjjF9QwwrJs0SNP3is3f/g/ImRR KQkA== X-Received: by 10.204.199.132 with SMTP id es4mr664276bkb.28.1377508309544; Mon, 26 Aug 2013 02:11:49 -0700 (PDT) Received: from localhost (port-30244.pppoe.wtnet.de. [46.59.168.245]) by mx.google.com with ESMTPSA id m6sm2730925bki.7.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 26 Aug 2013 02:11:48 -0700 (PDT) From: Thierry Reding To: arm@kernel.org Subject: [PATCH] PCI: tegra: replace devm_request_and_ioremap by devm_ioremap_resource Date: Mon, 26 Aug 2013 11:11:09 +0200 Message-Id: <1377508269-9664-1-git-send-email-treding@nvidia.com> X-Mailer: git-send-email 1.8.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130826_051211_683634_5C475900 X-CRM114-Status: GOOD ( 13.24 ) X-Spam-Score: -2.0 (--) Cc: linux-tegra@vger.kernel.org, Julia Lawall , Thierry Reding , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-6.5 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Julia Lawall Use devm_ioremap_resource instead of devm_request_and_ioremap. This was done using the semantic patch scripts/coccinelle/api/devm_ioremap_resource.cocci Error-handling code was manually removed from the associated calls to platform_get_resource. Adjust the comment at the third platform_get_resource_byname to make clear why ioremap is not done at this point. Signed-off-by: Julia Lawall Acked-by: Thierry Reding Tested-by: Thierry Reding Acked-by: Bjorn Helgaas Acked-by: Stephen Warren Signed-off-by: Thierry Reding --- Hi, This is a small cleanup patch on top of the recently merged Tegra PCIe driver. Can someone please apply this to the same branch that Tegra's tegra-for-3.12-soc branch was merged? I think Kevin Hilman pulled it into next/soc. Thanks, Thierry drivers/pci/host/pci-tegra.c | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c index 7356741..2e9888a 100644 --- a/drivers/pci/host/pci-tegra.c +++ b/drivers/pci/host/pci-tegra.c @@ -1031,32 +1031,21 @@ static int tegra_pcie_get_resources(struct tegra_pcie *pcie) return err; } - /* request and remap controller registers */ pads = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pads"); - if (!pads) { - err = -EADDRNOTAVAIL; + pcie->pads = devm_ioremap_resource(&pdev->dev, pads); + if (IS_ERR(pcie->pads)) { + err = PTR_ERR(pcie->pads); goto poweroff; } afi = platform_get_resource_byname(pdev, IORESOURCE_MEM, "afi"); - if (!afi) { - err = -EADDRNOTAVAIL; - goto poweroff; - } - - pcie->pads = devm_request_and_ioremap(&pdev->dev, pads); - if (!pcie->pads) { - err = -EADDRNOTAVAIL; - goto poweroff; - } - - pcie->afi = devm_request_and_ioremap(&pdev->dev, afi); - if (!pcie->afi) { - err = -EADDRNOTAVAIL; + pcie->afi = devm_ioremap_resource(&pdev->dev, afi); + if (IS_ERR(pcie->afi)) { + err = PTR_ERR(pcie->afi); goto poweroff; } - /* request and remap configuration space */ + /* request configuration space, but remap later, on demand */ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cs"); if (!res) { err = -EADDRNOTAVAIL; @@ -1492,9 +1481,9 @@ static int tegra_pcie_parse_dt(struct tegra_pcie *pcie) rp->lanes = value; rp->pcie = pcie; - rp->base = devm_request_and_ioremap(pcie->dev, &rp->regs); - if (!rp->base) - return -EADDRNOTAVAIL; + rp->base = devm_ioremap_resource(pcie->dev, &rp->regs); + if (IS_ERR(rp->base)) + return PTR_ERR(rp->base); list_add_tail(&rp->list, &pcie->ports); }