Thread (68 messages) flat view 68 messages, 5 authors, 2025-05-21

Re: [PATCH v6 04/16] PCI/AER: Extract bus/dev/fn in aer_print_port_info() with PCI_BUS_NUM(), etc

From: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@linux.intel.com>
Date: 2025-05-19 23:47:19
Also in: linux-pci, lkml

On 5/19/25 2:35 PM, Bjorn Helgaas wrote:
From: Bjorn Helgaas <bhelgaas@google.com>

Use PCI_BUS_NUM(), PCI_SLOT(), PCI_FUNC() to extract the bus number,
device, and function number directly from the Error Source ID.  There's no
need to shift and mask it explicitly.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
quoted hunk ↗ jump to hunk
  drivers/pci/pcie/aer.c | 7 +++----
  1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c
index b8494ccd935b..dc8a50e0a2b7 100644
--- a/drivers/pci/pcie/aer.c
+++ b/drivers/pci/pcie/aer.c
@@ -736,14 +736,13 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info)
  static void aer_print_port_info(struct pci_dev *dev, struct aer_err_info *info,
  				const char *details)
  {
-	u8 bus = info->id >> 8;
-	u8 devfn = info->id & 0xff;
+	u16 source = info->id;
  
  	pci_info(dev, "%s%s error message received from %04x:%02x:%02x.%d%s\n",
Since it is used in many places in PCI driver, may be define

#define PCI_ADDR_FMT "%04x:%02x:%02x.%d"
  		 info->multi_error_valid ? "Multiple " : "",
  		 aer_error_severity_string[info->severity],
-		 pci_domain_nr(dev->bus), bus, PCI_SLOT(devfn),
-		 PCI_FUNC(devfn), details);
+		 pci_domain_nr(dev->bus), PCI_BUS_NUM(source),
+		 PCI_SLOT(source), PCI_FUNC(source), details);
  }
  
  #ifdef CONFIG_ACPI_APEI_PCIEAER
-- 
Sathyanarayanan Kuppuswamy
Linux Kernel Developer

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help