From mboxrd@z Thu Jan 1 00:00:00 1970 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 9F5B6C00141 for ; Tue, 7 Nov 2023 16:04:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343495AbjKGQEZ (ORCPT ); Tue, 7 Nov 2023 11:04:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235338AbjKGQD1 (ORCPT ); Tue, 7 Nov 2023 11:03:27 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91707385F; Tue, 7 Nov 2023 07:54:35 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 37604C433CA; Tue, 7 Nov 2023 15:54:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1699372475; bh=AItuZb+SXkbKmApNqTYCd4YMjP51UQDwlL7rRwb4iHM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uPi7nA3W99BpjIN5CL6xYTYVk99lkWw0RI4HAMv+P8gnyNYhSZ6ddHcS7UpcM/Quw Y4JIOcv7G2+i70UZYcjN/G1HtYPmSshOVwQGQDixsB0ufb8QezNTsUQl8ZsIH2Nu6n gpIRhq3MSeQPmXZXJslWPPwgVxG1If0tEIwhXjo52KAUFSUHo4GwKeEw5BGJjKGTCt Yg2Q6OUwQlOXOkx5N8F/zInXy+H20BLBfC45/ZdQo3NUCqYTS4gGFKPl7KcyImyAdo oyuRL7Np36BjH2ymMLMCQl9w9tGNGl/EPwyiE1eQOdnmNY8bpAbQ7mGPC8b40QR+5J NQaqhsKsZG3gQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Jonathan Cameron , Dean Luick , Leon Romanovsky , Sasha Levin , dennis.dalessandro@cornelisnetworks.com, linux-rdma@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 02/11] RDMA/hfi1: Use FIELD_GET() to extract Link Width Date: Tue, 7 Nov 2023 10:54:10 -0500 Message-ID: <20231107155430.3768779-2-sashal@kernel.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231107155430.3768779-1-sashal@kernel.org> References: <20231107155430.3768779-1-sashal@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 4.19.297 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Ilpo Järvinen [ Upstream commit 8bf7187d978610b9e327a3d92728c8864a575ebd ] 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ärvinen Link: https://lore.kernel.org/r/20230919125648.1920-2-ilpo.jarvinen@linux.intel.com Reviewed-by: Jonathan Cameron Reviewed-by: Dean Luick Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin --- 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 a8dd12e525f81..e1b6da7775584 100644 --- a/drivers/infiniband/hw/hfi1/pcie.c +++ b/drivers/infiniband/hw/hfi1/pcie.c @@ -45,6 +45,7 @@ * */ +#include #include #include #include @@ -273,12 +274,6 @@ static u32 extract_speed(u16 linkstat) return speed; } -/* 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) { @@ -291,7 +286,7 @@ static void update_lbus_info(struct hfi1_devdata *dd) return; } - dd->lbus_width = extract_width(linkstat); + dd->lbus_width = FIELD_GET(PCI_EXP_LNKSTA_NLW, linkstat); dd->lbus_speed = extract_speed(linkstat); snprintf(dd->lbus_info, sizeof(dd->lbus_info), "PCIe,%uMHz,x%u", dd->lbus_speed, dd->lbus_width); -- 2.42.0