From 95b3a8b4014d82e79dc3ad03a1f8d6ee5f56b29d Mon Sep 17 00:00:00 2001 From: Niklas Schnelle Date: Tue, 26 Jan 2021 13:58:28 +0100 Subject: s390/pci: move zpci_remove_device() to bus code The zpci_remove_device() function removes the device from the PCI common code core which is an operation dealing primarily with the zbus and PCI bus code. With that and to match an upcoming refactoring of the symmetric scanning part move it to the bus code. Reviewed-by: Matthew Rosato Signed-off-by: Niklas Schnelle Signed-off-by: Heiko Carstens --- arch/s390/pci/pci.c | 37 ++----------------------------------- 1 file changed, 2 insertions(+), 35 deletions(-) (limited to 'arch/s390/pci/pci.c') diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c index 6d84ec8f1dd6..dd14641b2d20 100644 --- a/arch/s390/pci/pci.c +++ b/arch/s390/pci/pci.c @@ -679,39 +679,6 @@ int zpci_disable_device(struct zpci_dev *zdev) return clp_disable_fh(zdev); } -/* zpci_remove_device - Removes the given zdev from the PCI core - * @zdev: the zdev to be removed from the PCI core - * @set_error: if true the device's error state is set to permanent failure - * - * Sets a zPCI device to a configured but offline state; the zPCI - * device is still accessible through its hotplug slot and the zPCI - * API but is removed from the common code PCI bus, making it - * no longer available to drivers. - */ -void zpci_remove_device(struct zpci_dev *zdev, bool set_error) -{ - struct zpci_bus *zbus = zdev->zbus; - struct pci_dev *pdev; - - if (!zdev->zbus->bus) - return; - - pdev = pci_get_slot(zbus->bus, zdev->devfn); - if (pdev) { - if (set_error) - pdev->error_state = pci_channel_io_perm_failure; - if (pdev->is_virtfn) { - zpci_iov_remove_virtfn(pdev, zdev->vfn); - /* balance pci_get_slot */ - pci_dev_put(pdev); - return; - } - pci_stop_and_remove_bus_device_locked(pdev); - /* balance pci_get_slot */ - pci_dev_put(pdev); - } -} - /** * zpci_create_device() - Create a new zpci_dev and add it to the zbus * @fid: Function ID of the device to be created @@ -847,7 +814,7 @@ int zpci_deconfigure_device(struct zpci_dev *zdev) int rc; if (zdev->zbus->bus) - zpci_remove_device(zdev, false); + zpci_bus_remove_device(zdev, false); if (zdev_enabled(zdev)) { rc = zpci_disable_device(zdev); @@ -870,7 +837,7 @@ void zpci_release_device(struct kref *kref) int ret; if (zdev->zbus->bus) - zpci_remove_device(zdev, false); + zpci_bus_remove_device(zdev, false); if (zdev_enabled(zdev)) zpci_disable_device(zdev); -- cgit v1.2.3-58-ga151