summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXiongfeng Wang <wangxiongfeng2@huawei.com>2023-08-07 21:48:57 +0800
committerBjorn Helgaas <bhelgaas@google.com>2023-08-07 16:15:18 -0500
commitf7f7c3d61556bb25c8c45c164056533fb2dde867 (patch)
tree238ec6de09c7c348ee80a74269a8eefa1c03cb3e
parentd332642a9821bfab4c0ddf1173e3af40127f0157 (diff)
downloadlinux-stable-f7f7c3d61556bb25c8c45c164056533fb2dde867.tar.gz
linux-stable-f7f7c3d61556bb25c8c45c164056533fb2dde867.tar.bz2
linux-stable-f7f7c3d61556bb25c8c45c164056533fb2dde867.zip
PCI/AER: Use pci_dev_id() to simplify the code
When we have a struct pci_dev *, use pci_dev_id() instead of manually composing the ID with PCI_DEVID() from dev->bus->number and dev->devfn. [bhelgaas: commit log] Link: https://lore.kernel.org/r/20230807134858.116051-3-wangxiongfeng2@huawei.com Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
-rw-r--r--drivers/pci/pcie/aer.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c
index f6c24ded134c..2bc03937452b 100644
--- a/drivers/pci/pcie/aer.c
+++ b/drivers/pci/pcie/aer.c
@@ -712,7 +712,7 @@ static void __aer_print_error(struct pci_dev *dev,
void aer_print_error(struct pci_dev *dev, struct aer_err_info *info)
{
int layer, agent;
- int id = ((dev->bus->number << 8) | dev->devfn);
+ int id = pci_dev_id(dev);
const char *level;
if (!info->status) {
@@ -847,7 +847,7 @@ static bool is_error_source(struct pci_dev *dev, struct aer_err_info *e_info)
if ((PCI_BUS_NUM(e_info->id) != 0) &&
!(dev->bus->bus_flags & PCI_BUS_FLAGS_NO_AERSID)) {
/* Device ID match? */
- if (e_info->id == ((dev->bus->number << 8) | dev->devfn))
+ if (e_info->id == pci_dev_id(dev))
return true;
/* Continue id comparing if there is no multiple error */