From: Bjorn Helgaas Date: Thu, 22 May 2025 23:21:11 +0000 (-0500) Subject: PCI/AER: Extract bus/dev/fn in aer_print_port_info() with PCI_BUS_NUM(), etc X-Git-Tag: v6.16-rc1~50^2~26^2~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f40bd2865501437bf5dfc7167be7b5c8f536b323;p=thirdparty%2Fkernel%2Fstable.git PCI/AER: Extract bus/dev/fn in aer_print_port_info() with PCI_BUS_NUM(), etc 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 Tested-by: Krzysztof Wilczyński Reviewed-by: Kuppuswamy Sathyanarayanan Reviewed-by: Ilpo Järvinen Reviewed-by: Jonathan Cameron Link: https://patch.msgid.link/20250522232339.1525671-6-helgaas@kernel.org --- diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c index fe6d323306a0d..18005615d3762 100644 --- a/drivers/pci/pcie/aer.c +++ b/drivers/pci/pcie/aer.c @@ -736,14 +736,14 @@ out: static void aer_print_port_info(struct pci_dev *dev, struct aer_err_info *info, bool found) { - 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", info->multi_error_valid ? "Multiple " : "", aer_error_severity_string[info->severity], - pci_domain_nr(dev->bus), bus, PCI_SLOT(devfn), - PCI_FUNC(devfn), found ? "" : " (no details found"); + pci_domain_nr(dev->bus), PCI_BUS_NUM(source), + PCI_SLOT(source), PCI_FUNC(source), + found ? "" : " (no details found"); } #ifdef CONFIG_ACPI_APEI_PCIEAER