Merge tag 'platform-drivers-x86-v4.3-1' of git://git.infradead.org/users/dvhart/linux...
[firefly-linux-kernel-4.4.55.git] / arch / s390 / pci / pci_event.c
index ed2394dd14e92faf57ac34b63ef49731f08ade68..369a3e05d468dbf1973df24c77e4ae07e580c3b6 100644 (file)
@@ -46,15 +46,13 @@ struct zpci_ccdf_avail {
 static void __zpci_event_error(struct zpci_ccdf_err *ccdf)
 {
        struct zpci_dev *zdev = get_zdev_by_fid(ccdf->fid);
+       struct pci_dev *pdev = zdev ? zdev->pdev : NULL;
 
        zpci_err("error CCDF:\n");
        zpci_err_hex(ccdf, sizeof(*ccdf));
 
-       if (!zdev)
-               return;
-
        pr_err("%s: Event 0x%x reports an error for PCI function 0x%x\n",
-              pci_name(zdev->pdev), ccdf->pec, ccdf->fid);
+              pdev ? pci_name(pdev) : "n/a", ccdf->pec, ccdf->fid);
 }
 
 void zpci_event_error(void *data)
@@ -89,7 +87,9 @@ static void __zpci_event_availability(struct zpci_ccdf_avail *ccdf)
                ret = zpci_enable_device(zdev);
                if (ret)
                        break;
+               pci_lock_rescan_remove();
                pci_rescan_bus(zdev->bus);
+               pci_unlock_rescan_remove();
                break;
        case 0x0302: /* Reserved -> Standby */
                if (!zdev)
@@ -97,7 +97,7 @@ static void __zpci_event_availability(struct zpci_ccdf_avail *ccdf)
                break;
        case 0x0303: /* Deconfiguration requested */
                if (pdev)
-                       pci_stop_and_remove_bus_device(pdev);
+                       pci_stop_and_remove_bus_device_locked(pdev);
 
                ret = zpci_disable_device(zdev);
                if (ret)
@@ -114,7 +114,7 @@ static void __zpci_event_availability(struct zpci_ccdf_avail *ccdf)
                        /* Give the driver a hint that the function is
                         * already unusable. */
                        pdev->error_state = pci_channel_io_perm_failure;
-                       pci_stop_and_remove_bus_device(pdev);
+                       pci_stop_and_remove_bus_device_locked(pdev);
                }
 
                zdev->fh = ccdf->fh;