These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / arch / s390 / pci / pci_sysfs.c
index fa3ce89..f37a580 100644 (file)
@@ -16,7 +16,7 @@
 static ssize_t name##_show(struct device *dev,                         \
                           struct device_attribute *attr, char *buf)    \
 {                                                                      \
-       struct zpci_dev *zdev = get_zdev(to_pci_dev(dev));              \
+       struct zpci_dev *zdev = to_zpci(to_pci_dev(dev));               \
                                                                        \
        return sprintf(buf, fmt, zdev->member);                         \
 }                                                                      \
@@ -38,23 +38,30 @@ static ssize_t recover_store(struct device *dev, struct device_attribute *attr,
                             const char *buf, size_t count)
 {
        struct pci_dev *pdev = to_pci_dev(dev);
-       struct zpci_dev *zdev = get_zdev(pdev);
+       struct zpci_dev *zdev = to_zpci(pdev);
        int ret;
 
        if (!device_remove_file_self(dev, attr))
                return count;
 
+       pci_lock_rescan_remove();
        pci_stop_and_remove_bus_device(pdev);
        ret = zpci_disable_device(zdev);
        if (ret)
-               return ret;
+               goto error;
 
        ret = zpci_enable_device(zdev);
        if (ret)
-               return ret;
+               goto error;
 
        pci_rescan_bus(zdev->bus);
+       pci_unlock_rescan_remove();
+
        return count;
+
+error:
+       pci_unlock_rescan_remove();
+       return ret;
 }
 static DEVICE_ATTR_WO(recover);
 
@@ -64,7 +71,7 @@ static ssize_t util_string_read(struct file *filp, struct kobject *kobj,
 {
        struct device *dev = kobj_to_dev(kobj);
        struct pci_dev *pdev = to_pci_dev(dev);
-       struct zpci_dev *zdev = get_zdev(pdev);
+       struct zpci_dev *zdev = to_zpci(pdev);
 
        return memory_read_from_buffer(buf, count, &off, zdev->util_str,
                                       sizeof(zdev->util_str));