From patchwork Fri Oct 7 16:22:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 9366561 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5ABF860487 for ; Fri, 7 Oct 2016 16:23:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 49E772975F for ; Fri, 7 Oct 2016 16:23:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3EB6729770; Fri, 7 Oct 2016 16:23:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CBCE92976F for ; Fri, 7 Oct 2016 16:23:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S938966AbcJGQXD (ORCPT ); Fri, 7 Oct 2016 12:23:03 -0400 Received: from mail.kernel.org ([198.145.29.136]:46138 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936461AbcJGQXC (ORCPT ); Fri, 7 Oct 2016 12:23:02 -0400 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2A1CB203AC; Fri, 7 Oct 2016 16:23:01 +0000 (UTC) Received: from localhost (unknown [69.55.156.165]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EA43720374; Fri, 7 Oct 2016 16:22:59 +0000 (UTC) Subject: [PATCH 09/10] PCI: altera: Add local struct device pointers To: Ley Foon Tan From: Bjorn Helgaas Cc: linux-pci@vger.kernel.org, rfi@lists.rocketboards.org Date: Fri, 07 Oct 2016 11:22:58 -0500 Message-ID: <20161007162258.22796.5577.stgit@bhelgaas-glaptop2.roam.corp.google.com> In-Reply-To: <20161007162153.22796.13721.stgit@bhelgaas-glaptop2.roam.corp.google.com> References: <20161007162153.22796.13721.stgit@bhelgaas-glaptop2.roam.corp.google.com> User-Agent: StGit/0.16 MIME-Version: 1.0 X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use a local "struct device *dev" for brevity and consistency with other drivers. No functional change intended. Signed-off-by: Bjorn Helgaas --- drivers/pci/host/pcie-altera.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/pci/host/pcie-altera.c b/drivers/pci/host/pcie-altera.c index 90ab581..92749e9 100644 --- a/drivers/pci/host/pcie-altera.c +++ b/drivers/pci/host/pcie-altera.c @@ -388,6 +388,7 @@ static int altera_write_cap_word(struct altera_pcie *altera, u8 busno, static void altera_wait_link_retrain(struct altera_pcie *altera) { + struct device *dev = &altera->pdev->dev; u16 reg16; unsigned long start_jiffies; @@ -400,7 +401,7 @@ static void altera_wait_link_retrain(struct altera_pcie *altera) break; if (time_after(jiffies, start_jiffies + LINK_RETRAIN_TIMEOUT)) { - dev_err(&altera->pdev->dev, "link retrain timeout\n"); + dev_err(dev, "link retrain timeout\n"); break; } udelay(100); @@ -413,7 +414,7 @@ static void altera_wait_link_retrain(struct altera_pcie *altera) break; if (time_after(jiffies, start_jiffies + LINK_UP_TIMEOUT)) { - dev_err(&altera->pdev->dev, "link up timeout\n"); + dev_err(dev, "link up timeout\n"); break; } udelay(100); @@ -466,12 +467,14 @@ static void altera_pcie_isr(struct irq_desc *desc) { struct irq_chip *chip = irq_desc_get_chip(desc); struct altera_pcie *altera; + struct device *dev; unsigned long status; u32 bit; u32 virq; chained_irq_enter(chip, desc); altera = irq_desc_get_handler_data(desc); + dev = &altera->pdev->dev; while ((status = altera_cra_readl(altera, P2A_INT_STATUS) & P2A_INT_STS_ALL) != 0) { @@ -483,8 +486,7 @@ static void altera_pcie_isr(struct irq_desc *desc) if (virq) generic_handle_irq(virq); else - dev_err(&altera->pdev->dev, - "unexpected IRQ, INT%d\n", bit); + dev_err(dev, "unexpected IRQ, INT%d\n", bit); } } @@ -543,20 +545,21 @@ static int altera_pcie_init_irq_domain(struct altera_pcie *altera) static int altera_pcie_parse_dt(struct altera_pcie *altera) { - struct resource *cra; struct platform_device *pdev = altera->pdev; + struct device *dev = &pdev->dev; + struct resource *cra; cra = platform_get_resource_byname(pdev, IORESOURCE_MEM, "Cra"); - altera->cra_base = devm_ioremap_resource(&pdev->dev, cra); + altera->cra_base = devm_ioremap_resource(dev, cra); if (IS_ERR(altera->cra_base)) { - dev_err(&pdev->dev, "failed to map cra memory\n"); + dev_err(dev, "failed to map cra memory\n"); return PTR_ERR(altera->cra_base); } /* setup IRQ */ altera->irq = platform_get_irq(pdev, 0); if (altera->irq <= 0) { - dev_err(&pdev->dev, "failed to get IRQ: %d\n", altera->irq); + dev_err(dev, "failed to get IRQ: %d\n", altera->irq); return -EINVAL; } @@ -572,12 +575,13 @@ static void altera_pcie_host_init(struct altera_pcie *altera) static int altera_pcie_probe(struct platform_device *pdev) { + struct device *dev = &pdev->dev; struct altera_pcie *altera; struct pci_bus *bus; struct pci_bus *child; int ret; - altera = devm_kzalloc(&pdev->dev, sizeof(*altera), GFP_KERNEL); + altera = devm_kzalloc(dev, sizeof(*altera), GFP_KERNEL); if (!altera) return -ENOMEM; @@ -585,7 +589,7 @@ static int altera_pcie_probe(struct platform_device *pdev) ret = altera_pcie_parse_dt(altera); if (ret) { - dev_err(&pdev->dev, "Parsing DT failed\n"); + dev_err(dev, "Parsing DT failed\n"); return ret; } @@ -593,13 +597,13 @@ static int altera_pcie_probe(struct platform_device *pdev) ret = altera_pcie_parse_request_of_pci_ranges(altera); if (ret) { - dev_err(&pdev->dev, "Failed add resources\n"); + dev_err(dev, "Failed add resources\n"); return ret; } ret = altera_pcie_init_irq_domain(altera); if (ret) { - dev_err(&pdev->dev, "Failed creating IRQ Domain\n"); + dev_err(dev, "Failed creating IRQ Domain\n"); return ret; } @@ -609,7 +613,7 @@ static int altera_pcie_probe(struct platform_device *pdev) altera_cra_writel(altera, P2A_INT_ENABLE, P2A_INT_ENA_ALL); altera_pcie_host_init(altera); - bus = pci_scan_root_bus(&pdev->dev, altera->root_bus_nr, + bus = pci_scan_root_bus(dev, altera->root_bus_nr, &altera_pcie_ops, altera, &altera->resources); if (!bus) return -ENOMEM;