aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug
diff options
context:
space:
mode:
authorNiklas Schnelle <schnelle@linux.ibm.com>2020-11-03 10:41:20 +0100
committerHeiko Carstens <hca@linux.ibm.com>2021-03-22 11:36:04 +0100
commit2631f6b6f22ca613238a416a09e3d2771def6f88 (patch)
tree9ab0b08d9edc24ec45b8c4f20a4e3721a77d8ed1 /drivers/pci/hotplug
parents390/cio: add CRW inject functionality (diff)
downloadlinux-dev-2631f6b6f22ca613238a416a09e3d2771def6f88.tar.xz
linux-dev-2631f6b6f22ca613238a416a09e3d2771def6f88.zip
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 'drivers/pci/hotplug')
-rw-r--r--drivers/pci/hotplug/s390_pci_hpc.c52
1 files changed, 2 insertions, 50 deletions
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)