From nobody Mon Sep 16 19:11:40 2024 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 5BE41CD5BB5 for ; Tue, 19 Sep 2023 12:57:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232287AbjISM5T (ORCPT ); Tue, 19 Sep 2023 08:57:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232274AbjISM5M (ORCPT ); Tue, 19 Sep 2023 08:57:12 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F11EC100; Tue, 19 Sep 2023 05:57:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695128226; x=1726664226; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=18aFroto8Vn4Wr+B5/QY6/GQzHDjqYXfhTGNDl0rREc=; b=CsbHEwLuY82qlmL6G2oOkGcI11Dbt3ugRfo9ue7Bo1RIH2WC/9QL4g+m 5qAeOX5+xIhYuj9PtxlkzqyFScBBKc0DpNC8I0jsWuDSuB8AW2KSO7qfg vSL1ocA22cliNfGbRCKK901+cbiyhKrRq8dejNb4ivLdEGMYZA1Xvz5wO 5NmU01dWnGASJolzZmmJQOsdROwQZR00L53UzX8/SqMZIGz0+IKIVxl+C uF8zVg0SnHn26b3FoeQxSc2ldf/3MALE/w37MPmwm0O2z5OVcXYa1h5Q7 sMGN8UJNQVTGKGujIhppQqsf38sW6BISTshuypQG4cW5FPBt2K2lcpfzf w==; X-IronPort-AV: E=McAfee;i="6600,9927,10838"; a="359324612" X-IronPort-AV: E=Sophos;i="6.02,159,1688454000"; d="scan'208";a="359324612" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Sep 2023 05:57:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10838"; a="746228692" X-IronPort-AV: E=Sophos;i="6.02,159,1688454000"; d="scan'208";a="746228692" Received: from vdesserx-mobl1.ger.corp.intel.com (HELO localhost.localdomain) ([10.249.32.31]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Sep 2023 05:57:01 -0700 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= To: Bjorn Helgaas , linux-pci@vger.kernel.org, Jonathan Cameron , 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 v3 1/8] RDMA/hfi1: Use FIELD_GET() to extract Link Width Date: Tue, 19 Sep 2023 15:56:41 +0300 Message-Id: <20230919125648.1920-2-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230919125648.1920-1-ilpo.jarvinen@linux.intel.com> References: <20230919125648.1920-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, and remove extract_width() which only wraps that FIELD_GET(). Signed-off-by: Ilpo J=C3=A4rvinen Reviewed-by: Jonathan Cameron Reviewed-by: Dean Luick --- drivers/infiniband/hw/hfi1/pcie.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/infiniband/hw/hfi1/pcie.c b/drivers/infiniband/hw/hfi1= /pcie.c index 08732e1ac966..c132a9c073bf 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,12 +211,6 @@ static u32 extract_speed(u16 linkstat) return speed; } =20 -/* return the PCIe link speed from the given link status */ -static u32 extract_width(u16 linkstat) -{ - return (linkstat & PCI_EXP_LNKSTA_NLW) >> PCI_EXP_LNKSTA_NLW_SHIFT; -} - /* read the link status and set dd->{lbus_width,lbus_speed,lbus_info} */ static void update_lbus_info(struct hfi1_devdata *dd) { @@ -228,7 +223,7 @@ static void update_lbus_info(struct hfi1_devdata *dd) return; } =20 - dd->lbus_width =3D extract_width(linkstat); + dd->lbus_width =3D FIELD_GET(PCI_EXP_LNKSTA_NLW, linkstat); dd->lbus_speed =3D extract_speed(linkstat); snprintf(dd->lbus_info, sizeof(dd->lbus_info), "PCIe,%uMHz,x%u", dd->lbus_speed, dd->lbus_width); --=20 2.30.2