Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3579999rdb; Wed, 13 Sep 2023 17:12:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFdJkffkE8MPCgnA8tuF73wE1rA9N/TuJrqQ3eSc6Fb6bJ9cDfbFJF5mmUOs1ZZVCmzMyYt X-Received: by 2002:a17:902:e88f:b0:1c3:8dbe:aecb with SMTP id w15-20020a170902e88f00b001c38dbeaecbmr4551941plg.2.1694650356411; Wed, 13 Sep 2023 17:12:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694650356; cv=none; d=google.com; s=arc-20160816; b=wW58yCoRxoyw9Uw9Xrap4T0Tg6KbaDYzP0shVUfP1M9HvAdlTvstDH6vyXUKJQ1Txu wBEXFXJk2JK12+WlZ939sLyAhrDT7arc/hoBpI6H+vxJd6qqAiWOz0oynb0DZDICrnZe S/0MCPNpOjBXhcwjHCVEF/J39K/kloOntbsXOCj4ClfcsqfQmB25IfThIHZ48D0CV2zn fccCfCO7EjYe6A8KHgxNJu3WZsPDfK2n8xzWIp8UWBvZOEdFqyz616BLuJv9e2Mv6bVL q5t25G4VxjPQkXmlRldH5ok6r7dD1y0nQVws7kmX7x7XuNsNUcssnKzLHwUzAenoFVBN ztKA== 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 :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=MdSkBisnfF0GHRAYkqANyER1uc8h98t6DbPRdreHHJI=; fh=mWB+hmxahH53VHL3rd+VQLJ6j8IKZeVO0IfR4CLIDJg=; b=L5qoTysrHPD+eDN3h+jXGAZFt3M8CFJO3mPs8eB7YTxSjZePsOEATHolSxaoZm9XwO MITGVypGEjTY6mzL/oX40CHJFbGJzmIAmR78zpziK++niflROfjNyEKHHwgdVY7VbEqG 1+LTfssKMlfRZw9hR54mTvHpnhQia+FniTLnh0/jwTcJksmExZGPlL9tUQuhKxqxFH4Y gJu4XMEQbHn/ob6Szo5N8TwQoY3hhRNO7uYBKWPSHLqaXk9cbCtH0rXD8sdM00RXuNAU CHw7lPKXWJTcHKFqE9kUexcRqSu8glqBaKGlYObjRyNTfZkElX/gZVzPYHSJLAg9T8TX FOsg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id u4-20020a170902e80400b001bda57935fasi473777plg.64.2023.09.13.17.12.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 17:12:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id F3C4280425BC; Wed, 13 Sep 2023 06:15:40 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240834AbjIMNPh convert rfc822-to-8bit (ORCPT + 99 others); Wed, 13 Sep 2023 09:15:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240817AbjIMNPf (ORCPT ); Wed, 13 Sep 2023 09:15:35 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7ADF419BF; Wed, 13 Sep 2023 06:15:31 -0700 (PDT) Received: from lhrpeml500005.china.huawei.com (unknown [172.18.147.200]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4Rm16L129gz6D9BZ; Wed, 13 Sep 2023 21:10:50 +0800 (CST) Received: from localhost (10.202.227.76) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Wed, 13 Sep 2023 14:15:29 +0100 Date: Wed, 13 Sep 2023 14:15:28 +0100 From: Jonathan Cameron To: Ilpo =?ISO-8859-1?Q?J=E4rvinen?= CC: , Bjorn Helgaas , "Bradley Grove" , "James E.J. Bottomley" , "Martin K. Petersen" , , Subject: Re: [PATCH v2 07/10] scsi: esas2r: Use FIELD_GET() to extract PCIe capability fields Message-ID: <20230913141528.00000781@Huawei.com> In-Reply-To: <20230913122748.29530-8-ilpo.jarvinen@linux.intel.com> References: <20230913122748.29530-1-ilpo.jarvinen@linux.intel.com> <20230913122748.29530-8-ilpo.jarvinen@linux.intel.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8BIT X-Originating-IP: [10.202.227.76] X-ClientProxiedBy: lhrpeml500005.china.huawei.com (7.191.163.240) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 13 Sep 2023 06:15:41 -0700 (PDT) On Wed, 13 Sep 2023 15:27:45 +0300 Ilpo J?rvinen wrote: > Use FIELD_GET() to extract PCIe capability register fields instead of > custom masking and shifting. Also remove the unnecessary cast to u8, > the value in those fields always fits to u8. > > Signed-off-by: Ilpo J?rvinen Reviewed-by: Jonathan Cameron > --- > drivers/scsi/esas2r/esas2r_ioctl.c | 16 ++++++---------- > 1 file changed, 6 insertions(+), 10 deletions(-) > > diff --git a/drivers/scsi/esas2r/esas2r_ioctl.c b/drivers/scsi/esas2r/esas2r_ioctl.c > index 055d2e87a2c8..3f7c1d131ec3 100644 > --- a/drivers/scsi/esas2r/esas2r_ioctl.c > +++ b/drivers/scsi/esas2r/esas2r_ioctl.c > @@ -41,6 +41,8 @@ > * USA. > */ > > +#include > + > #include "esas2r.h" > > /* > @@ -792,16 +794,10 @@ static int hba_ioctl_callback(struct esas2r_adapter *a, > pcie_capability_read_dword(a->pcid, PCI_EXP_LNKCAP, > &caps); > > - gai->pci.link_speed_curr = > - (u8)(stat & PCI_EXP_LNKSTA_CLS); > - 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); > - gai->pci.link_width_max = > - (u8)((caps & PCI_EXP_LNKCAP_MLW) > - >> 4); > + gai->pci.link_speed_curr = FIELD_GET(PCI_EXP_LNKSTA_CLS, stat); > + gai->pci.link_speed_max = FIELD_GET(PCI_EXP_LNKCAP_SLS, caps); > + gai->pci.link_width_curr = FIELD_GET(PCI_EXP_LNKSTA_NLW, stat); > + gai->pci.link_width_max = FIELD_GET(PCI_EXP_LNKCAP_MLW, caps); > } > > gai->pci.msi_vector_cnt = 1;