Received: by 10.223.164.202 with SMTP id h10csp3819786wrb; Mon, 20 Nov 2017 05:37:44 -0800 (PST) X-Google-Smtp-Source: AGs4zMbm/xu8DjggAf4i7prterSTurNrv1hpRcoeHjRMNSzT9srctHugAAzFmylJcAmjW+EL5JuX X-Received: by 10.98.127.149 with SMTP id a143mr11537002pfd.65.1511185064721; Mon, 20 Nov 2017 05:37:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511185064; cv=none; d=google.com; s=arc-20160816; b=fMvVK1QUhdVR+HqMiTwdXqZN3BKfVXcCMDg9iglUeEzRDRP1B2y0eGvia9Y40X0cN8 IPImkwLQP0sOEnvqNHWgnXT25/TdtXwsW1dtAeLHxa1IA1kvJ4NoLRCrgIzsEieBs8Ol 0fk6YI7J1o7IuIBnEA6K5ylOt9VADd4QOHt9Sv2HLDMYSiT1YJR8LOqqVqY8xiJE3R6M uBzZHADRp6Eypy6vugBzQaX7IYTJDGTFn8va2znFJR2juTHaQ3/1ynJrJ9D5mwZTDusp h318Zs7ePzIr5cnc0dw1hAIHZdmphWAi68pvPd3+3uS8kbwdwckF2FB99xNO95c4MuDE 5qOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=FnKuDNpVP7fe3/rfxmSe5QeMcGxUqRe9rc2cAbNFbDc=; b=iMqQm8GhGERBHxQtRNyIxdF16yXwn/byu7K8oF0VNyUdGnPUYifMWIFDEgLQNIn6hR LSrPJwVlEm8oQeeD6UkEGV6ANR2fcs3ZV3omhc2aVobRCBP5rvxUjuxd9a83ihdnsoS1 pkNEqnRSgw40IsJ4OiwJQ4png5qm/2TXblY5QB6aEfgcs0M4v2OcuCTr8hLQgzzUuLJ6 ry/yj9kiNz/WN6L2RmoOt+JL9gyXzbEDlQiYOTrtCwoXKZmKd4fS4466ww4Nt8Fk8B0G sj516XfT/n6tg+igd94JRjEJE0FX68LNaaODZu67VSQA0/ZOgpVLm256vTBkSSRT7uEc R2dQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m8si6441066plt.65.2017.11.20.05.37.34; Mon, 20 Nov 2017 05:37:44 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751443AbdKTNd3 (ORCPT + 66 others); Mon, 20 Nov 2017 08:33:29 -0500 Received: from bastet.se.axis.com ([195.60.68.11]:39611 "EHLO bastet.se.axis.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751151AbdKTNd1 (ORCPT ); Mon, 20 Nov 2017 08:33:27 -0500 Received: from localhost (localhost [127.0.0.1]) by bastet.se.axis.com (Postfix) with ESMTP id 5F8C0183B6; Mon, 20 Nov 2017 14:33:25 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at bastet.se.axis.com Received: from bastet.se.axis.com ([IPv6:::ffff:127.0.0.1]) by localhost (bastet.se.axis.com [::ffff:127.0.0.1]) (amavisd-new, port 10024) with LMTP id 3CaqpTV76GIW; Mon, 20 Nov 2017 14:33:24 +0100 (CET) Received: from boulder02.se.axis.com (boulder02.se.axis.com [10.0.8.16]) by bastet.se.axis.com (Postfix) with ESMTPS id 9D226183B3; Mon, 20 Nov 2017 14:33:24 +0100 (CET) Received: from boulder02.se.axis.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8530A1A08C; Mon, 20 Nov 2017 14:33:24 +0100 (CET) Received: from boulder02.se.axis.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7260A1A070; Mon, 20 Nov 2017 14:33:24 +0100 (CET) Received: from seth.se.axis.com (unknown [10.0.2.172]) by boulder02.se.axis.com (Postfix) with ESMTP; Mon, 20 Nov 2017 14:33:24 +0100 (CET) Received: from lnxartpec1.se.axis.com (lnxartpec1.se.axis.com [10.88.4.10]) by seth.se.axis.com (Postfix) with ESMTP id 66AF7198F; Mon, 20 Nov 2017 14:33:24 +0100 (CET) Received: by lnxartpec1.se.axis.com (Postfix, from userid 20283) id 6201E400FE; Mon, 20 Nov 2017 14:33:24 +0100 (CET) From: Niklas Cassel To: Kishon Vijay Abraham I , Lorenzo Pieralisi , Bjorn Helgaas Cc: Niklas Cassel , linux-omap@vger.kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 09/18] PCI: dwc: dra7xx: Help compiler to remove unused code Date: Mon, 20 Nov 2017 14:32:12 +0100 Message-Id: <20171120133222.27771-10-niklas.cassel@axis.com> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171120133222.27771-1-niklas.cassel@axis.com> References: <20171120133222.27771-1-niklas.cassel@axis.com> X-TM-AS-GCONF: 00 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The dra7xx driver supports both host and ep mode. When enabling support for only one of the modes, help the compiler to remove code for the mode that we have not enabled in the driver. By adding if (!IS_ENABLED(CONFIG_PCI_DRA7XX_HOST)) return -ENODEV; anything after that statement will get silently dropped by the compiler, including static functions and structures that are referenced indirectly from there. Suggested-by: Arnd Bergmann Signed-off-by: Niklas Cassel --- drivers/pci/dwc/pci-dra7xx.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/pci/dwc/pci-dra7xx.c b/drivers/pci/dwc/pci-dra7xx.c index 07c74ae3614e..224ff8affdce 100644 --- a/drivers/pci/dwc/pci-dra7xx.c +++ b/drivers/pci/dwc/pci-dra7xx.c @@ -694,6 +694,11 @@ static int __init dra7xx_pcie_probe(struct platform_device *pdev) switch (mode) { case DW_PCIE_RC_TYPE: + if (!IS_ENABLED(CONFIG_PCI_DRA7XX_HOST)) { + ret = -ENODEV; + goto err_gpio; + } + dra7xx_pcie_writel(dra7xx, PCIECTRL_TI_CONF_DEVICE_TYPE, DEVICE_TYPE_RC); ret = dra7xx_add_pcie_port(dra7xx, pdev); @@ -701,6 +706,11 @@ static int __init dra7xx_pcie_probe(struct platform_device *pdev) goto err_gpio; break; case DW_PCIE_EP_TYPE: + if (!IS_ENABLED(CONFIG_PCI_DRA7XX_EP)) { + ret = -ENODEV; + goto err_gpio; + } + dra7xx_pcie_writel(dra7xx, PCIECTRL_TI_CONF_DEVICE_TYPE, DEVICE_TYPE_EP); -- 2.14.2 From 1584594868431882496@xxx Mon Nov 20 14:17:07 +0000 2017 X-GM-THRID: 1584594868431882496 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread