From nobody Thu Dec 18 19:05:47 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 124DACA0EC7 for ; Mon, 11 Sep 2023 22:16:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359083AbjIKWPB (ORCPT ); Mon, 11 Sep 2023 18:15:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237207AbjIKMPT (ORCPT ); Mon, 11 Sep 2023 08:15:19 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59D01198; Mon, 11 Sep 2023 05:15:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1694434515; x=1725970515; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=i3M/qRLC52zinS1Ub+dGO9M7VTVBWgGGC/7YYN8zcDU=; b=MzeGmzY0PNN1POP30aXAL45CTzd6gpo7SdlbuA5hkZwwDToiWxBEii6x 0dSqKsGuyOgTI0IafKVckRfrF6e9j7XiFat0cYnT2rrin8PHKLHQ8LtPz WxNNFYOVYz0CdvoP1a/G5fRrfWEB4r3xoApMq+YPfc8HujpMF1lZGcmaq kr7XQqGktZOaT/D3kZskYdtrmHkK2lN7v3wJLgQTEf8au6/NKHqzKSxTP CZ3XNegKY+hjahf3vxcwDMcyQTCxjzmf9uowE5HmuWhck3GhuW4IA5znh 3yyt5mpOFzaja+nPgWGzigz+lNjT4mczilCGn3zlZFveSPI//FqQvHqAM g==; X-IronPort-AV: E=McAfee;i="6600,9927,10830"; a="381863433" X-IronPort-AV: E=Sophos;i="6.02,244,1688454000"; d="scan'208";a="381863433" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2023 05:15:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10830"; a="746383254" X-IronPort-AV: E=Sophos;i="6.02,244,1688454000"; d="scan'208";a="746383254" Received: from mzarkov-mobl3.ger.corp.intel.com (HELO ijarvine-mobl2.ger.corp.intel.com) ([10.252.36.200]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2023 05:15:12 -0700 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= To: linux-pci@vger.kernel.org, Bjorn Helgaas , Dennis Dalessandro , Jason Gunthorpe , Leon Romanovsky , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Subject: [PATCH 1/8] IB/hfi1: Use FIELD_GET() to extract Link Width Date: Mon, 11 Sep 2023 15:14:54 +0300 Message-Id: <20230911121501.21910-2-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230911121501.21910-1-ilpo.jarvinen@linux.intel.com> References: <20230911121501.21910-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use FIELD_GET() to extract PCIe Negotiated Link Width field instead of custom masking and shifting. While at it, also fix function's comment. Signed-off-by: Ilpo J=C3=A4rvinen Reviewed-by: Jonathan Cameron --- drivers/infiniband/hw/hfi1/pcie.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/hw/hfi1/pcie.c b/drivers/infiniband/hw/hfi1= /pcie.c index 08732e1ac966..d497e4c623c1 100644 --- a/drivers/infiniband/hw/hfi1/pcie.c +++ b/drivers/infiniband/hw/hfi1/pcie.c @@ -3,6 +3,7 @@ * Copyright(c) 2015 - 2019 Intel Corporation. */ =20 +#include #include #include #include @@ -210,10 +211,10 @@ static u32 extract_speed(u16 linkstat) return speed; } =20 -/* return the PCIe link speed from the given link status */ +/* return the PCIe Link Width from the given link status */ static u32 extract_width(u16 linkstat) { - return (linkstat & PCI_EXP_LNKSTA_NLW) >> PCI_EXP_LNKSTA_NLW_SHIFT; + return FIELD_GET(PCI_EXP_LNKSTA_NLW, linkstat); } =20 /* read the link status and set dd->{lbus_width,lbus_speed,lbus_info} */ --=20 2.30.2 From nobody Thu Dec 18 19:05:47 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34937CA0EC8 for ; Mon, 11 Sep 2023 21:20:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344535AbjIKVOZ (ORCPT ); Mon, 11 Sep 2023 17:14:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237209AbjIKMPX (ORCPT ); Mon, 11 Sep 2023 08:15:23 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 712E3198; Mon, 11 Sep 2023 05:15:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1694434518; x=1725970518; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=vNTSAGXmwOlVOUYjZEZNHYyqgouEHbaugoCgRtuF0B0=; b=XVQOP2olsx3/GXjzO11w5DY9mVd+RhG3h0fLDcwOvpfxs9dX+o0CkG8f 0aXWDa1w/ySZaEv5rH6GhDiB1pYzY4Fuj1lsg6Q+dVJLoEiINZ1QrNt8p ZSqFuOv9JGyJLLvIVYA0+beauGxPvWt+nF5VTvhGzYlQEtgJioq1Ff3XN bnZX2B4F7qku8+QL58Ww4RrFNK28y3fwnDsJJwO5z216hsIFrPpqVytVN oiti1AC//Ch1Fgw79DuM5E7Zxgpu8XNVOJWoqt/6Nii7TCrV4/WojdAm5 mg8wNcKrFvoBF7uZuW4u8Wy4a/OJ40E6vPFLKdJ8jq1CPlENnLgX24Vrq A==; X-IronPort-AV: E=McAfee;i="6600,9927,10830"; a="381863461" X-IronPort-AV: E=Sophos;i="6.02,244,1688454000"; d="scan'208";a="381863461" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2023 05:15:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10830"; a="746383272" X-IronPort-AV: E=Sophos;i="6.02,244,1688454000"; d="scan'208";a="746383272" Received: from mzarkov-mobl3.ger.corp.intel.com (HELO ijarvine-mobl2.ger.corp.intel.com) ([10.252.36.200]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2023 05:15:16 -0700 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= To: linux-pci@vger.kernel.org, Bjorn Helgaas , Hans Verkuil , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Subject: [PATCH 2/8] media: cobalt: Use FIELD_GET() to extract Link Width Date: Mon, 11 Sep 2023 15:14:55 +0300 Message-Id: <20230911121501.21910-3-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230911121501.21910-1-ilpo.jarvinen@linux.intel.com> References: <20230911121501.21910-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use FIELD_GET() to extract PCIe Negotiated and Maximum Link Width fields instead of custom masking and shifting. Signed-off-by: Ilpo J=C3=A4rvinen Reviewed-by: Jonathan Cameron --- drivers/media/pci/cobalt/cobalt-driver.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/media/pci/cobalt/cobalt-driver.c b/drivers/media/pci/c= obalt/cobalt-driver.c index 74edcc76d12f..6e1a0614e6d0 100644 --- a/drivers/media/pci/cobalt/cobalt-driver.c +++ b/drivers/media/pci/cobalt/cobalt-driver.c @@ -8,6 +8,7 @@ * All rights reserved. */ =20 +#include #include #include #include @@ -210,17 +211,17 @@ void cobalt_pcie_status_show(struct cobalt *cobalt) pcie_capability_read_word(pci_dev, PCI_EXP_LNKSTA, &stat); cobalt_info("PCIe link capability 0x%08x: %s per lane and %u lanes\n", capa, get_link_speed(capa), - (capa & PCI_EXP_LNKCAP_MLW) >> 4); + FIELD_GET(PCI_EXP_LNKCAP_MLW, capa)); cobalt_info("PCIe link control 0x%04x\n", ctrl); cobalt_info("PCIe link status 0x%04x: %s per lane and %u lanes\n", stat, get_link_speed(stat), - (stat & PCI_EXP_LNKSTA_NLW) >> 4); + FIELD_GET(PCI_EXP_LNKSTA_NLW, stat)); =20 /* Bus */ pcie_capability_read_dword(pci_bus_dev, PCI_EXP_LNKCAP, &capa); cobalt_info("PCIe bus link capability 0x%08x: %s per lane and %u lanes\n", capa, get_link_speed(capa), - (capa & PCI_EXP_LNKCAP_MLW) >> 4); + FIELD_GET(PCI_EXP_LNKCAP_MLW, capa)); =20 /* Slot */ pcie_capability_read_dword(pci_dev, PCI_EXP_SLTCAP, &capa); @@ -239,7 +240,7 @@ static unsigned pcie_link_get_lanes(struct cobalt *coba= lt) if (!pci_is_pcie(pci_dev)) return 0; pcie_capability_read_word(pci_dev, PCI_EXP_LNKSTA, &link); - return (link & PCI_EXP_LNKSTA_NLW) >> 4; + return FIELD_GET(PCI_EXP_LNKSTA_NLW, link); } =20 static unsigned pcie_bus_link_get_lanes(struct cobalt *cobalt) @@ -250,7 +251,7 @@ static unsigned pcie_bus_link_get_lanes(struct cobalt *= cobalt) if (!pci_is_pcie(pci_dev)) return 0; pcie_capability_read_dword(pci_dev, PCI_EXP_LNKCAP, &link); - return (link & PCI_EXP_LNKCAP_MLW) >> 4; + return FIELD_GET(PCI_EXP_LNKCAP_MLW, link); } =20 static void msi_config_show(struct cobalt *cobalt, struct pci_dev *pci_dev) --=20 2.30.2 From nobody Thu Dec 18 19:05:47 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D53ECA0EC6 for ; Mon, 11 Sep 2023 22:48:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356697AbjIKWEQ (ORCPT ); Mon, 11 Sep 2023 18:04:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237210AbjIKMP1 (ORCPT ); Mon, 11 Sep 2023 08:15:27 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4EB5198; Mon, 11 Sep 2023 05:15:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1694434522; x=1725970522; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=UfjgEcn3j45qxnCU9n6VXDTvhnlTPXsfglb+ZF4euEo=; b=bEtgS33yNbuzE9Pc7tW6Jm7PEe9dWZjbeeQkxjapG2dWSCF2c/+yJSqi lJ9zEZvuIBFm0UzWNBeOFLt9FriRZk8j0LS5+4hoRUkHteiI3HGYP+nyK YUbXLIt1EuYzKzKrIjHiMAvI5wFAa4FTt58b1ghkUX1RcQFPVnuTpKw5K um2PoABYwiW/eWtH1oRGWkfr95n6QdXSMw/riivo8EkHE5Ouz4lQB8h1p WfV359LblJORs5wB7elLleXsgXytjc1pNYI3XwBkLhl60g1VTQ0SUkfpH CrY3JqVOHNoA6630+FsAPu0ErFHqYqi2aRuQth/+Wvr2vBJgHV2lNg1yL A==; X-IronPort-AV: E=McAfee;i="6600,9927,10830"; a="381863502" X-IronPort-AV: E=Sophos;i="6.02,244,1688454000"; d="scan'208";a="381863502" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2023 05:15:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10830"; a="746383290" X-IronPort-AV: E=Sophos;i="6.02,244,1688454000"; d="scan'208";a="746383290" Received: from mzarkov-mobl3.ger.corp.intel.com (HELO ijarvine-mobl2.ger.corp.intel.com) ([10.252.36.200]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2023 05:15:18 -0700 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= To: linux-pci@vger.kernel.org, Bjorn Helgaas , Jesse Brandeburg , Tony Nguyen , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Subject: [PATCH 3/8] igb: Use FIELD_GET() to extract Link Width Date: Mon, 11 Sep 2023 15:14:56 +0300 Message-Id: <20230911121501.21910-4-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230911121501.21910-1-ilpo.jarvinen@linux.intel.com> References: <20230911121501.21910-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use FIELD_GET() to extract PCIe Negotiated Link Width field instead of custom masking and shifting. Signed-off-by: Ilpo J=C3=A4rvinen Reviewed-by: Jonathan Cameron --- drivers/net/ethernet/intel/igb/e1000_mac.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/intel/igb/e1000_mac.c b/drivers/net/ether= net/intel/igb/e1000_mac.c index caf91c6f52b4..5a23b9cfec6c 100644 --- a/drivers/net/ethernet/intel/igb/e1000_mac.c +++ b/drivers/net/ethernet/intel/igb/e1000_mac.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 /* Copyright(c) 2007 - 2018 Intel Corporation. */ =20 +#include #include #include #include @@ -50,9 +51,8 @@ s32 igb_get_bus_info_pcie(struct e1000_hw *hw) break; } =20 - bus->width =3D (enum e1000_bus_width)((pcie_link_status & - PCI_EXP_LNKSTA_NLW) >> - PCI_EXP_LNKSTA_NLW_SHIFT); + bus->width =3D (enum e1000_bus_width)FIELD_GET(PCI_EXP_LNKSTA_NLW, + pcie_link_status); } =20 reg =3D rd32(E1000_STATUS); --=20 2.30.2 From nobody Thu Dec 18 19:05:47 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35632CA0EC8 for ; Mon, 11 Sep 2023 22:42:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378107AbjIKWaZ (ORCPT ); Mon, 11 Sep 2023 18:30:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237211AbjIKMPc (ORCPT ); Mon, 11 Sep 2023 08:15:32 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC8B8198; Mon, 11 Sep 2023 05:15:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1694434527; x=1725970527; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=tyR7vrTUqTU08Ju+QLeqb/DiAnQ3Ts82L5iKvQhwvII=; b=bV5WlB9ZvMxsWQsgtYP7gvNwH3UjnuzfUXG0fG6wcatmUVta5eBekOeQ Qn4lD1chojE+03q5a9mQHFxgaykDPcwugtnMo/pQ6jBZ9R2nUiJjWWnUt bpM7fPAo/QxSYqmYb08ZZLFUwll5IlAdtP8qigOxTrYjGI8Ns+WHWuXuX b4UPXsjZtRAKkD9Oh3OTDePlbXTra2MW/puG7dBl/g4jGTL0eYXsknFRH jtrfJn5Rcuz55lUGyrY9hEgnbeocmjtFhGGmzreCOIvF23WkT6YTwTn3F hJyTyj7sTdJoTrryhUGlGYH3pLXLu+td8PPgu1Y+O0On1XuhCJJjlENED Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10830"; a="381863531" X-IronPort-AV: E=Sophos;i="6.02,244,1688454000"; d="scan'208";a="381863531" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2023 05:15:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10830"; a="746383294" X-IronPort-AV: E=Sophos;i="6.02,244,1688454000"; d="scan'208";a="746383294" Received: from mzarkov-mobl3.ger.corp.intel.com (HELO ijarvine-mobl2.ger.corp.intel.com) ([10.252.36.200]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2023 05:15:22 -0700 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= To: linux-pci@vger.kernel.org, Bjorn Helgaas , Lorenzo Pieralisi , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Thierry Reding , Jonathan Hunter , linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Subject: [PATCH 4/8] PCI: tegra194: Use FIELD_GET()/FIELD_PREP() with Link Width fields Date: Mon, 11 Sep 2023 15:14:57 +0300 Message-Id: <20230911121501.21910-5-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230911121501.21910-1-ilpo.jarvinen@linux.intel.com> References: <20230911121501.21910-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use FIELD_GET() to extract PCIe Negotiated Link Width field instead of custom masking and shifting. Similarly, change custom code that misleadingly used PCI_EXP_LNKSTA_NLW_SHIFT to prepare value for PCI_EXP_LNKCAP write to use FIELD_PREP() with correct field define (PCI_EXP_LNKCAP_MLW). Signed-off-by: Ilpo J=C3=A4rvinen Reviewed-by: Jonathan Cameron --- drivers/pci/controller/dwc/pcie-tegra194.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-tegra194.c b/drivers/pci/contr= oller/dwc/pcie-tegra194.c index 4bba31502ce1..248cd9347e8f 100644 --- a/drivers/pci/controller/dwc/pcie-tegra194.c +++ b/drivers/pci/controller/dwc/pcie-tegra194.c @@ -9,6 +9,7 @@ * Author: Vidya Sagar */ =20 +#include #include #include #include @@ -346,8 +347,7 @@ static void apply_bad_link_workaround(struct dw_pcie_rp= *pp) */ val =3D dw_pcie_readw_dbi(pci, pcie->pcie_cap_base + PCI_EXP_LNKSTA); if (val & PCI_EXP_LNKSTA_LBMS) { - current_link_width =3D (val & PCI_EXP_LNKSTA_NLW) >> - PCI_EXP_LNKSTA_NLW_SHIFT; + current_link_width =3D FIELD_GET(PCI_EXP_LNKSTA_NLW, val); if (pcie->init_link_width > current_link_width) { dev_warn(pci->dev, "PCIe link is bad, width reduced\n"); val =3D dw_pcie_readw_dbi(pci, pcie->pcie_cap_base + @@ -760,8 +760,7 @@ static void tegra_pcie_enable_system_interrupts(struct = dw_pcie_rp *pp) =20 val_w =3D dw_pcie_readw_dbi(&pcie->pci, pcie->pcie_cap_base + PCI_EXP_LNKSTA); - pcie->init_link_width =3D (val_w & PCI_EXP_LNKSTA_NLW) >> - PCI_EXP_LNKSTA_NLW_SHIFT; + pcie->init_link_width =3D FIELD_GET(PCI_EXP_LNKSTA_NLW, val_w); =20 val_w =3D dw_pcie_readw_dbi(&pcie->pci, pcie->pcie_cap_base + PCI_EXP_LNKCTL); @@ -920,7 +919,7 @@ static int tegra_pcie_dw_host_init(struct dw_pcie_rp *p= p) /* Configure Max lane width from DT */ val =3D dw_pcie_readl_dbi(pci, pcie->pcie_cap_base + PCI_EXP_LNKCAP); val &=3D ~PCI_EXP_LNKCAP_MLW; - val |=3D (pcie->num_lanes << PCI_EXP_LNKSTA_NLW_SHIFT); + val |=3D FIELD_PREP(PCI_EXP_LNKCAP_MLW, pcie->num_lanes); dw_pcie_writel_dbi(pci, pcie->pcie_cap_base + PCI_EXP_LNKCAP, val); =20 /* Clear Slot Clock Configuration bit if SRNS configuration */ --=20 2.30.2 From nobody Thu Dec 18 19:05:47 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A4084CA0EC3 for ; Mon, 11 Sep 2023 22:24:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377094AbjIKWVH (ORCPT ); Mon, 11 Sep 2023 18:21:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237213AbjIKMPg (ORCPT ); Mon, 11 Sep 2023 08:15:36 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4E07CEB; Mon, 11 Sep 2023 05:15:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1694434531; x=1725970531; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=toOyW9LlXxM3sJdhFIcQPxDfWTfs2UZORrP5iweYkcs=; b=c6HhtnDHBo/zdZ91MbPKjFkppwYatPgWYv1WJL+aK4R4r6RZmJiFOZfl mCEEINQ9DoS3dkIowkUXW9PuO+54Q0tX6QTPxXPtPSIt940Yub0nqDy3r guNH2ROHwfKFX8bt9LrzwNcx9JS0FRQH7S8bL9Q9Ajjk17EERFjskhZXO cdvbnPiSGvtAShGE1/S0Wu0rg4z1FSz7FrrY7HqRxR1pEAA5SU6/iKMjA NEtff8Vv0yJWK6sIeNv5h46BG+E5I6eOScrbQvlzInAecx4g0su5jW1gB vzR5D6AHdmGBe7uwHH4ZWidKJIvYPp0atvD4wLmWLnTNgBSGsfUIlRDjK A==; X-IronPort-AV: E=McAfee;i="6600,9927,10830"; a="381863554" X-IronPort-AV: E=Sophos;i="6.02,244,1688454000"; d="scan'208";a="381863554" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2023 05:15:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10830"; a="746383313" X-IronPort-AV: E=Sophos;i="6.02,244,1688454000"; d="scan'208";a="746383313" Received: from mzarkov-mobl3.ger.corp.intel.com (HELO ijarvine-mobl2.ger.corp.intel.com) ([10.252.36.200]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2023 05:15:26 -0700 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= To: linux-pci@vger.kernel.org, Bjorn Helgaas , Thomas Petazzoni , =?UTF-8?q?Pali=20Roh=C3=A1r?= , Lorenzo Pieralisi , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Subject: [PATCH 5/8] PCI: mvebu: Use FIELD_PREP() with Link Width Date: Mon, 11 Sep 2023 15:14:58 +0300 Message-Id: <20230911121501.21910-6-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230911121501.21910-1-ilpo.jarvinen@linux.intel.com> References: <20230911121501.21910-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org mvebu_pcie_setup_hw() setups the Maximum Link Width field in the Link Capabilities registers using an open-coded variant of FIELD_PREP() with a literal in shift. Improve readability by using FIELD_PREP(PCI_EXP_LNKCAP_MLW, ...). Signed-off-by: Ilpo J=C3=A4rvinen Reviewed-by: Jonathan Cameron --- drivers/pci/controller/pci-mvebu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/controller/pci-mvebu.c b/drivers/pci/controller/pc= i-mvebu.c index 60810a1fbfb7..29fe09c99e7d 100644 --- a/drivers/pci/controller/pci-mvebu.c +++ b/drivers/pci/controller/pci-mvebu.c @@ -264,7 +264,7 @@ static void mvebu_pcie_setup_hw(struct mvebu_pcie_port = *port) */ lnkcap =3D mvebu_readl(port, PCIE_CAP_PCIEXP + PCI_EXP_LNKCAP); lnkcap &=3D ~PCI_EXP_LNKCAP_MLW; - lnkcap |=3D (port->is_x4 ? 4 : 1) << 4; + lnkcap |=3D FIELD_PREP(PCI_EXP_LNKCAP_MLW, port->is_x4 ? 4 : 1); mvebu_writel(port, lnkcap, PCIE_CAP_PCIEXP + PCI_EXP_LNKCAP); =20 /* Disable Root Bridge I/O space, memory space and bus mastering. */ --=20 2.30.2 From nobody Thu Dec 18 19:05:47 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8CC0ECA0ECB for ; Mon, 11 Sep 2023 21:17:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245276AbjIKVJL (ORCPT ); Mon, 11 Sep 2023 17:09:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237214AbjIKMPh (ORCPT ); Mon, 11 Sep 2023 08:15:37 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D618CEB; Mon, 11 Sep 2023 05:15:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1694434533; x=1725970533; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=IUhBzeQfkRSLlRegZBQsKn8efuvEYSiJqgGwvHl8g+s=; b=NXTRS7zyG2DM3E6oFFvDou2aEXuYHHwhzwAcWj4aU5sExJcmxc7sH4k0 nOLsNV+wjTuJFtYOoguM9AoiseAqvN059MOfijQCWnf3pt3Ug0aXpBwIV mqG3RoUMH+uvH09PLZa/V7KFgG23i45+IZVAttayKpR+SYkNi4pj7PRLx fnqRRpNqsnTLBbAnwkGoeoyS5xFD6YXOsJVZgmFOjGc4hhB2/asqrUluf gQUf2lNsmUGY1X1kQA+BcERzKYkvOhHYJRJ9XOQBh8aHePbzmQytuIFU2 pOAc8DuMj5WXLo++mDrKk1ggaFbClDB4ktknUrZ0IfjnJoicoU66/vQ6W g==; X-IronPort-AV: E=McAfee;i="6600,9927,10830"; a="381863570" X-IronPort-AV: E=Sophos;i="6.02,244,1688454000"; d="scan'208";a="381863570" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2023 05:15:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10830"; a="746383348" X-IronPort-AV: E=Sophos;i="6.02,244,1688454000"; d="scan'208";a="746383348" Received: from mzarkov-mobl3.ger.corp.intel.com (HELO ijarvine-mobl2.ger.corp.intel.com) ([10.252.36.200]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2023 05:15:31 -0700 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= To: linux-pci@vger.kernel.org, Bjorn Helgaas , Bjorn Helgaas , linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Subject: [PATCH 6/8] PCI: Use FIELD_GET() to extract Link Width Date: Mon, 11 Sep 2023 15:14:59 +0300 Message-Id: <20230911121501.21910-7-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230911121501.21910-1-ilpo.jarvinen@linux.intel.com> References: <20230911121501.21910-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use FIELD_GET() to extract PCIe Negotiated and Maximum Link Width fields instead of custom masking and shifting. Signed-off-by: Ilpo J=C3=A4rvinen Reviewed-by: Jonathan Cameron --- drivers/pci/pci-sysfs.c | 5 ++--- drivers/pci/pci.c | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index d9eede2dbc0e..5a6241044c3c 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c @@ -12,7 +12,7 @@ * Modeled after usb's driverfs.c */ =20 - +#include #include #include #include @@ -230,8 +230,7 @@ static ssize_t current_link_width_show(struct device *d= ev, if (err) return -EINVAL; =20 - return sysfs_emit(buf, "%u\n", - (linkstat & PCI_EXP_LNKSTA_NLW) >> PCI_EXP_LNKSTA_NLW_SHIFT); + return sysfs_emit(buf, "%u\n", FIELD_GET(PCI_EXP_LNKSTA_NLW, linkstat)); } static DEVICE_ATTR_RO(current_link_width); =20 diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 59c01d68c6d5..a8adc34dc86f 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -9,6 +9,7 @@ */ =20 #include +#include #include #include #include @@ -6257,8 +6258,7 @@ u32 pcie_bandwidth_available(struct pci_dev *dev, str= uct pci_dev **limiting_dev, pcie_capability_read_word(dev, PCI_EXP_LNKSTA, &lnksta); =20 next_speed =3D pcie_link_speed[lnksta & PCI_EXP_LNKSTA_CLS]; - next_width =3D (lnksta & PCI_EXP_LNKSTA_NLW) >> - PCI_EXP_LNKSTA_NLW_SHIFT; + next_width =3D FIELD_GET(PCI_EXP_LNKSTA_NLW, lnksta); =20 next_bw =3D next_width * PCIE_SPEED2MBS_ENC(next_speed); =20 @@ -6330,7 +6330,7 @@ enum pcie_link_width pcie_get_width_cap(struct pci_de= v *dev) =20 pcie_capability_read_dword(dev, PCI_EXP_LNKCAP, &lnkcap); if (lnkcap) - return (lnkcap & PCI_EXP_LNKCAP_MLW) >> 4; + return FIELD_GET(PCI_EXP_LNKCAP_MLW, lnkcap); =20 return PCIE_LNK_WIDTH_UNKNOWN; } --=20 2.30.2 From nobody Thu Dec 18 19:05:47 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 619BCCA0EC6 for ; Mon, 11 Sep 2023 21:16:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242015AbjIKVHW (ORCPT ); Mon, 11 Sep 2023 17:07:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237222AbjIKMPl (ORCPT ); Mon, 11 Sep 2023 08:15:41 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F40FFCEB; Mon, 11 Sep 2023 05:15:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1694434537; x=1725970537; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Iz/TfyVmyYapPX4+HPuAdQeqqvO4j5VMykMoNAn7m90=; b=fyT8/svE9J9rmAYFmQZkpPGNAK6F8/XQhAkOM1C34UNAj4xGWJie6sb9 4+0A2E+R1H2PrvimTxR5LoeYY+DUwC0ILRVQvbjbXF3LMHfuGmFjiVX0E +bnuQTIzuZlECgPYWJW4Sf+3c0ZEmKi5IdKVIKHL1PXTykRU/Nm0eGg7L FlQgZqnz7l9m03YTJEItsc9LA/SWeBtT62yIUAAhHzQbCnjmqCGLLy5mJ 7LsVj8Yq6nzSVEYI3YyRC02EptG2noeKaPVY3TTb5OnKG5CfMZI95VJkn OtmOHGG9fUb/qAavR1S7qz5ONFH2kSpHXFfoKTeH3Jap7ExGJ/fT37BMZ g==; X-IronPort-AV: E=McAfee;i="6600,9927,10830"; a="381863579" X-IronPort-AV: E=Sophos;i="6.02,244,1688454000"; d="scan'208";a="381863579" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2023 05:15:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10830"; a="746383365" X-IronPort-AV: E=Sophos;i="6.02,244,1688454000"; d="scan'208";a="746383365" Received: from mzarkov-mobl3.ger.corp.intel.com (HELO ijarvine-mobl2.ger.corp.intel.com) ([10.252.36.200]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2023 05:15:34 -0700 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= To: linux-pci@vger.kernel.org, Bjorn Helgaas , Bradley Grove , "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Subject: [PATCH 7/8] scsi: esas2r: Use FIELD_GET() to extract Link Width Date: Mon, 11 Sep 2023 15:15:00 +0300 Message-Id: <20230911121501.21910-8-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230911121501.21910-1-ilpo.jarvinen@linux.intel.com> References: <20230911121501.21910-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use FIELD_GET() to extract PCIe Negotiated and Maximum Link Width fields instead of custom masking and shifting. Signed-off-by: Ilpo J=C3=A4rvinen Reviewed-by: Jonathan Cameron --- drivers/scsi/esas2r/esas2r_ioctl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/esas2r/esas2r_ioctl.c b/drivers/scsi/esas2r/esas2= r_ioctl.c index 055d2e87a2c8..3252780fd099 100644 --- a/drivers/scsi/esas2r/esas2r_ioctl.c +++ b/drivers/scsi/esas2r/esas2r_ioctl.c @@ -41,6 +41,8 @@ * USA. */ =20 +#include + #include "esas2r.h" =20 /* @@ -797,11 +799,9 @@ static int hba_ioctl_callback(struct esas2r_adapter *a, gai->pci.link_speed_max =3D (u8)(caps & PCI_EXP_LNKCAP_SLS); gai->pci.link_width_curr =3D - (u8)((stat & PCI_EXP_LNKSTA_NLW) - >> PCI_EXP_LNKSTA_NLW_SHIFT); + (u8)FIELD_GET(PCI_EXP_LNKSTA_NLW, stat); gai->pci.link_width_max =3D - (u8)((caps & PCI_EXP_LNKCAP_MLW) - >> 4); + (u8)FIELD_GET(PCI_EXP_LNKCAP_MLW, caps); } =20 gai->pci.msi_vector_cnt =3D 1; --=20 2.30.2 From nobody Thu Dec 18 19:05:47 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8B6EACA0EDE for ; Mon, 11 Sep 2023 22:16:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358497AbjIKWL3 (ORCPT ); Mon, 11 Sep 2023 18:11:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237228AbjIKMPp (ORCPT ); Mon, 11 Sep 2023 08:15:45 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BABC198; Mon, 11 Sep 2023 05:15:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1694434541; x=1725970541; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=PSuO90qdNTyz15lAqW8X8DjHjSx7W+4UYOBcDEz33uM=; b=AW5IVT+blUQ9HTa14kLKxgWONaiia9Y4mhETVMty1F0btvv7SZQyelc6 6QjJaYwz0b24F+VhIAl3Qni73UgpFRQT9+fwE6XlLQ7gl8+Jirda5zkmz cI1xdrxdgaUxrt85STTu7N0LWknjb64UFXNlXtqPl7blDFHfL2tWOzyv9 ZabNEN08hiQOOkxb7R7Mow8L6U/DPuY1RTvgyrhdFSD2ynfuO8WH2a6N6 b9UgYIyXBJcfYPwGTxuQ577b7sA1MWYFj4D/cz7+WoHV9SH/p8Jj5wsu7 0O3EH3XIVcJi/FpEFv//h+RTMD09d5WbixmCK2V0TNOngEcu+5WtB/vZe Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10830"; a="381863606" X-IronPort-AV: E=Sophos;i="6.02,244,1688454000"; d="scan'208";a="381863606" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2023 05:15:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10830"; a="746383382" X-IronPort-AV: E=Sophos;i="6.02,244,1688454000"; d="scan'208";a="746383382" Received: from mzarkov-mobl3.ger.corp.intel.com (HELO ijarvine-mobl2.ger.corp.intel.com) ([10.252.36.200]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2023 05:15:37 -0700 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= To: linux-pci@vger.kernel.org, Bjorn Helgaas , Nilesh Javali , GR-QLogic-Storage-Upstream@marvell.com, "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Subject: [PATCH 8/8] scsi: qla2xxx: Use FIELD_GET() to extract Link Width Date: Mon, 11 Sep 2023 15:15:01 +0300 Message-Id: <20230911121501.21910-9-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230911121501.21910-1-ilpo.jarvinen@linux.intel.com> References: <20230911121501.21910-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use FIELD_GET() to extract PCIe Maximum Link Width field instead of custom masking and shifting. Signed-off-by: Ilpo J=C3=A4rvinen Reviewed-by: Jonathan Cameron --- drivers/scsi/qla2xxx/qla_os.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 877e4f446709..0c97a5e4249c 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -5,6 +5,7 @@ */ #include "qla_def.h" =20 +#include #include #include #include @@ -632,7 +633,7 @@ qla24xx_pci_info_str(struct scsi_qla_host *vha, char *s= tr, size_t str_len) =20 pcie_capability_read_dword(ha->pdev, PCI_EXP_LNKCAP, &lstat); lspeed =3D lstat & PCI_EXP_LNKCAP_SLS; - lwidth =3D (lstat & PCI_EXP_LNKCAP_MLW) >> 4; + lwidth =3D FIELD_GET(PCI_EXP_LNKCAP_MLW, lstat); =20 switch (lspeed) { case 1: --=20 2.30.2