PCI/PME: Use FIELD_GET()
authorBjorn Helgaas <bhelgaas@google.com>
Tue, 10 Oct 2023 20:44:33 +0000 (15:44 -0500)
committerBjorn Helgaas <bhelgaas@google.com>
Tue, 24 Oct 2023 21:55:45 +0000 (16:55 -0500)
Use FIELD_GET() to remove dependences on the field position, i.e., the
shift value.  No functional change intended.

Link: https://lore.kernel.org/r/20231010204436.1000644-8-helgaas@kernel.org
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
drivers/pci/pcie/pme.c
include/uapi/linux/pci_regs.h

index ef8ce436ead9f57513d1084696a87080609e40eb..a2daebd9806cd7273ee331406201402a758bd7b8 100644 (file)
@@ -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;
index 4f226db4c1dcef2e4c76df5f27be7987266f69c6..532d30770ee528e7aadf809f7712dd9aeeb01052 100644 (file)
 #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 */
 /*