diff options
| author | Arnd Bergmann <arnd@arndb.de> | 2021-01-25 14:29:48 +0100 |
|---|---|---|
| committer | Arnd Bergmann <arnd@arndb.de> | 2021-03-12 16:01:10 +0100 |
| commit | aeb172ab4efb38a4817cf99c9c977d89130c3937 (patch) | |
| tree | 27b6dc86aab6d784da43900f46df0222b208cb97 | |
| parent | a33ad04d2320edeaca80d61524768a9b7b7af8e4 (diff) | |
| download | playground-aeb172ab4efb38a4817cf99c9c977d89130c3937.tar.gz | |
pci: s390: remove redundant zbus->bus member
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
| -rw-r--r-- | arch/s390/include/asm/pci.h | 1 | ||||
| -rw-r--r-- | arch/s390/pci/pci.c | 6 | ||||
| -rw-r--r-- | arch/s390/pci/pci_bus.c | 27 | ||||
| -rw-r--r-- | arch/s390/pci/pci_event.c | 16 | ||||
| -rw-r--r-- | arch/s390/pci/pci_sysfs.c | 2 | ||||
| -rw-r--r-- | drivers/pci/hotplug/s390_pci_hpc.c | 10 |
6 files changed, 32 insertions, 30 deletions
diff --git a/arch/s390/include/asm/pci.h b/arch/s390/include/asm/pci.h index 7b370e59541fb..f488ded6b861f 100644 --- a/arch/s390/include/asm/pci.h +++ b/arch/s390/include/asm/pci.h @@ -102,7 +102,6 @@ struct s390_domain; #define ZPCI_FUNCTIONS_PER_BUS 256 struct zpci_bus { struct kref kref; - struct pci_bus *bus; struct pci_host_bridge *bridge; struct zpci_dev *function[ZPCI_FUNCTIONS_PER_BUS]; struct list_head resources; diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c index 600881d894dd0..aae3f01035f50 100644 --- a/arch/s390/pci/pci.c +++ b/arch/s390/pci/pci.c @@ -684,10 +684,10 @@ EXPORT_SYMBOL_GPL(zpci_disable_device); void zpci_remove_device(struct zpci_dev *zdev) { - struct zpci_bus *zbus = zdev->zbus; + struct pci_host_bridge *bridge = zdev->zbus->bridge; struct pci_dev *pdev; - pdev = pci_get_slot(zbus->bus, zdev->devfn); + pdev = pci_get_slot(bridge->bus, zdev->devfn); if (pdev) { if (pdev->is_virtfn) return zpci_iov_remove_virtfn(pdev, zdev->vfn); @@ -764,7 +764,7 @@ void zpci_release_device(struct kref *kref) { struct zpci_dev *zdev = container_of(kref, struct zpci_dev, kref); - if (zdev->zbus->bus) + if (zdev->zbus->bridge->bus) zpci_remove_device(zdev); switch (zdev->state) { diff --git a/arch/s390/pci/pci_bus.c b/arch/s390/pci/pci_bus.c index ab5c76424b8fb..430b6ccffc495 100644 --- a/arch/s390/pci/pci_bus.c +++ b/arch/s390/pci/pci_bus.c @@ -53,7 +53,6 @@ static int zpci_bus_scan(struct zpci_bus *zbus, int domain) return rc; } - zbus->bus = bridge->bus; pci_bus_add_devices(bridge->bus); return 0; } @@ -61,21 +60,22 @@ static int zpci_bus_scan(struct zpci_bus *zbus, int domain) static void zpci_bus_release(struct kref *kref) { struct zpci_bus *zbus = container_of(kref, struct zpci_bus, kref); + struct pci_host_bridge *bridge = zbus->bridge; - if (zbus->bus) { + if (bridge) { pci_lock_rescan_remove(); - pci_stop_root_bus(zbus->bus); + pci_stop_root_bus(bridge->bus); zpci_free_domain(zbus->domain_nr); - pci_remove_root_bus(zbus->bus); + pci_remove_root_bus(bridge->bus); pci_unlock_rescan_remove(); } spin_lock(&zbus_list_lock); list_del(&zbus->bus_next); spin_unlock(&zbus_list_lock); - put_device(&zbus->bridge->dev); + put_device(&bridge->dev); } static void zpci_bus_put(struct zpci_bus *zbus) @@ -147,17 +147,16 @@ void pcibios_bus_add_device(struct pci_dev *pdev) static int zpci_bus_add_device(struct zpci_bus *zbus, struct zpci_dev *zdev) { - struct pci_bus *bus; + struct pci_host_bridge *bridge = zbus->bridge; struct resource_entry *window, *n; struct resource *res; struct pci_dev *pdev; int rc; - bus = zbus->bus; - if (!bus) + if (!bridge || !bridge->bus) return -EINVAL; - pdev = pci_get_slot(bus, zdev->devfn); + pdev = pci_get_slot(bridge->bus, zdev->devfn); if (pdev) { /* Device is already known. */ pci_dev_put(pdev); @@ -171,10 +170,10 @@ static int zpci_bus_add_device(struct zpci_bus *zbus, struct zpci_dev *zdev) resource_list_for_each_entry_safe(window, n, &zbus->resources) { res = window->res; - pci_bus_add_resource(bus, res, 0); + pci_bus_add_resource(bridge->bus, res, 0); } - pdev = pci_scan_single_device(bus, zdev->devfn); + pdev = pci_scan_single_device(bridge->bus, zdev->devfn); if (pdev) pci_bus_add_device(pdev); @@ -190,7 +189,7 @@ static void zpci_bus_add_devices(struct zpci_bus *zbus) zpci_bus_add_device(zbus, zbus->function[i]); pci_lock_rescan_remove(); - pci_bus_add_devices(zbus->bus); + pci_bus_add_devices(zbus->bridge->bus); pci_unlock_rescan_remove(); } @@ -230,7 +229,7 @@ int zpci_bus_device_register(struct zpci_dev *zdev, struct pci_ops *ops) zpci_setup_bus_resources(zdev, &zbus->bridge->windows); - if (zbus->bus) { + if (zbus->bridge->bus) { if (!zbus->multifunction) { WARN_ONCE(1, "zbus is not multifunction\n"); goto error_bus; @@ -247,7 +246,7 @@ int zpci_bus_device_register(struct zpci_dev *zdev, struct pci_ops *ops) WARN_ONCE(1, "rid_available not set on function 0 for multifunction\n"); goto error_bus; } - rc = zpci_bus_scan(zbus, (u16)zdev->uid, ops); + rc = zpci_bus_scan(zbus, (u16)zdev->uid); if (rc) goto error_bus; zpci_bus_add_devices(zbus); diff --git a/arch/s390/pci/pci_event.c b/arch/s390/pci/pci_event.c index b4162da4e8a20..416147490b24f 100644 --- a/arch/s390/pci/pci_event.c +++ b/arch/s390/pci/pci_event.c @@ -55,7 +55,7 @@ static void __zpci_event_error(struct zpci_ccdf_err *ccdf) zpci_err_hex(ccdf, sizeof(*ccdf)); if (zdev) - pdev = pci_get_slot(zdev->zbus->bus, zdev->devfn); + pdev = pci_get_slot(zdev->zbus->bridge->bus, zdev->devfn); pr_err("%s: Event 0x%x reports an error for PCI function 0x%x\n", pdev ? pci_name(pdev) : "n/a", ccdf->pec, ccdf->fid); @@ -76,12 +76,16 @@ void zpci_event_error(void *data) static void __zpci_event_availability(struct zpci_ccdf_avail *ccdf) { struct zpci_dev *zdev = get_zdev_by_fid(ccdf->fid); + struct pci_host_bridge *bridge = NULL; struct pci_dev *pdev = NULL; enum zpci_state state; int ret; - if (zdev && zdev->zbus->bus) - pdev = pci_get_slot(zdev->zbus->bus, zdev->devfn); + if (zdev && zdev->zbus->bridge) { + bridge = zdev->zbus->bridge; + if (bridge) + pdev = pci_get_slot(bridge->bus, zdev->devfn); + } zpci_err("avail CCDF:\n"); zpci_err_hex(ccdf, sizeof(*ccdf)); @@ -102,16 +106,16 @@ static void __zpci_event_availability(struct zpci_ccdf_avail *ccdf) break; /* the PCI function will be scanned once function 0 appears */ - if (!zdev->zbus->bus) + if (bridge) break; - pdev = pci_scan_single_device(zdev->zbus->bus, zdev->devfn); + pdev = pci_scan_single_device(bridge->bus, zdev->devfn); if (!pdev) break; pci_bus_add_device(pdev); pci_lock_rescan_remove(); - pci_bus_add_devices(zdev->zbus->bus); + pci_bus_add_devices(bridge->bus); pci_unlock_rescan_remove(); break; case 0x0302: /* Reserved -> Standby */ diff --git a/arch/s390/pci/pci_sysfs.c b/arch/s390/pci/pci_sysfs.c index 5c028bee91b90..d618650f16ac7 100644 --- a/arch/s390/pci/pci_sysfs.c +++ b/arch/s390/pci/pci_sysfs.c @@ -89,7 +89,7 @@ static ssize_t recover_store(struct device *dev, struct device_attribute *attr, ret = zpci_enable_device(zdev); if (ret) goto out; - pci_rescan_bus(zdev->zbus->bus); + pci_rescan_bus(zdev->zbus->bridge->bus); } out: pci_unlock_rescan_remove(); diff --git a/drivers/pci/hotplug/s390_pci_hpc.c b/drivers/pci/hotplug/s390_pci_hpc.c index c9e790c74051f..c7aa4157412de 100644 --- a/drivers/pci/hotplug/s390_pci_hpc.c +++ b/drivers/pci/hotplug/s390_pci_hpc.c @@ -52,7 +52,7 @@ static int enable_slot(struct hotplug_slot *hotplug_slot) { struct zpci_dev *zdev = container_of(hotplug_slot, struct zpci_dev, hotplug_slot); - struct zpci_bus *zbus = zdev->zbus; + struct pci_host_bridge *bridge = zdev->zbus->bridge; int rc; if (zdev->state != ZPCI_FN_STATE_STANDBY) @@ -66,9 +66,9 @@ static int enable_slot(struct hotplug_slot *hotplug_slot) if (rc) goto out_deconfigure; - pci_scan_slot(zbus->bus, zdev->devfn); + pci_scan_slot(bridge->bus, zdev->devfn); pci_lock_rescan_remove(); - pci_bus_add_devices(zbus->bus); + pci_bus_add_devices(bridge->bus); pci_unlock_rescan_remove(); return rc; @@ -88,7 +88,7 @@ static int disable_slot(struct hotplug_slot *hotplug_slot) if (!zpci_fn_configured(zdev->state)) return -EIO; - pdev = pci_get_slot(zdev->zbus->bus, zdev->devfn); + pdev = pci_get_slot(zdev->zbus->bridge->bus, zdev->devfn); if (pdev && pci_num_vf(pdev)) { pci_dev_put(pdev); return -EBUSY; @@ -141,7 +141,7 @@ int zpci_init_slot(struct zpci_dev *zdev) zdev->hotplug_slot.ops = &s390_hotplug_slot_ops; snprintf(name, SLOT_NAME_SIZE, "%08x", zdev->fid); - return pci_hp_register(&zdev->hotplug_slot, zbus->bus, + return pci_hp_register(&zdev->hotplug_slot, zbus->bridge->bus, zdev->devfn, name); } |
