Received: by 2002:a05:6a10:8395:0:0:0:0 with SMTP id n21csp601459pxh; Tue, 9 Nov 2021 16:00:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJxses3ct3uqfYuJob+3rprCMmCbXulrgsxtuX4ZYyMQ9TSoMRu2a15o7Ds9eI2lup17S0/I X-Received: by 2002:a92:dd08:: with SMTP id n8mr8378748ilm.227.1636502435861; Tue, 09 Nov 2021 16:00:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636502435; cv=none; d=google.com; s=arc-20160816; b=o3TOKoiBvElbK5YHLVXBVkFdV1XimpvYhe66PFbYIi+9XSJ+Ps1sbKPPDYNUvcYQHJ rFlPuiUH4f6D6GIV2yK/zGkROvlVusqbHM9n1bysy4/OAEzG0Twon1NbaU3fL9xzlWse U7edBZQb1U+B5aCq2RJPw7qGAXcBggiof6yKxrtq4Ha/l2fQmP8qg0yKPvvuHrbvOBPH JuRjlfkBl3N1i+IlGNB6Ne+TcfQc6KzT7PNmgu1WDiXjPGZgIf2fK8o30pSn0Tnd6UyC yf0rbWzdeKSGMV1qYDmV8H8IRwpx7ycE81ZbEBuiHM4+rsTRXPmv/xiUp5Ga9eUR9NIM l/Vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=6paIjLE8U/FrK9mB8kuZqipHCgDLbl+dKybG4Ys9E30=; b=d0yl9wmvMCU3xB8x2y0g/fy6vHFQ600AiHQp6lGYVk1Gy4E4mQ3Vq9kT92PNhFzTQE LzP3kQwLfjIjTcUcP8uu8CEWT7xQGlRinlyE3ngEo2JHXkQBCJcAgIRNghCBKU33zSdE K+RdmH0AFSDY1QC1fjEVBsbOr0sMWmDYeCyXj4t45Rog5ars5Ia4Nude9JptI/G0jUnu 91BH2cZlHh5T5dUem2hJzK2aJCzTZyb/LpSvIXqsB6qeJPf6NyNWFrr0y5BnM3248b9H LVP2fAuvr/5cTaLGI6/UadrF8ktl6bF+T0UfF9wMLui1EQqvHya+Qyx1MP/2MGmX+n4a LxWA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n8si39384325jat.113.2021.11.09.16.00.23; Tue, 09 Nov 2021 16:00:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237815AbhKIPSy (ORCPT + 97 others); Tue, 9 Nov 2021 10:18:54 -0500 Received: from mga11.intel.com ([192.55.52.93]:21109 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236189AbhKIPSx (ORCPT ); Tue, 9 Nov 2021 10:18:53 -0500 X-IronPort-AV: E=McAfee;i="6200,9189,10162"; a="229923435" X-IronPort-AV: E=Sophos;i="5.87,220,1631602800"; d="scan'208";a="229923435" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Nov 2021 07:16:07 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,220,1631602800"; d="scan'208";a="545346270" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga008.fm.intel.com with ESMTP; 09 Nov 2021 07:16:06 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 2B8CF18E; Tue, 9 Nov 2021 17:16:07 +0200 (EET) From: Andy Shevchenko To: Bjorn Helgaas , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andy Shevchenko Subject: [PATCH v1 1/1] PCI: probe: Use pci_find_vsec_capability() when looking for TBT devices Date: Tue, 9 Nov 2021 17:16:04 +0200 Message-Id: <20211109151604.17086-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently the set_pcie_thunderbolt() opens code pci_find_vsec_capability(). Refactor the former to use the latter. No functional change intended. Signed-off-by: Andy Shevchenko --- drivers/pci/probe.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 087d3658f75c..db5a0762da03 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -1579,20 +1579,11 @@ void set_pcie_hotplug_bridge(struct pci_dev *pdev) static void set_pcie_thunderbolt(struct pci_dev *dev) { - int vsec = 0; - u32 header; + u16 vsec; - while ((vsec = pci_find_next_ext_capability(dev, vsec, - PCI_EXT_CAP_ID_VNDR))) { - pci_read_config_dword(dev, vsec + PCI_VNDR_HEADER, &header); - - /* Is the device part of a Thunderbolt controller? */ - if (dev->vendor == PCI_VENDOR_ID_INTEL && - PCI_VNDR_HEADER_ID(header) == PCI_VSEC_ID_INTEL_TBT) { - dev->is_thunderbolt = 1; - return; - } - } + vsec = pci_find_vsec_capability(dev, PCI_VENDOR_ID_INTEL, PCI_VSEC_ID_INTEL_TBT); + if (vsec) + dev->is_thunderbolt = 1; } static void set_pcie_untrusted(struct pci_dev *dev) -- 2.33.0