Received: by 10.223.164.221 with SMTP id h29csp138733wrb; Fri, 3 Nov 2017 06:52:01 -0700 (PDT) X-Google-Smtp-Source: ABhQp+TBkL0gVRXpUVQVnwJg9m+bnYamHPM82/RIo0xFaLYvwAc2r+y8rMNii2BMpDbPa839Ctni X-Received: by 10.99.123.94 with SMTP id k30mr7314717pgn.33.1509717121410; Fri, 03 Nov 2017 06:52:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509717121; cv=none; d=google.com; s=arc-20160816; b=L2ovfwTAxeIiGa6eRVcBJwKjmJaM7F6bvCifxf4W+7yhE+3ItDpnEg8k/zqXhKsi8V Nn2o9W8AhXeyIR5hpHea54c/jOrLYl2oFHxCCtSAZNOMANSasf/76vPPewilbVIPUscE JpJHHXun390T6nz2vK9ASUdtzZoenmSPJzPbtnmqCbjvTiunC4oTrHfBQuFZJmgtZxPS KEdB+sFxg3z1bYELAZd+GPcasMxqKnA12wXjxq+fdUNxSKkh9ZuAQ2squFW/YEAKX7fT o3Zo9zJuDA4nS10DvhzjkGHOeT+bOdls9hEK9VI0BEVu+oUsDlGBgDS2i7oYj6raDODP zeUw== 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=wmQPeF2GnXQ+PH4+HakvkDhnTO+rE4alQrWTq7arOr4=; b=yMjwmXh3b0KcEOq4fkafgMEaywFHW9IwpErtlPmAOW/913CAPDLNSkBAuqvHqnP49d GtC79wCKnf4xxwjmNobEx8hpszrF19n2iL91Dn+tWA6VjHUCwGF2IjOhvf1OAX0dpeN4 0MF8kGALhUWqJF81wRrMfszmSDWbPkg1IDD/rghrpj+d2G7k1jp16hp9cBhKyBCJlmo+ vFiPt4JrDz4gCKGA9YOIfYG+IFp9QWNEQoPtfypqdIQWOgdHDkqqatgZ6EA3Mq90A40I mLi/glVVQGQ+h3AysGYPhDAsDRdejWabatrs3PlUui10q9MZR00oCj9Wrs+NXb+Z03+5 gX4g== 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 31si5061435pli.35.2017.11.03.06.51.48; Fri, 03 Nov 2017 06:52:01 -0700 (PDT) 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 S1756493AbdKCNs3 (ORCPT + 95 others); Fri, 3 Nov 2017 09:48:29 -0400 Received: from bastet.se.axis.com ([195.60.68.11]:51605 "EHLO bastet.se.axis.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756471AbdKCNs1 (ORCPT ); Fri, 3 Nov 2017 09:48:27 -0400 Received: from localhost (localhost [127.0.0.1]) by bastet.se.axis.com (Postfix) with ESMTP id E8D6618955; Fri, 3 Nov 2017 14:48: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 2NRjvum9EF1C; Fri, 3 Nov 2017 14:48:25 +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 25D661839E; Fri, 3 Nov 2017 14:48:25 +0100 (CET) Received: from boulder02.se.axis.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 132521A088; Fri, 3 Nov 2017 14:48:25 +0100 (CET) Received: from boulder02.se.axis.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 06C001A08B; Fri, 3 Nov 2017 14:48:25 +0100 (CET) Received: from seth.se.axis.com (unknown [10.0.2.172]) by boulder02.se.axis.com (Postfix) with ESMTP; Fri, 3 Nov 2017 14:48: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 EE8EF2629; Fri, 3 Nov 2017 14:48:24 +0100 (CET) Received: by lnxartpec1.se.axis.com (Postfix, from userid 20283) id EB28440101; Fri, 3 Nov 2017 14:48:24 +0100 (CET) From: Niklas Cassel To: Kishon Vijay Abraham I , Bjorn Helgaas Cc: Niklas Cassel , linux-omap@vger.kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 09/17] PCI: dwc: dra7xx: Help compiler to remove unused code Date: Fri, 3 Nov 2017 14:47:13 +0100 Message-Id: <20171103134722.5532-10-niklas.cassel@axis.com> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171103134722.5532-1-niklas.cassel@axis.com> References: <20171103134722.5532-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 009f6aeeee1c..4b02b2040eda 100644 --- a/drivers/pci/dwc/pci-dra7xx.c +++ b/drivers/pci/dwc/pci-dra7xx.c @@ -682,6 +682,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); @@ -689,6 +694,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 1583039804196847167@xxx Fri Nov 03 10:20:03 +0000 2017 X-GM-THRID: 1583039804196847167 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread