From 2631f6b6f22ca613238a416a09e3d2771def6f88 Mon Sep 17 00:00:00 2001 From: Niklas Schnelle Date: Tue, 3 Nov 2020 10:41:20 +0100 Subject: 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 Signed-off-by: Niklas Schnelle Signed-off-by: Heiko Carstens --- drivers/pci/hotplug/s390_pci_hpc.c | 52 ++------------------------------------ 1 file changed, 2 insertions(+), 50 deletions(-) (limited to 'drivers/pci/hotplug') diff --git a/drivers/pci/hotplug/s390_pci_hpc.c b/drivers/pci/hotplug/s390_pci_hpc.c index c93c09ae4b04..154532663a70 100644 --- a/drivers/pci/hotplug/s390_pci_hpc.c +++ b/drivers/pci/hotplug/s390_pci_hpc.c @@ -20,56 +20,15 @@ #define SLOT_NAME_SIZE 10 -static inline int zdev_configure(struct zpci_dev *zdev) -{ - int ret = sclp_pci_configure(zdev->fid); - - zpci_dbg(3, "conf fid:%x, rc:%d\n", zdev->fid, ret); - if (!ret) - zdev->state = ZPCI_FN_STATE_CONFIGURED; - - return ret; -} - -static inline int zdev_deconfigure(struct zpci_dev *zdev) -{ - int 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; - - return ret; -} - static int enable_slot(struct hotplug_slot *hotplug_slot) { struct zpci_dev *zdev = container_of(hotplug_slot, struct zpci_dev, hotplug_slot); - struct zpci_bus *zbus = zdev->zbus; - int rc; if (zdev->state != ZPCI_FN_STATE_STANDBY) return -EIO; - rc = zdev_configure(zdev); - if (rc) - return rc; - - rc = zpci_enable_device(zdev); - if (rc) - goto out_deconfigure; - - pci_scan_slot(zbus->bus, zdev->devfn); - pci_lock_rescan_remove(); - pci_bus_add_devices(zbus->bus); - pci_unlock_rescan_remove(); - - return rc; - -out_deconfigure: - zdev_deconfigure(zdev); - return rc; + return zpci_configure_device(zdev, zdev->fh); } static int disable_slot(struct hotplug_slot *hotplug_slot) @@ -77,7 +36,6 @@ static int disable_slot(struct hotplug_slot *hotplug_slot) struct zpci_dev *zdev = container_of(hotplug_slot, struct zpci_dev, hotplug_slot); struct pci_dev *pdev; - int rc; if (zdev->state != ZPCI_FN_STATE_CONFIGURED) return -EIO; @@ -89,13 +47,7 @@ static int disable_slot(struct hotplug_slot *hotplug_slot) } pci_dev_put(pdev); - zpci_remove_device(zdev, false); - - rc = zpci_disable_device(zdev); - if (rc) - return rc; - - return zdev_deconfigure(zdev); + return zpci_deconfigure_device(zdev); } static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value) -- cgit