diff options
Diffstat (limited to 'drivers/pci/hotplug/ibmphp_res.c')
-rw-r--r-- | drivers/pci/hotplug/ibmphp_res.c | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/drivers/pci/hotplug/ibmphp_res.c b/drivers/pci/hotplug/ibmphp_res.c index 78cf442e36d6..2f2fcc8f7f8b 100644 --- a/drivers/pci/hotplug/ibmphp_res.c +++ b/drivers/pci/hotplug/ibmphp_res.c | |||
@@ -224,7 +224,8 @@ int __init ibmphp_rsrc_init (void) | |||
224 | if ((curr->rsrc_type & RESTYPE) == MMASK) { | 224 | if ((curr->rsrc_type & RESTYPE) == MMASK) { |
225 | /* no bus structure exists in place yet */ | 225 | /* no bus structure exists in place yet */ |
226 | if (list_empty (&gbuses)) { | 226 | if (list_empty (&gbuses)) { |
227 | if ((rc = alloc_bus_range (&newbus, &newrange, curr, MEM, 1))) | 227 | rc = alloc_bus_range(&newbus, &newrange, curr, MEM, 1); |
228 | if (rc) | ||
228 | return rc; | 229 | return rc; |
229 | list_add_tail (&newbus->bus_list, &gbuses); | 230 | list_add_tail (&newbus->bus_list, &gbuses); |
230 | debug ("gbuses = NULL, Memory Primary Bus %x [%x - %x]\n", newbus->busno, newrange->start, newrange->end); | 231 | debug ("gbuses = NULL, Memory Primary Bus %x [%x - %x]\n", newbus->busno, newrange->start, newrange->end); |
@@ -237,7 +238,8 @@ int __init ibmphp_rsrc_init (void) | |||
237 | return rc; | 238 | return rc; |
238 | } else { | 239 | } else { |
239 | /* went through all the buses and didn't find ours, need to create a new bus node */ | 240 | /* went through all the buses and didn't find ours, need to create a new bus node */ |
240 | if ((rc = alloc_bus_range (&newbus, &newrange, curr, MEM, 1))) | 241 | rc = alloc_bus_range(&newbus, &newrange, curr, MEM, 1); |
242 | if (rc) | ||
241 | return rc; | 243 | return rc; |
242 | 244 | ||
243 | list_add_tail (&newbus->bus_list, &gbuses); | 245 | list_add_tail (&newbus->bus_list, &gbuses); |
@@ -248,7 +250,8 @@ int __init ibmphp_rsrc_init (void) | |||
248 | /* prefetchable memory */ | 250 | /* prefetchable memory */ |
249 | if (list_empty (&gbuses)) { | 251 | if (list_empty (&gbuses)) { |
250 | /* no bus structure exists in place yet */ | 252 | /* no bus structure exists in place yet */ |
251 | if ((rc = alloc_bus_range (&newbus, &newrange, curr, PFMEM, 1))) | 253 | rc = alloc_bus_range(&newbus, &newrange, curr, PFMEM, 1); |
254 | if (rc) | ||
252 | return rc; | 255 | return rc; |
253 | list_add_tail (&newbus->bus_list, &gbuses); | 256 | list_add_tail (&newbus->bus_list, &gbuses); |
254 | debug ("gbuses = NULL, PFMemory Primary Bus %x [%x - %x]\n", newbus->busno, newrange->start, newrange->end); | 257 | debug ("gbuses = NULL, PFMemory Primary Bus %x [%x - %x]\n", newbus->busno, newrange->start, newrange->end); |
@@ -261,7 +264,8 @@ int __init ibmphp_rsrc_init (void) | |||
261 | return rc; | 264 | return rc; |
262 | } else { | 265 | } else { |
263 | /* went through all the buses and didn't find ours, need to create a new bus node */ | 266 | /* went through all the buses and didn't find ours, need to create a new bus node */ |
264 | if ((rc = alloc_bus_range (&newbus, &newrange, curr, PFMEM, 1))) | 267 | rc = alloc_bus_range(&newbus, &newrange, curr, PFMEM, 1); |
268 | if (rc) | ||
265 | return rc; | 269 | return rc; |
266 | list_add_tail (&newbus->bus_list, &gbuses); | 270 | list_add_tail (&newbus->bus_list, &gbuses); |
267 | debug ("1st Bus, PFMemory Primary Bus %x [%x - %x]\n", newbus->busno, newrange->start, newrange->end); | 271 | debug ("1st Bus, PFMemory Primary Bus %x [%x - %x]\n", newbus->busno, newrange->start, newrange->end); |
@@ -271,7 +275,8 @@ int __init ibmphp_rsrc_init (void) | |||
271 | /* IO */ | 275 | /* IO */ |
272 | if (list_empty (&gbuses)) { | 276 | if (list_empty (&gbuses)) { |
273 | /* no bus structure exists in place yet */ | 277 | /* no bus structure exists in place yet */ |
274 | if ((rc = alloc_bus_range (&newbus, &newrange, curr, IO, 1))) | 278 | rc = alloc_bus_range(&newbus, &newrange, curr, IO, 1); |
279 | if (rc) | ||
275 | return rc; | 280 | return rc; |
276 | list_add_tail (&newbus->bus_list, &gbuses); | 281 | list_add_tail (&newbus->bus_list, &gbuses); |
277 | debug ("gbuses = NULL, IO Primary Bus %x [%x - %x]\n", newbus->busno, newrange->start, newrange->end); | 282 | debug ("gbuses = NULL, IO Primary Bus %x [%x - %x]\n", newbus->busno, newrange->start, newrange->end); |
@@ -283,7 +288,8 @@ int __init ibmphp_rsrc_init (void) | |||
283 | return rc; | 288 | return rc; |
284 | } else { | 289 | } else { |
285 | /* went through all the buses and didn't find ours, need to create a new bus node */ | 290 | /* went through all the buses and didn't find ours, need to create a new bus node */ |
286 | if ((rc = alloc_bus_range (&newbus, &newrange, curr, IO, 1))) | 291 | rc = alloc_bus_range(&newbus, &newrange, curr, IO, 1); |
292 | if (rc) | ||
287 | return rc; | 293 | return rc; |
288 | list_add_tail (&newbus->bus_list, &gbuses); | 294 | list_add_tail (&newbus->bus_list, &gbuses); |
289 | debug ("1st Bus, IO Primary Bus %x [%x - %x]\n", newbus->busno, newrange->start, newrange->end); | 295 | debug ("1st Bus, IO Primary Bus %x [%x - %x]\n", newbus->busno, newrange->start, newrange->end); |
@@ -1153,7 +1159,9 @@ int ibmphp_check_resource (struct resource_node *res, u8 bridge) | |||
1153 | } | 1159 | } |
1154 | } else { | 1160 | } else { |
1155 | /* in the same range */ | 1161 | /* in the same range */ |
1156 | if ((len_tmp = res_cur->start - 1 - res_prev->end - 1) >= res->len) { | 1162 | len_tmp = res_cur->start - 1 - res_prev->end - 1; |
1163 | |||
1164 | if (len_tmp >= res->len) { | ||
1157 | if ((len_tmp < len_cur) || (len_cur == 0)) { | 1165 | if ((len_tmp < len_cur) || (len_cur == 0)) { |
1158 | if (((res_prev->end + 1) % tmp_divide) == 0) { | 1166 | if (((res_prev->end + 1) % tmp_divide) == 0) { |
1159 | /* just perfect, starting address's divisible by length */ | 1167 | /* just perfect, starting address's divisible by length */ |
@@ -1212,7 +1220,9 @@ int ibmphp_check_resource (struct resource_node *res, u8 bridge) | |||
1212 | break; | 1220 | break; |
1213 | } | 1221 | } |
1214 | while (range) { | 1222 | while (range) { |
1215 | if ((len_tmp = range->end - range->start) >= res->len) { | 1223 | len_tmp = range->end - range->start; |
1224 | |||
1225 | if (len_tmp >= res->len) { | ||
1216 | if ((len_tmp < len_cur) || (len_cur == 0)) { | 1226 | if ((len_tmp < len_cur) || (len_cur == 0)) { |
1217 | if ((range->start % tmp_divide) == 0) { | 1227 | if ((range->start % tmp_divide) == 0) { |
1218 | /* just perfect, starting address's divisible by length */ | 1228 | /* just perfect, starting address's divisible by length */ |
@@ -1276,7 +1286,9 @@ int ibmphp_check_resource (struct resource_node *res, u8 bridge) | |||
1276 | break; | 1286 | break; |
1277 | } | 1287 | } |
1278 | while (range) { | 1288 | while (range) { |
1279 | if ((len_tmp = range->end - range->start) >= res->len) { | 1289 | len_tmp = range->end - range->start; |
1290 | |||
1291 | if (len_tmp >= res->len) { | ||
1280 | if ((len_tmp < len_cur) || (len_cur == 0)) { | 1292 | if ((len_tmp < len_cur) || (len_cur == 0)) { |
1281 | if ((range->start % tmp_divide) == 0) { | 1293 | if ((range->start % tmp_divide) == 0) { |
1282 | /* just perfect, starting address's divisible by length */ | 1294 | /* just perfect, starting address's divisible by length */ |