diff options
author | Niklas Schnelle <schnelle@linux.ibm.com> | 2021-03-02 14:55:21 +0100 |
---|---|---|
committer | Heiko Carstens <hca@linux.ibm.com> | 2021-03-22 11:36:03 +0100 |
commit | f6576a1b4896b984dce0e8393efeba68cc2b96c8 (patch) | |
tree | f01eae36f8007252d5cac93f546447acb56a5890 /arch/s390/pci | |
parent | 98ce70b76942626fc36c1a972fe1c5a303ac716d (diff) | |
download | linux-f6576a1b4896b984dce0e8393efeba68cc2b96c8.tar.bz2 |
s390/pci: refactor zpci function states
The current zdev->state mixes the configuration states supported by CLP
with an additional Online state which is used inconsistently to include
enabled zPCI functions which are not yet visible to the common PCI
subsytem. In preparation for a clean separation between architected
configuration states and fine grained function states remove the Online
function state.
Where we previously checked for Online it is more accurate to check if
the function is enabled to avoid an edge case where a disabled device
was still treated as Online. This also simplifies checks whether
a function is configured as this is now directly reflected by its
function state.
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')
-rw-r--r-- | arch/s390/pci/pci.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c index 91064077526d..053113bcad60 100644 --- a/arch/s390/pci/pci.c +++ b/arch/s390/pci/pci.c @@ -661,7 +661,6 @@ int zpci_enable_device(struct zpci_dev *zdev) if (rc) goto out_dma; - zdev->state = ZPCI_FN_STATE_ONLINE; return 0; out_dma: @@ -770,7 +769,7 @@ int zpci_create_device(u32 fid, u32 fh, enum zpci_state state) return 0; error_disable: - if (zdev->state == ZPCI_FN_STATE_ONLINE) + if (zdev_enabled(zdev)) zpci_disable_device(zdev); error_destroy_iommu: zpci_destroy_iommu(zdev); @@ -787,11 +786,10 @@ void zpci_release_device(struct kref *kref) if (zdev->zbus->bus) zpci_remove_device(zdev, false); - switch (zdev->state) { - case ZPCI_FN_STATE_ONLINE: - case ZPCI_FN_STATE_CONFIGURED: + if (zdev_enabled(zdev)) zpci_disable_device(zdev); - fallthrough; + + switch (zdev->state) { case ZPCI_FN_STATE_STANDBY: if (zdev->has_hp_slot) zpci_exit_slot(zdev); |