From patchwork Sat Jan 11 01:26:56 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 3468711 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 36C98C02DC for ; Sat, 11 Jan 2014 01:27:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 43C8620142 for ; Sat, 11 Jan 2014 01:27:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4341F20123 for ; Sat, 11 Jan 2014 01:27:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751247AbaAKB07 (ORCPT ); Fri, 10 Jan 2014 20:26:59 -0500 Received: from mail-pd0-f171.google.com ([209.85.192.171]:65419 "EHLO mail-pd0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750983AbaAKB07 (ORCPT ); Fri, 10 Jan 2014 20:26:59 -0500 Received: by mail-pd0-f171.google.com with SMTP id x10so563688pdj.30 for ; Fri, 10 Jan 2014 17:26:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=subject:to:from:cc:date:message-id:in-reply-to:references :user-agent:mime-version:content-type:content-transfer-encoding; bh=NHwFXsY1620iqlJyF2ugtr0szILfX+5p0IdmkhdprME=; b=gTh4vNSxU9AkXbAuXSlNtaSxc4wmES24QBng9fqxAmzASIjxZ2HdaQ/ylERUSx/+Sh bTncrgrZAiicezGDN99qkE5fxCMWhWwCULBJTvwqTnz4egR82wrYClPrhq3N+Gsqza9i JAR0NRgeMgQ1r/wNN1I0KDNGLXt0wZN9IZ0ndsBRdn7znoLNiQAettevvhHigh+LBg5d oBOwOiltJ4GlF6LgCZgAujq0+n3LKRR6UC3nje8wKC+Ch/R6YjvPWVA/fGFGGR1b1uEE udXaGvnaqovVlo/gbyNahhrMt+f1b4gzfFqcxkXYk1/3xJDDu7SWyxcSYnhj5NceBq+x pEwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:from:cc:date:message-id:in-reply-to :references:user-agent:mime-version:content-type :content-transfer-encoding; bh=NHwFXsY1620iqlJyF2ugtr0szILfX+5p0IdmkhdprME=; b=iCajlhag6BefBIbzTkpoRHMzxjG9oEWitu1F3mBFPEKySaxVIg/7zXgR/8BLwlvOAk J4IsEkEVAqD2dtcXFzluh+pZEhouCSu6kDklpLYDd+XsbHd/cVOgI3Lr1wI+YRT7v1nX 3HIvyq0R3/zf9CgfJtVgxPnulNpHC47ju+jenVKU068+Q6y9Uqctg31hkS46Ie85lYhF J7JrtxC91rfKBabIFBHnTJ9ws7GRAWrVs5iO2Vh81MquWoFSlmq0xfiNcghR4YHhD2mz YQp+yOed4HDL8+tCB5Ep6gbc56As7Qy/9GyN4rVeSbDItzjXzcqnzEVfp2thKqYSjVA7 af7Q== X-Gm-Message-State: ALoCoQkdMtrNg/RYxs9Adcv2RHZKVWaYs4+iNoG4zJSKdkO2LkDFgEbfyamLlb11fhLFmm/hN6+FVGkMuslylz8v9BXmMilWliGKSfhtcmUWee2p4v9UGepAJ1VWUnLsy2Yf3gTcCX1jWPjU/0U1ikuTgoQOnASdJKz0sEqQjC+s3ehlPWzZlYLlRv8URiB4rVXiVIExvn8OyH4wAz6K/5y59eD0X7IwMQ== X-Received: by 10.66.162.74 with SMTP id xy10mr15628339pab.4.1389403618510; Fri, 10 Jan 2014 17:26:58 -0800 (PST) Received: from localhost ([172.26.52.174]) by mx.google.com with ESMTPSA id sj1sm20401705pbc.28.2014.01.10.17.26.57 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 10 Jan 2014 17:26:57 -0800 (PST) Subject: [PATCH v2 02/12] PCI: Remove unused Latency Tolerance Reporting support To: Stephen Hemminger , linux-pci@vger.kernel.org From: Bjorn Helgaas Cc: Yu Zhao , Jesse Barnes Date: Fri, 10 Jan 2014 18:26:56 -0700 Message-ID: <20140111012656.14505.15407.stgit@bhelgaas-glaptop.roam.corp.google.com> In-Reply-To: <20140111012339.14505.40203.stgit@bhelgaas-glaptop.roam.corp.google.com> References: <20140111012339.14505.40203.stgit@bhelgaas-glaptop.roam.corp.google.com> User-Agent: StGit/0.16 MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham 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: Stephen Hemminger My philosophy is unused code is dead code. And dead code is subject to bit rot and is a likely source of bugs. Use it or lose it. This reverts 51c2e0a7e5bc ("PCI: add latency tolerance reporting enable/disable support"), removing these interfaces: pci_enable_ltr() pci_disable_ltr() pci_set_ltr() [bhelgaas: split to separate patch, also remove prototypes from pci.h] Signed-off-by: Stephen Hemminger Signed-off-by: Bjorn Helgaas CC: Jesse Barnes --- drivers/pci/pci.c | 123 --------------------------------------------------- include/linux/pci.h | 4 -- 2 files changed, 127 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/pci.c b/drivers/pci/pci.c index 33120d156668..020f672deabb 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -2223,129 +2223,6 @@ void pci_disable_obff(struct pci_dev *dev) } EXPORT_SYMBOL(pci_disable_obff); -/** - * pci_ltr_supported - check whether a device supports LTR - * @dev: PCI device - * - * RETURNS: - * True if @dev supports latency tolerance reporting, false otherwise. - */ -static bool pci_ltr_supported(struct pci_dev *dev) -{ - u32 cap; - - pcie_capability_read_dword(dev, PCI_EXP_DEVCAP2, &cap); - - return cap & PCI_EXP_DEVCAP2_LTR; -} - -/** - * pci_enable_ltr - enable latency tolerance reporting - * @dev: PCI device - * - * Enable LTR on @dev if possible, which means enabling it first on - * upstream ports. - * - * RETURNS: - * Zero on success, errno on failure. - */ -int pci_enable_ltr(struct pci_dev *dev) -{ - int ret; - - /* Only primary function can enable/disable LTR */ - if (PCI_FUNC(dev->devfn) != 0) - return -EINVAL; - - if (!pci_ltr_supported(dev)) - return -ENOTSUPP; - - /* Enable upstream ports first */ - if (dev->bus->self) { - ret = pci_enable_ltr(dev->bus->self); - if (ret) - return ret; - } - - return pcie_capability_set_word(dev, PCI_EXP_DEVCTL2, - PCI_EXP_DEVCTL2_LTR_EN); -} -EXPORT_SYMBOL(pci_enable_ltr); - -/** - * pci_disable_ltr - disable latency tolerance reporting - * @dev: PCI device - */ -void pci_disable_ltr(struct pci_dev *dev) -{ - /* Only primary function can enable/disable LTR */ - if (PCI_FUNC(dev->devfn) != 0) - return; - - if (!pci_ltr_supported(dev)) - return; - - pcie_capability_clear_word(dev, PCI_EXP_DEVCTL2, - PCI_EXP_DEVCTL2_LTR_EN); -} -EXPORT_SYMBOL(pci_disable_ltr); - -static int __pci_ltr_scale(int *val) -{ - int scale = 0; - - while (*val > 1023) { - *val = (*val + 31) / 32; - scale++; - } - return scale; -} - -/** - * pci_set_ltr - set LTR latency values - * @dev: PCI device - * @snoop_lat_ns: snoop latency in nanoseconds - * @nosnoop_lat_ns: nosnoop latency in nanoseconds - * - * Figure out the scale and set the LTR values accordingly. - */ -int pci_set_ltr(struct pci_dev *dev, int snoop_lat_ns, int nosnoop_lat_ns) -{ - int pos, ret, snoop_scale, nosnoop_scale; - u16 val; - - if (!pci_ltr_supported(dev)) - return -ENOTSUPP; - - snoop_scale = __pci_ltr_scale(&snoop_lat_ns); - nosnoop_scale = __pci_ltr_scale(&nosnoop_lat_ns); - - if (snoop_lat_ns > PCI_LTR_VALUE_MASK || - nosnoop_lat_ns > PCI_LTR_VALUE_MASK) - return -EINVAL; - - if ((snoop_scale > (PCI_LTR_SCALE_MASK >> PCI_LTR_SCALE_SHIFT)) || - (nosnoop_scale > (PCI_LTR_SCALE_MASK >> PCI_LTR_SCALE_SHIFT))) - return -EINVAL; - - pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_LTR); - if (!pos) - return -ENOTSUPP; - - val = (snoop_scale << PCI_LTR_SCALE_SHIFT) | snoop_lat_ns; - ret = pci_write_config_word(dev, pos + PCI_LTR_MAX_SNOOP_LAT, val); - if (ret != 4) - return -EIO; - - val = (nosnoop_scale << PCI_LTR_SCALE_SHIFT) | nosnoop_lat_ns; - ret = pci_write_config_word(dev, pos + PCI_LTR_MAX_NOSNOOP_LAT, val); - if (ret != 4) - return -EIO; - - return 0; -} -EXPORT_SYMBOL(pci_set_ltr); - static int pci_acs_enable; /** diff --git a/include/linux/pci.h b/include/linux/pci.h index 1084a15175e0..ee26454746ba 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -1009,10 +1009,6 @@ enum pci_obff_signal_type { int pci_enable_obff(struct pci_dev *dev, enum pci_obff_signal_type); void pci_disable_obff(struct pci_dev *dev); -int pci_enable_ltr(struct pci_dev *dev); -void pci_disable_ltr(struct pci_dev *dev); -int pci_set_ltr(struct pci_dev *dev, int snoop_lat_ns, int nosnoop_lat_ns); - /* For use by arch with custom probe code */ void set_pcie_port_type(struct pci_dev *pdev); void set_pcie_hotplug_bridge(struct pci_dev *pdev);