diff options
author | Niklas Schnelle <schnelle@linux.ibm.com> | 2020-11-03 12:41:20 +0300 |
---|---|---|
committer | Heiko Carstens <hca@linux.ibm.com> | 2021-03-22 13:36:04 +0300 |
commit | 2631f6b6f22ca613238a416a09e3d2771def6f88 (patch) | |
tree | 9ab0b08d9edc24ec45b8c4f20a4e3721a77d8ed1 /arch/s390/pci/pci_event.c | |
parent | a4f17cc726712a52122ad38540bc3ff3a052d1a4 (diff) | |
download | linux-2631f6b6f22ca613238a416a09e3d2771def6f88.tar.xz |
s390/pci: unify de-/configure for slots and events
A zPCI event with PEC 0x0301 for an existing zPCI device goes through
the same actions as enable_slot(). Similarly a zPCI event with PEC
0x0303 does the same steps as disable_slot().
We can thus unify both actions as zpci_configure_device() respectively
zpci_deconfigure_device().
Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Diffstat (limited to 'arch/s390/pci/pci_event.c')
-rw-r--r-- | arch/s390/pci/pci_event.c | 44 |
1 files changed, 8 insertions, 36 deletions
diff --git a/arch/s390/pci/pci_event.c b/arch/s390/pci/pci_event.c index 0474ff8c6dbd..2676df9816f0 100644 --- a/arch/s390/pci/pci_event.c +++ b/arch/s390/pci/pci_event.c @@ -98,8 +98,6 @@ static void zpci_event_hard_deconfigured(struct zpci_dev *zdev, u32 fh) static void __zpci_event_availability(struct zpci_ccdf_avail *ccdf) { struct zpci_dev *zdev = get_zdev_by_fid(ccdf->fid); - struct pci_dev *pdev; - int ret; zpci_err("avail CCDF:\n"); zpci_err_hex(ccdf, sizeof(*ccdf)); @@ -113,46 +111,20 @@ static void __zpci_event_availability(struct zpci_ccdf_avail *ccdf) /* the configuration request may be stale */ if (zdev->state != ZPCI_FN_STATE_STANDBY) break; - zdev->fh = ccdf->fh; zdev->state = ZPCI_FN_STATE_CONFIGURED; - ret = zpci_enable_device(zdev); - if (ret) - break; - - /* the PCI function will be scanned once function 0 appears */ - if (!zdev->zbus->bus) - break; - - pdev = pci_scan_single_device(zdev->zbus->bus, zdev->devfn); - if (!pdev) - break; - - pci_bus_add_device(pdev); - pci_lock_rescan_remove(); - pci_bus_add_devices(zdev->zbus->bus); - pci_unlock_rescan_remove(); + zpci_configure_device(zdev, ccdf->fh); break; case 0x0302: /* Reserved -> Standby */ - if (!zdev) { + if (!zdev) zpci_create_device(ccdf->fid, ccdf->fh, ZPCI_FN_STATE_STANDBY); - break; - } - zdev->fh = ccdf->fh; + else + zdev->fh = ccdf->fh; break; case 0x0303: /* Deconfiguration requested */ - if (!zdev) - break; - zpci_remove_device(zdev, false); - - ret = zpci_disable_device(zdev); - if (ret) - break; - - ret = sclp_pci_deconfigure(zdev->fid); - zpci_dbg(3, "deconf fid:%x, rc:%d\n", zdev->fid, ret); - if (!ret) - zdev->state = ZPCI_FN_STATE_STANDBY; - + if (zdev) { + zdev->fh = ccdf->fh; + zpci_deconfigure_device(zdev); + } break; case 0x0304: /* Configured -> Standby|Reserved */ if (zdev) |