From patchwork Mon Sep 11 12:15:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ilpo_J=C3=A4rvinen?= X-Patchwork-Id: 13379734 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 421E2EE3F01 for ; Mon, 11 Sep 2023 20:50:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236777AbjIKUuv (ORCPT ); Mon, 11 Sep 2023 16:50:51 -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_J=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_J=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 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@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ärvinen --- 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/esas2r_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. */ +#include + #include "esas2r.h" /* @@ -797,11 +799,9 @@ static int hba_ioctl_callback(struct esas2r_adapter *a, gai->pci.link_speed_max = (u8)(caps & PCI_EXP_LNKCAP_SLS); gai->pci.link_width_curr = - (u8)((stat & PCI_EXP_LNKSTA_NLW) - >> PCI_EXP_LNKSTA_NLW_SHIFT); + (u8)FIELD_GET(PCI_EXP_LNKSTA_NLW, stat); gai->pci.link_width_max = - (u8)((caps & PCI_EXP_LNKCAP_MLW) - >> 4); + (u8)FIELD_GET(PCI_EXP_LNKCAP_MLW, caps); } gai->pci.msi_vector_cnt = 1;