diff options
author | Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> | 2005-11-24 22:21:25 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-01-09 15:13:16 -0500 |
commit | e00e57efa3448b18c0deedce32732e28683cb73d (patch) | |
tree | 2ab1dce58a35e5fe0c2a56f47323ac25a689c2bb /drivers/pci/hotplug/shpchp_pci.c | |
parent | 2555f7bdd3b0db47f6e1d7bb887981654e2261b3 (diff) |
[PATCH] shpchp: replace pci_find_slot() with pci_get_slot()
This patch replaces pci_find_slot() with pci_get_slot() in the SHPCHP
driver. This enables SHPCHP driver to work on multiple PCI segment
systems.
Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/pci/hotplug/shpchp_pci.c')
-rw-r--r-- | drivers/pci/hotplug/shpchp_pci.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/drivers/pci/hotplug/shpchp_pci.c b/drivers/pci/hotplug/shpchp_pci.c index 38009bc0fd5d..19e1a5e1e30b 100644 --- a/drivers/pci/hotplug/shpchp_pci.c +++ b/drivers/pci/hotplug/shpchp_pci.c | |||
@@ -89,10 +89,11 @@ int shpchp_configure_device(struct slot *p_slot) | |||
89 | struct pci_bus *parent = p_slot->ctrl->pci_dev->subordinate; | 89 | struct pci_bus *parent = p_slot->ctrl->pci_dev->subordinate; |
90 | int num, fn; | 90 | int num, fn; |
91 | 91 | ||
92 | dev = pci_find_slot(p_slot->bus, PCI_DEVFN(p_slot->device, 0)); | 92 | dev = pci_get_slot(parent, PCI_DEVFN(p_slot->device, 0)); |
93 | if (dev) { | 93 | if (dev) { |
94 | err("Device %s already exists at %x:%x, cannot hot-add\n", | 94 | err("Device %s already exists at %x:%x, cannot hot-add\n", |
95 | pci_name(dev), p_slot->bus, p_slot->device); | 95 | pci_name(dev), p_slot->bus, p_slot->device); |
96 | pci_dev_put(dev); | ||
96 | return -EINVAL; | 97 | return -EINVAL; |
97 | } | 98 | } |
98 | 99 | ||
@@ -103,12 +104,13 @@ int shpchp_configure_device(struct slot *p_slot) | |||
103 | } | 104 | } |
104 | 105 | ||
105 | for (fn = 0; fn < 8; fn++) { | 106 | for (fn = 0; fn < 8; fn++) { |
106 | if (!(dev = pci_find_slot(p_slot->bus, | 107 | dev = pci_get_slot(parent, PCI_DEVFN(p_slot->device, fn)); |
107 | PCI_DEVFN(p_slot->device, fn)))) | 108 | if (!dev) |
108 | continue; | 109 | continue; |
109 | if ((dev->class >> 16) == PCI_BASE_CLASS_DISPLAY) { | 110 | if ((dev->class >> 16) == PCI_BASE_CLASS_DISPLAY) { |
110 | err("Cannot hot-add display device %s\n", | 111 | err("Cannot hot-add display device %s\n", |
111 | pci_name(dev)); | 112 | pci_name(dev)); |
113 | pci_dev_put(dev); | ||
112 | continue; | 114 | continue; |
113 | } | 115 | } |
114 | if ((dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) || | 116 | if ((dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) || |
@@ -124,18 +126,21 @@ int shpchp_configure_device(struct slot *p_slot) | |||
124 | } | 126 | } |
125 | if (busnr >= end) { | 127 | if (busnr >= end) { |
126 | err("No free bus for hot-added bridge\n"); | 128 | err("No free bus for hot-added bridge\n"); |
129 | pci_dev_put(dev); | ||
127 | continue; | 130 | continue; |
128 | } | 131 | } |
129 | child = pci_add_new_bus(parent, dev, busnr); | 132 | child = pci_add_new_bus(parent, dev, busnr); |
130 | if (!child) { | 133 | if (!child) { |
131 | err("Cannot add new bus for %s\n", | 134 | err("Cannot add new bus for %s\n", |
132 | pci_name(dev)); | 135 | pci_name(dev)); |
136 | pci_dev_put(dev); | ||
133 | continue; | 137 | continue; |
134 | } | 138 | } |
135 | child->subordinate = pci_do_scan_bus(child); | 139 | child->subordinate = pci_do_scan_bus(child); |
136 | pci_bus_size_bridges(child); | 140 | pci_bus_size_bridges(child); |
137 | } | 141 | } |
138 | program_fw_provided_values(dev); | 142 | program_fw_provided_values(dev); |
143 | pci_dev_put(dev); | ||
139 | } | 144 | } |
140 | 145 | ||
141 | pci_bus_assign_resources(parent); | 146 | pci_bus_assign_resources(parent); |
@@ -149,17 +154,19 @@ int shpchp_unconfigure_device(struct slot *p_slot) | |||
149 | int rc = 0; | 154 | int rc = 0; |
150 | int j; | 155 | int j; |
151 | u8 bctl = 0; | 156 | u8 bctl = 0; |
152 | 157 | struct pci_bus *parent = p_slot->ctrl->pci_dev->subordinate; | |
158 | |||
153 | dbg("%s: bus/dev = %x/%x\n", __FUNCTION__, p_slot->bus, p_slot->device); | 159 | dbg("%s: bus/dev = %x/%x\n", __FUNCTION__, p_slot->bus, p_slot->device); |
154 | 160 | ||
155 | for (j=0; j<8 ; j++) { | 161 | for (j=0; j<8 ; j++) { |
156 | struct pci_dev* temp = pci_find_slot(p_slot->bus, | 162 | struct pci_dev* temp = pci_get_slot(parent, |
157 | (p_slot->device << 3) | j); | 163 | (p_slot->device << 3) | j); |
158 | if (!temp) | 164 | if (!temp) |
159 | continue; | 165 | continue; |
160 | if ((temp->class >> 16) == PCI_BASE_CLASS_DISPLAY) { | 166 | if ((temp->class >> 16) == PCI_BASE_CLASS_DISPLAY) { |
161 | err("Cannot remove display device %s\n", | 167 | err("Cannot remove display device %s\n", |
162 | pci_name(temp)); | 168 | pci_name(temp)); |
169 | pci_dev_put(temp); | ||
163 | continue; | 170 | continue; |
164 | } | 171 | } |
165 | if (temp->hdr_type == PCI_HEADER_TYPE_BRIDGE) { | 172 | if (temp->hdr_type == PCI_HEADER_TYPE_BRIDGE) { |
@@ -167,10 +174,12 @@ int shpchp_unconfigure_device(struct slot *p_slot) | |||
167 | if (bctl & PCI_BRIDGE_CTL_VGA) { | 174 | if (bctl & PCI_BRIDGE_CTL_VGA) { |
168 | err("Cannot remove display device %s\n", | 175 | err("Cannot remove display device %s\n", |
169 | pci_name(temp)); | 176 | pci_name(temp)); |
177 | pci_dev_put(temp); | ||
170 | continue; | 178 | continue; |
171 | } | 179 | } |
172 | } | 180 | } |
173 | pci_remove_bus_device(temp); | 181 | pci_remove_bus_device(temp); |
182 | pci_dev_put(temp); | ||
174 | } | 183 | } |
175 | return rc; | 184 | return rc; |
176 | } | 185 | } |