diff options
| -rw-r--r-- | arch/s390/include/asm/pci.h | 2 | ||||
| -rw-r--r-- | arch/s390/pci/pci.c | 69 | ||||
| -rw-r--r-- | arch/s390/pci/pci_clp.c | 8 |
3 files changed, 39 insertions, 40 deletions
diff --git a/arch/s390/include/asm/pci.h b/arch/s390/include/asm/pci.h index b9315c424628..c129ab2ac731 100644 --- a/arch/s390/include/asm/pci.h +++ b/arch/s390/include/asm/pci.h | |||
| @@ -124,12 +124,10 @@ static inline bool zdev_enabled(struct zpci_dev *zdev) | |||
| 124 | Prototypes | 124 | Prototypes |
| 125 | ----------------------------------------------------------------------------- */ | 125 | ----------------------------------------------------------------------------- */ |
| 126 | /* Base stuff */ | 126 | /* Base stuff */ |
| 127 | struct zpci_dev *zpci_alloc_device(void); | ||
| 128 | int zpci_create_device(struct zpci_dev *); | 127 | int zpci_create_device(struct zpci_dev *); |
| 129 | int zpci_enable_device(struct zpci_dev *); | 128 | int zpci_enable_device(struct zpci_dev *); |
| 130 | int zpci_disable_device(struct zpci_dev *); | 129 | int zpci_disable_device(struct zpci_dev *); |
| 131 | void zpci_stop_device(struct zpci_dev *); | 130 | void zpci_stop_device(struct zpci_dev *); |
| 132 | void zpci_free_device(struct zpci_dev *); | ||
| 133 | int zpci_register_ioat(struct zpci_dev *, u8, u64, u64, u64); | 131 | int zpci_register_ioat(struct zpci_dev *, u8, u64, u64, u64); |
| 134 | int zpci_unregister_ioat(struct zpci_dev *, u8); | 132 | int zpci_unregister_ioat(struct zpci_dev *, u8); |
| 135 | 133 | ||
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c index 63a086072edb..bf7c73d71eef 100644 --- a/arch/s390/pci/pci.c +++ b/arch/s390/pci/pci.c | |||
| @@ -530,20 +530,6 @@ static void zpci_unmap_resources(struct zpci_dev *zdev) | |||
| 530 | } | 530 | } |
| 531 | } | 531 | } |
| 532 | 532 | ||
| 533 | struct zpci_dev *zpci_alloc_device(void) | ||
| 534 | { | ||
| 535 | struct zpci_dev *zdev; | ||
| 536 | |||
| 537 | /* Alloc memory for our private pci device data */ | ||
| 538 | zdev = kzalloc(sizeof(*zdev), GFP_KERNEL); | ||
| 539 | return zdev ? : ERR_PTR(-ENOMEM); | ||
| 540 | } | ||
| 541 | |||
| 542 | void zpci_free_device(struct zpci_dev *zdev) | ||
| 543 | { | ||
| 544 | kfree(zdev); | ||
| 545 | } | ||
| 546 | |||
| 547 | int pcibios_add_platform_entries(struct pci_dev *pdev) | 533 | int pcibios_add_platform_entries(struct pci_dev *pdev) |
| 548 | { | 534 | { |
| 549 | return zpci_sysfs_add_device(&pdev->dev); | 535 | return zpci_sysfs_add_device(&pdev->dev); |
| @@ -774,26 +760,6 @@ struct dev_pm_ops pcibios_pm_ops = { | |||
| 774 | }; | 760 | }; |
| 775 | #endif /* CONFIG_HIBERNATE_CALLBACKS */ | 761 | #endif /* CONFIG_HIBERNATE_CALLBACKS */ |
| 776 | 762 | ||
| 777 | static int zpci_scan_bus(struct zpci_dev *zdev) | ||
| 778 | { | ||
| 779 | LIST_HEAD(resources); | ||
| 780 | int ret; | ||
| 781 | |||
| 782 | ret = zpci_setup_bus_resources(zdev, &resources); | ||
| 783 | if (ret) | ||
| 784 | return ret; | ||
| 785 | |||
| 786 | zdev->bus = pci_scan_root_bus(NULL, ZPCI_BUS_NR, &pci_root_ops, | ||
| 787 | zdev, &resources); | ||
| 788 | if (!zdev->bus) { | ||
| 789 | zpci_cleanup_bus_resources(zdev); | ||
| 790 | return -EIO; | ||
| 791 | } | ||
| 792 | |||
| 793 | zdev->bus->max_bus_speed = zdev->max_bus_speed; | ||
| 794 | return 0; | ||
| 795 | } | ||
| 796 | |||
| 797 | static int zpci_alloc_domain(struct zpci_dev *zdev) | 763 | static int zpci_alloc_domain(struct zpci_dev *zdev) |
| 798 | { | 764 | { |
| 799 | spin_lock(&zpci_domain_lock); | 765 | spin_lock(&zpci_domain_lock); |
| @@ -814,6 +780,41 @@ static void zpci_free_domain(struct zpci_dev *zdev) | |||
| 814 | spin_unlock(&zpci_domain_lock); | 780 | spin_unlock(&zpci_domain_lock); |
| 815 | } | 781 | } |
| 816 | 782 | ||
| 783 | void pcibios_remove_bus(struct pci_bus *bus) | ||
| 784 | { | ||
| 785 | struct zpci_dev *zdev = get_zdev_by_bus(bus); | ||
| 786 | |||
| 787 | zpci_exit_slot(zdev); | ||
| 788 | zpci_cleanup_bus_resources(zdev); | ||
| 789 | zpci_free_domain(zdev); | ||
| 790 | |||
| 791 | spin_lock(&zpci_list_lock); | ||
| 792 | list_del(&zdev->entry); | ||
| 793 | spin_unlock(&zpci_list_lock); | ||
| 794 | |||
| 795 | kfree(zdev); | ||
| 796 | } | ||
| 797 | |||
| 798 | static int zpci_scan_bus(struct zpci_dev *zdev) | ||
| 799 | { | ||
| 800 | LIST_HEAD(resources); | ||
| 801 | int ret; | ||
| 802 | |||
| 803 | ret = zpci_setup_bus_resources(zdev, &resources); | ||
| 804 | if (ret) | ||
| 805 | return ret; | ||
| 806 | |||
| 807 | zdev->bus = pci_scan_root_bus(NULL, ZPCI_BUS_NR, &pci_root_ops, | ||
| 808 | zdev, &resources); | ||
| 809 | if (!zdev->bus) { | ||
| 810 | zpci_cleanup_bus_resources(zdev); | ||
| 811 | return -EIO; | ||
| 812 | } | ||
| 813 | |||
| 814 | zdev->bus->max_bus_speed = zdev->max_bus_speed; | ||
| 815 | return 0; | ||
| 816 | } | ||
| 817 | |||
| 817 | int zpci_enable_device(struct zpci_dev *zdev) | 818 | int zpci_enable_device(struct zpci_dev *zdev) |
| 818 | { | 819 | { |
| 819 | int rc; | 820 | int rc; |
diff --git a/arch/s390/pci/pci_clp.c b/arch/s390/pci/pci_clp.c index 84147984224a..c747394029ee 100644 --- a/arch/s390/pci/pci_clp.c +++ b/arch/s390/pci/pci_clp.c | |||
| @@ -155,9 +155,9 @@ int clp_add_pci_device(u32 fid, u32 fh, int configured) | |||
| 155 | int rc; | 155 | int rc; |
| 156 | 156 | ||
| 157 | zpci_dbg(3, "add fid:%x, fh:%x, c:%d\n", fid, fh, configured); | 157 | zpci_dbg(3, "add fid:%x, fh:%x, c:%d\n", fid, fh, configured); |
| 158 | zdev = zpci_alloc_device(); | 158 | zdev = kzalloc(sizeof(*zdev), GFP_KERNEL); |
| 159 | if (IS_ERR(zdev)) | 159 | if (!zdev) |
| 160 | return PTR_ERR(zdev); | 160 | return -ENOMEM; |
| 161 | 161 | ||
| 162 | zdev->fh = fh; | 162 | zdev->fh = fh; |
| 163 | zdev->fid = fid; | 163 | zdev->fid = fid; |
| @@ -178,7 +178,7 @@ int clp_add_pci_device(u32 fid, u32 fh, int configured) | |||
| 178 | return 0; | 178 | return 0; |
| 179 | 179 | ||
| 180 | error: | 180 | error: |
| 181 | zpci_free_device(zdev); | 181 | kfree(zdev); |
| 182 | return rc; | 182 | return rc; |
| 183 | } | 183 | } |
| 184 | 184 | ||
