Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <mjrosato@linux.ibm.com>
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>

authored by

Niklas Schnelle and committed by
Heiko Carstens
a9045c22 f6576a1b

+5
+5
arch/s390/pci/pci.c
··· 782 782 void zpci_release_device(struct kref *kref) 783 783 { 784 784 struct zpci_dev *zdev = container_of(kref, struct zpci_dev, kref); 785 + int ret; 785 786 786 787 if (zdev->zbus->bus) 787 788 zpci_remove_device(zdev, false); ··· 791 790 zpci_disable_device(zdev); 792 791 793 792 switch (zdev->state) { 793 + case ZPCI_FN_STATE_CONFIGURED: 794 + ret = sclp_pci_deconfigure(zdev->fid); 795 + zpci_dbg(3, "deconf fid:%x, rc:%d\n", zdev->fid, ret); 796 + fallthrough; 794 797 case ZPCI_FN_STATE_STANDBY: 795 798 if (zdev->has_hp_slot) 796 799 zpci_exit_slot(zdev);