Message ID | 20231010204436.1000644-8-helgaas@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp127578vqb; Tue, 10 Oct 2023 13:46:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGd0vJBVeXuszRPeBCl6yCsQq2YbDSV3Vm4y4FQ+AZsSQBiHqkzoFNCJN+0jdP1/13X9UL8 X-Received: by 2002:a17:902:d4cd:b0:1bb:9e6e:a9f3 with SMTP id o13-20020a170902d4cd00b001bb9e6ea9f3mr21889349plg.4.1696970761138; Tue, 10 Oct 2023 13:46:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696970761; cv=none; d=google.com; s=arc-20160816; b=WjME6JVfCn5uPebB2XgO3O9jKAFMraR5fovyTgAxNuHRlXegdU3PoA9cH5bgLnAbxm YCSApuTZXUcB8G+D6khSLy0p0f6sBq7wj8UGTvDKYjssV18QdXVX0PtsfRgdwpEEenwC lZE1sKbWZEgIrilnMQ6o3jbOSIt3x3eS9xxZsu7yCezuS1SMGjAoxSWm6KelpIuDF5wD 8gA+1xnLWHeBmaRDJBt9LwZgxd0h6xb7+IsqWxbherN+yUjab03i2YeXg+wIahOyvqWE 7uiyGeSiaVWEMrS6ZxMZTc+MWssiorNl7P5bNFdWUBOHmlSEOb7v+NGtVBbQ4auNFpR7 4ecw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ZQomQEH2g/oWXRSN4inbM9bkXTAyoFqm3bzsau2XXuc=; fh=NHi3qEPYLgsH2HTY1wE6PzJ2foGMSCxKLcMZ3DwkN/A=; b=SkL3xFAgWn3tabe5AOckqpELwLD+N7x7wbLLh6u71ESKL7b1AQMcjYeEp3XtOUVXrx OODbriU0+1J6bXd0VFcCBB4Tqe+eNlRV0si9+l95Ah0I5AEA0tz5k312wxZ05SHajdBn A5qKv8QfGfLn2aSUqygXa4o+KoNcck7i9C6Mh/j2Xm6ISQ5HHm89iCtIKT/4IBYIETKU lQUpA97gGESlM92kx/x08ZwCjv+1xYmQZMC+H3X/xcsCG93vvm4YYlOyID7wBTGhfPmB jdHgZ8dDX4JQc6ZW3jvd6aCxGv50lQOWX2iw75C/XaOR/FCnt7wsMynakFLg2tTFe1Ga B0LA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DMAdtbkf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id i17-20020a170902c95100b001b9dda4e1e7si13466826pla.154.2023.10.10.13.46.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 13:46:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DMAdtbkf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id A34BC80BE2D1; Tue, 10 Oct 2023 13:45:57 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234623AbjJJUpP (ORCPT <rfc822;rua109.linux@gmail.com> + 19 others); Tue, 10 Oct 2023 16:45:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234228AbjJJUpC (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 10 Oct 2023 16:45:02 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AEF5999; Tue, 10 Oct 2023 13:45:00 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A1621C433C8; Tue, 10 Oct 2023 20:44:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696970700; bh=SgJRtupS7nAWYb0BB4CUnQ7/s6tkDFcfcPN1MGYpdEo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DMAdtbkfo0lFfisjm0xLwJhX+R52fe8k7WECE9pmsA7xM3yYuTx6kE4Ox1n5qq2fF 0MoMu8wmTgTbx6b+gOg4DLQdAKadVkhaRvJ7T9H8XlMPcy3COgUh8X+4QQPKQoGZ5d cSwmx/IrvM3TfUMYX6ydn4VK53tuLGYsk70KpB42F9dXJJKmGL2G9EpUpHdz5ne2Rq 88MX9zIiAndMbxwm9RtoKbQlDKXxJtGR6HQ9Gq95ShgoxWL44sTHPK1kgUJD2ZW7Cq m+D/wkYmUbb2f972cZEIGm2JfWT5H9O/SCaGmrW0e6SiSVR3wO4HovWmFolu1bquNU 3oFM+qUicDxqA== From: Bjorn Helgaas <helgaas@kernel.org> To: linux-pci@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= <ilpo.jarvinen@linux.intel.com>, Jonathan Cameron <Jonathan.Cameron@huawei.com>, =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= <kw@linux.com>, Lorenzo Pieralisi <lpieralisi@kernel.org>, linux-kernel@vger.kernel.org, Bjorn Helgaas <bhelgaas@google.com> Subject: [PATCH 07/10] PCI/PME: Use FIELD_GET() Date: Tue, 10 Oct 2023 15:44:33 -0500 Message-Id: <20231010204436.1000644-8-helgaas@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231010204436.1000644-1-helgaas@kernel.org> References: <20231010204436.1000644-1-helgaas@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=2.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Tue, 10 Oct 2023 13:45:57 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779402812407021580 X-GMAIL-MSGID: 1779402812407021580 |
Series |
PCI: Use FIELD_GET() and FIELD_PREP()
|
|
Commit Message
Bjorn Helgaas
Oct. 10, 2023, 8:44 p.m. UTC
From: Bjorn Helgaas <bhelgaas@google.com> Use FIELD_GET() to remove dependences on the field position, i.e., the shift value. No functional change intended. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> --- drivers/pci/pcie/pme.c | 4 +++- include/uapi/linux/pci_regs.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-)
Comments
On Tue, 10 Oct 2023 15:44:33 -0500 Bjorn Helgaas <helgaas@kernel.org> wrote: > From: Bjorn Helgaas <bhelgaas@google.com> > > Use FIELD_GET() to remove dependences on the field position, i.e., the > shift value. No functional change intended. > > Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> > --- > drivers/pci/pcie/pme.c | 4 +++- > include/uapi/linux/pci_regs.h | 1 + > 2 files changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/pci/pcie/pme.c b/drivers/pci/pcie/pme.c > index ef8ce436ead9..a2daebd9806c 100644 > --- a/drivers/pci/pcie/pme.c > +++ b/drivers/pci/pcie/pme.c > @@ -9,6 +9,7 @@ > > #define dev_fmt(fmt) "PME: " fmt > > +#include <linux/bitfield.h> > #include <linux/pci.h> > #include <linux/kernel.h> > #include <linux/errno.h> > @@ -235,7 +236,8 @@ static void pcie_pme_work_fn(struct work_struct *work) > pcie_clear_root_pme_status(port); > > spin_unlock_irq(&data->lock); > - pcie_pme_handle_request(port, rtsta & 0xffff); > + pcie_pme_handle_request(port, > + FIELD_GET(PCI_EXP_RTSTA_PME_RQ_ID, rtsta)); > spin_lock_irq(&data->lock); > > continue; > diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h > index e97a06b50f95..9fb8a69241f4 100644 > --- a/include/uapi/linux/pci_regs.h > +++ b/include/uapi/linux/pci_regs.h > @@ -637,6 +637,7 @@ > #define PCI_EXP_RTCAP 0x1e /* Root Capabilities */ > #define PCI_EXP_RTCAP_CRSVIS 0x0001 /* CRS Software Visibility capability */ > #define PCI_EXP_RTSTA 0x20 /* Root Status */ > +#define PCI_EXP_RTSTA_PME_RQ_ID 0x0000ffff /* PME Requester ID */ > #define PCI_EXP_RTSTA_PME 0x00010000 /* PME status */ > #define PCI_EXP_RTSTA_PENDING 0x00020000 /* PME pending */ > /*
On Tue, 10 Oct 2023, Bjorn Helgaas wrote: > From: Bjorn Helgaas <bhelgaas@google.com> > > Use FIELD_GET() to remove dependences on the field position, i.e., the > shift value. No functional change intended. > > Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> > --- > drivers/pci/pcie/pme.c | 4 +++- > include/uapi/linux/pci_regs.h | 1 + > 2 files changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/pci/pcie/pme.c b/drivers/pci/pcie/pme.c > index ef8ce436ead9..a2daebd9806c 100644 > --- a/drivers/pci/pcie/pme.c > +++ b/drivers/pci/pcie/pme.c > @@ -9,6 +9,7 @@ > > #define dev_fmt(fmt) "PME: " fmt > > +#include <linux/bitfield.h> > #include <linux/pci.h> > #include <linux/kernel.h> > #include <linux/errno.h> > @@ -235,7 +236,8 @@ static void pcie_pme_work_fn(struct work_struct *work) > pcie_clear_root_pme_status(port); > > spin_unlock_irq(&data->lock); > - pcie_pme_handle_request(port, rtsta & 0xffff); > + pcie_pme_handle_request(port, > + FIELD_GET(PCI_EXP_RTSTA_PME_RQ_ID, rtsta)); > spin_lock_irq(&data->lock); > > continue; > diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h > index e97a06b50f95..9fb8a69241f4 100644 > --- a/include/uapi/linux/pci_regs.h > +++ b/include/uapi/linux/pci_regs.h > @@ -637,6 +637,7 @@ > #define PCI_EXP_RTCAP 0x1e /* Root Capabilities */ > #define PCI_EXP_RTCAP_CRSVIS 0x0001 /* CRS Software Visibility capability */ > #define PCI_EXP_RTSTA 0x20 /* Root Status */ > +#define PCI_EXP_RTSTA_PME_RQ_ID 0x0000ffff /* PME Requester ID */ > #define PCI_EXP_RTSTA_PME 0x00010000 /* PME status */ > #define PCI_EXP_RTSTA_PENDING 0x00020000 /* PME pending */ Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> (I'd have used REQ myself but it seems both forms are commonly used by the existing defines.)
diff --git a/drivers/pci/pcie/pme.c b/drivers/pci/pcie/pme.c index ef8ce436ead9..a2daebd9806c 100644 --- a/drivers/pci/pcie/pme.c +++ b/drivers/pci/pcie/pme.c @@ -9,6 +9,7 @@ #define dev_fmt(fmt) "PME: " fmt +#include <linux/bitfield.h> #include <linux/pci.h> #include <linux/kernel.h> #include <linux/errno.h> @@ -235,7 +236,8 @@ static void pcie_pme_work_fn(struct work_struct *work) pcie_clear_root_pme_status(port); spin_unlock_irq(&data->lock); - pcie_pme_handle_request(port, rtsta & 0xffff); + pcie_pme_handle_request(port, + FIELD_GET(PCI_EXP_RTSTA_PME_RQ_ID, rtsta)); spin_lock_irq(&data->lock); continue; diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h index e97a06b50f95..9fb8a69241f4 100644 --- a/include/uapi/linux/pci_regs.h +++ b/include/uapi/linux/pci_regs.h @@ -637,6 +637,7 @@ #define PCI_EXP_RTCAP 0x1e /* Root Capabilities */ #define PCI_EXP_RTCAP_CRSVIS 0x0001 /* CRS Software Visibility capability */ #define PCI_EXP_RTSTA 0x20 /* Root Status */ +#define PCI_EXP_RTSTA_PME_RQ_ID 0x0000ffff /* PME Requester ID */ #define PCI_EXP_RTSTA_PME 0x00010000 /* PME status */ #define PCI_EXP_RTSTA_PENDING 0x00020000 /* PME pending */ /*