Skip to content

Commit 2f0230b

Browse files
niklas88hcahca
authored andcommitted
s390/pci: re-introduce zpci_remove_device()
For fixing the PF to VF link removal we need to perform some action on every removal of a zdev from the common PCI subsystem. So in preparation re-introduce zpci_remove_device() and use that instead of directly calling the common code functions. This was actually still declared from earlier code but no longer implemented. Reviewed-by: Pierre Morel <[email protected]> Signed-off-by: Niklas Schnelle <[email protected]> Signed-off-by: Heiko Carstens <[email protected]>
1 parent 3cddb79 commit 2f0230b

File tree

3 files changed

+19
-16
lines changed

3 files changed

+19
-16
lines changed

arch/s390/pci/pci.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,16 @@ int zpci_disable_device(struct zpci_dev *zdev)
672672
}
673673
EXPORT_SYMBOL_GPL(zpci_disable_device);
674674

675+
void zpci_remove_device(struct zpci_dev *zdev)
676+
{
677+
struct zpci_bus *zbus = zdev->zbus;
678+
struct pci_dev *pdev;
679+
680+
pdev = pci_get_slot(zbus->bus, zdev->devfn);
681+
if (pdev)
682+
pci_stop_and_remove_bus_device_locked(pdev);
683+
}
684+
675685
int zpci_create_device(struct zpci_dev *zdev)
676686
{
677687
int rc;
@@ -716,13 +726,8 @@ void zpci_release_device(struct kref *kref)
716726
{
717727
struct zpci_dev *zdev = container_of(kref, struct zpci_dev, kref);
718728

719-
if (zdev->zbus->bus) {
720-
struct pci_dev *pdev;
721-
722-
pdev = pci_get_slot(zdev->zbus->bus, zdev->devfn);
723-
if (pdev)
724-
pci_stop_and_remove_bus_device_locked(pdev);
725-
}
729+
if (zdev->zbus->bus)
730+
zpci_remove_device(zdev);
726731

727732
switch (zdev->state) {
728733
case ZPCI_FN_STATE_ONLINE:

arch/s390/pci/pci_event.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ static void __zpci_event_availability(struct zpci_ccdf_avail *ccdf)
121121
if (!zdev)
122122
break;
123123
if (pdev)
124-
pci_stop_and_remove_bus_device_locked(pdev);
124+
zpci_remove_device(zdev);
125125

126126
ret = zpci_disable_device(zdev);
127127
if (ret)
@@ -140,7 +140,7 @@ static void __zpci_event_availability(struct zpci_ccdf_avail *ccdf)
140140
/* Give the driver a hint that the function is
141141
* already unusable. */
142142
pdev->error_state = pci_channel_io_perm_failure;
143-
pci_stop_and_remove_bus_device_locked(pdev);
143+
zpci_remove_device(zdev);
144144
}
145145

146146
zdev->state = ZPCI_FN_STATE_STANDBY;

drivers/pci/hotplug/s390_pci_hpc.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,21 +83,19 @@ static int disable_slot(struct hotplug_slot *hotplug_slot)
8383
struct zpci_dev *zdev = container_of(hotplug_slot, struct zpci_dev,
8484
hotplug_slot);
8585
struct pci_dev *pdev;
86-
struct zpci_bus *zbus = zdev->zbus;
8786
int rc;
8887

8988
if (!zpci_fn_configured(zdev->state))
9089
return -EIO;
9190

92-
pdev = pci_get_slot(zbus->bus, zdev->devfn);
93-
if (pdev) {
94-
if (pci_num_vf(pdev))
95-
return -EBUSY;
96-
97-
pci_stop_and_remove_bus_device_locked(pdev);
91+
pdev = pci_get_slot(zdev->zbus->bus, zdev->devfn);
92+
if (pdev && pci_num_vf(pdev)) {
9893
pci_dev_put(pdev);
94+
return -EBUSY;
9995
}
10096

97+
zpci_remove_device(zdev);
98+
10199
rc = zpci_disable_device(zdev);
102100
if (rc)
103101
return rc;

0 commit comments

Comments
 (0)