powerpc/eeh: Pass eeh_dev to eeh_ops->restore_config()
authorOliver O'Halloran <oohall@gmail.com>
Sat, 25 Jul 2020 08:12:24 +0000 (18:12 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Sun, 26 Jul 2020 13:34:20 +0000 (23:34 +1000)
Mechanical conversion of the eeh_ops interfaces to use eeh_dev to reference
a specific device rather than pci_dn. No functional changes.

Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20200725081231.39076-7-oohall@gmail.com
arch/powerpc/include/asm/eeh.h
arch/powerpc/kernel/eeh.c
arch/powerpc/kernel/eeh_pe.c
arch/powerpc/platforms/powernv/eeh-powernv.c

index 091d1ed..c23c8fd 100644 (file)
@@ -229,7 +229,7 @@ struct eeh_ops {
        int (*read_config)(struct pci_dn *pdn, int where, int size, u32 *val);
        int (*write_config)(struct pci_dn *pdn, int where, int size, u32 val);
        int (*next_error)(struct eeh_pe **pe);
-       int (*restore_config)(struct pci_dn *pdn);
+       int (*restore_config)(struct eeh_dev *edev);
        int (*notify_resume)(struct pci_dn *pdn);
 };
 
index a4df6f6..1cef0f4 100644 (file)
@@ -726,7 +726,6 @@ static void eeh_disable_and_save_dev_state(struct eeh_dev *edev,
 
 static void eeh_restore_dev_state(struct eeh_dev *edev, void *userdata)
 {
-       struct pci_dn *pdn = eeh_dev_to_pdn(edev);
        struct pci_dev *pdev = eeh_dev_to_pci_dev(edev);
        struct pci_dev *dev = userdata;
 
@@ -734,8 +733,8 @@ static void eeh_restore_dev_state(struct eeh_dev *edev, void *userdata)
                return;
 
        /* Apply customization from firmware */
-       if (pdn && eeh_ops->restore_config)
-               eeh_ops->restore_config(pdn);
+       if (eeh_ops->restore_config)
+               eeh_ops->restore_config(edev);
 
        /* The caller should restore state for the specified device */
        if (pdev != dev)
index 177852e..d71493f 100644 (file)
@@ -843,16 +843,14 @@ static void eeh_restore_device_bars(struct eeh_dev *edev)
  */
 static void eeh_restore_one_device_bars(struct eeh_dev *edev, void *flag)
 {
-       struct pci_dn *pdn = eeh_dev_to_pdn(edev);
-
        /* Do special restore for bridges */
        if (edev->mode & EEH_DEV_BRIDGE)
                eeh_restore_bridge_bars(edev);
        else
                eeh_restore_device_bars(edev);
 
-       if (eeh_ops->restore_config && pdn)
-               eeh_ops->restore_config(pdn);
+       if (eeh_ops->restore_config)
+               eeh_ops->restore_config(edev);
 }
 
 /**
index 8f3a761..a41e67f 100644 (file)
@@ -1619,12 +1619,10 @@ static int pnv_eeh_next_error(struct eeh_pe **pe)
        return ret;
 }
 
-static int pnv_eeh_restore_config(struct pci_dn *pdn)
+static int pnv_eeh_restore_config(struct eeh_dev *edev)
 {
-       struct eeh_dev *edev = pdn_to_eeh_dev(pdn);
        struct pnv_phb *phb;
        s64 ret = 0;
-       int config_addr = (pdn->busno << 8) | (pdn->devfn);
 
        if (!edev)
                return -EEXIST;
@@ -1638,7 +1636,7 @@ static int pnv_eeh_restore_config(struct pci_dn *pdn)
 
        if (ret) {
                pr_warn("%s: Can't reinit PCI dev 0x%x (%lld)\n",
-                       __func__, config_addr, ret);
+                       __func__, edev->bdfn, ret);
                return -EIO;
        }