From nobody Wed Dec 17 16:09:35 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 35472C05052 for ; Fri, 18 Aug 2023 07:28:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358184AbjHRH23 (ORCPT ); Fri, 18 Aug 2023 03:28:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358229AbjHRH1r (ORCPT ); Fri, 18 Aug 2023 03:27:47 -0400 X-Greylist: delayed 63 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Fri, 18 Aug 2023 00:27:43 PDT Received: from outboundhk.mxmail.xiaomi.com (outboundhk.mxmail.xiaomi.com [207.226.244.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B833D30F1; Fri, 18 Aug 2023 00:27:43 -0700 (PDT) X-IronPort-AV: E=Sophos;i="6.01,182,1684771200"; d="scan'208";a="87750283" From: =?gb2312?B?u8bJ2bKo?= To: Bjorn Helgaas , Thomas Gleixner , "Ahmed S. Darwish" , Jason Gunthorpe , Kevin Tian , "linux-pci@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: =?gb2312?B?wO6438X0?= , =?gb2312?B?wbrOsMX0?= , =?gb2312?B?zsy98LfJ?= , =?gb2312?B?0NzBwQ==?= Subject: Subject: [PATCH] pci/msi: remove redundant calculation in msi_setup_msi_desc Thread-Topic: Subject: [PATCH] pci/msi: remove redundant calculation in msi_setup_msi_desc Thread-Index: AdnRpKW3tDXXI46aR/+qEejYHxfxLQ== Date: Fri, 18 Aug 2023 07:26:38 +0000 Message-ID: <3ebf5d8032ad418da4f24516cd23406e@xiaomi.com> Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.237.8.11] Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Whether to support 64-bit address status has been calculated before, and the calculation result can be used directly afterwards, so use msi_attrib.is_64 to avoid double calculation. Suggested-by: weipengliang Signed-off-by: sparkhuang Reviewed-by: Ilpo J=C3=A4rvinen --- drivers/pci/msi/msi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/msi/msi.c b/drivers/pci/msi/msi.c index ef1d885..304e889 100644 --- a/drivers/pci/msi/msi.c +++ b/drivers/pci/msi/msi.c @@ -303,7 +303,7 @@ static int msi_setup_msi_desc(struct pci_dev *dev, int = nvec, desc.pci.msi_attrib.multiple =3D ilog2(__roundup_pow_of_two(nvec= )); desc.affinity =3D masks; - if (control & PCI_MSI_FLAGS_64BIT) + if (desc.pci.msi_attrib.is_64) desc.pci.mask_pos =3D dev->msi_cap + PCI_MSI_MASK_64; else desc.pci.mask_pos =3D dev->msi_cap + PCI_MSI_MASK_32; -- 2.7.4 #/******=E6=9C=AC=E9=82=AE=E4=BB=B6=E5=8F=8A=E5=85=B6=E9=99=84=E4=BB=B6=E5= =90=AB=E6=9C=89=E5=B0=8F=E7=B1=B3=E5=85=AC=E5=8F=B8=E7=9A=84=E4=BF=9D=E5=AF= =86=E4=BF=A1=E6=81=AF=EF=BC=8C=E4=BB=85=E9=99=90=E4=BA=8E=E5=8F=91=E9=80=81= =E7=BB=99=E4=B8=8A=E9=9D=A2=E5=9C=B0=E5=9D=80=E4=B8=AD=E5=88=97=E5=87=BA=E7= =9A=84=E4=B8=AA=E4=BA=BA=E6=88=96=E7=BE=A4=E7=BB=84=E3=80=82=E7=A6=81=E6=AD= =A2=E4=BB=BB=E4=BD=95=E5=85=B6=E4=BB=96=E4=BA=BA=E4=BB=A5=E4=BB=BB=E4=BD=95= =E5=BD=A2=E5=BC=8F=E4=BD=BF=E7=94=A8=EF=BC=88=E5=8C=85=E6=8B=AC=E4=BD=86=E4= =B8=8D=E9=99=90=E4=BA=8E=E5=85=A8=E9=83=A8=E6=88=96=E9=83=A8=E5=88=86=E5=9C= =B0=E6=B3=84=E9=9C=B2=E3=80=81=E5=A4=8D=E5=88=B6=E3=80=81=E6=88=96=E6=95=A3= =E5=8F=91=EF=BC=89=E6=9C=AC=E9=82=AE=E4=BB=B6=E4=B8=AD=E7=9A=84=E4=BF=A1=E6= =81=AF=E3=80=82=E5=A6=82=E6=9E=9C=E6=82=A8=E9=94=99=E6=94=B6=E4=BA=86=E6=9C= =AC=E9=82=AE=E4=BB=B6=EF=BC=8C=E8=AF=B7=E6=82=A8=E7=AB=8B=E5=8D=B3=E7=94=B5= =E8=AF=9D=E6=88=96=E9=82=AE=E4=BB=B6=E9=80=9A=E7=9F=A5=E5=8F=91=E4=BB=B6=E4= =BA=BA=E5=B9=B6=E5=88=A0=E9=99=A4=E6=9C=AC=E9=82=AE=E4=BB=B6=EF=BC=81 This = e-mail and its attachments contain confidential information from XIAOMI, wh= ich is intended only for the person or entity whose address is listed above= . Any use of the information contained herein in any way (including, but no= t limited to, total or partial disclosure, reproduction, or dissemination) = by persons other than the intended recipient(s) is prohibited. If you recei= ve this e-mail in error, please notify the sender by phone or email immedia= tely and delete it!******/#