From patchwork Tue Jan 31 20:19:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 9548401 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 1B94A604E1 for ; Tue, 31 Jan 2017 20:21:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 064052823D for ; Tue, 31 Jan 2017 20:21:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EF6C228375; Tue, 31 Jan 2017 20:20:59 +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=-1.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 74A8E28394 for ; Tue, 31 Jan 2017 20:20:59 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cYev5-0005hb-UI; Tue, 31 Jan 2017 20:20:51 +0000 Received: from mail.kernel.org ([198.145.29.136]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cYeua-0004BO-2O for linux-arm-kernel@lists.infradead.org; Tue, 31 Jan 2017 20:20:21 +0000 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6280820218; Tue, 31 Jan 2017 20:20: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 EC31A20211; Tue, 31 Jan 2017 20:19:59 +0000 (UTC) Subject: [PATCH 1 1/4] PCI: hisi: Use of_device_get_match_data() to simplify probe From: Bjorn Helgaas To: linux-pci@vger.kernel.org Date: Tue, 31 Jan 2017 14:19:59 -0600 Message-ID: <20170131201958.27605.54898.stgit@bhelgaas-glaptop.roam.corp.google.com> In-Reply-To: <20170131201400.27605.56002.stgit@bhelgaas-glaptop.roam.corp.google.com> References: <20170131201400.27605.56002.stgit@bhelgaas-glaptop.roam.corp.google.com> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Virus-Scanned: ClamAV using ClamSMTP X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170131_122020_170016_54E19150 X-CRM114-Status: GOOD ( 13.00 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Scott Branden , Gabriele Paoloni , Jon Mason , Ray Jui , Roy Zang , linux-renesas-soc@vger.kernel.org, Minghuan Lian , Zhou Wang , Simon Horman , Geert Uytterhoeven , Shailendra Verma , bcm-kernel-feedback-list@broadcom.com, Mingkai Hu , linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Shailendra Verma The only way to call hisi_pcie_probe() is to match an entry in hisi_pcie_of_match[], so match cannot be NULL. Use of_device_get_match_data() to retrieve the soc_ops pointer. No functional change intended. [bhelgaas: use of_device_get_match_data(), changelog] Based-on-suggestion-from: Geert Uytterhoeven Signed-off-by: Shailendra Verma Signed-off-by: Bjorn Helgaas --- drivers/pci/host/pcie-hisi.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/pci/host/pcie-hisi.c b/drivers/pci/host/pcie-hisi.c index a301a7187b30..33c201afdbf1 100644 --- a/drivers/pci/host/pcie-hisi.c +++ b/drivers/pci/host/pcie-hisi.c @@ -139,7 +139,7 @@ struct hisi_pcie { struct pcie_port pp; /* pp.dbi_base is DT rc_dbi */ struct regmap *subctrl; u32 port_id; - struct pcie_soc_ops *soc_ops; + const struct pcie_soc_ops *soc_ops; }; /* HipXX PCIe host only supports 32-bit config access */ @@ -259,7 +259,6 @@ static int hisi_pcie_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct hisi_pcie *hisi_pcie; struct pcie_port *pp; - const struct of_device_id *match; struct resource *reg; struct device_driver *driver; int ret; @@ -272,11 +271,10 @@ static int hisi_pcie_probe(struct platform_device *pdev) pp->dev = dev; driver = dev->driver; - match = of_match_device(driver->of_match_table, dev); - hisi_pcie->soc_ops = (struct pcie_soc_ops *) match->data; + hisi_pcie->soc_ops = of_device_get_match_data(dev); hisi_pcie->subctrl = - syscon_regmap_lookup_by_compatible("hisilicon,pcie-sas-subctrl"); + syscon_regmap_lookup_by_compatible("hisilicon,pcie-sas-subctrl"); if (IS_ERR(hisi_pcie->subctrl)) { dev_err(dev, "cannot get subctrl base\n"); return PTR_ERR(hisi_pcie->subctrl);