From: Niklas Schnelle Date: Fri, 5 Mar 2021 13:32:02 +0000 (+0100) Subject: s390/pci: deconfigure device on release X-Git-Tag: v5.15~1274^2~50 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a9045c2210448473a321a8bf266541e5644aaae2;p=platform%2Fkernel%2Flinux-starfive.git s390/pci: deconfigure device on release When zpci_release_device() is called on a zPCI function that is still configured it would not be deconfigured. Until now this hasn't caused any problems because zpci_zdev_put() is only ever called for devices in Standby or Reserved. Fix it by adding sclp_pci_deconfigure() to the switch when in Configured state. Reviewed-by: Matthew Rosato Signed-off-by: Niklas Schnelle Signed-off-by: Heiko Carstens --- diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c index 053113b..5d6b838 100644 --- a/arch/s390/pci/pci.c +++ b/arch/s390/pci/pci.c @@ -782,6 +782,7 @@ error: void zpci_release_device(struct kref *kref) { struct zpci_dev *zdev = container_of(kref, struct zpci_dev, kref); + int ret; if (zdev->zbus->bus) zpci_remove_device(zdev, false); @@ -790,6 +791,10 @@ void zpci_release_device(struct kref *kref) zpci_disable_device(zdev); switch (zdev->state) { + case ZPCI_FN_STATE_CONFIGURED: + ret = sclp_pci_deconfigure(zdev->fid); + zpci_dbg(3, "deconf fid:%x, rc:%d\n", zdev->fid, ret); + fallthrough; case ZPCI_FN_STATE_STANDBY: if (zdev->has_hp_slot) zpci_exit_slot(zdev);