diff options
Diffstat (limited to 'drivers/eisa/eisa-bus.c')
-rw-r--r-- | drivers/eisa/eisa-bus.c | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/drivers/eisa/eisa-bus.c b/drivers/eisa/eisa-bus.c index 272a3ec35957..612afeaec3cb 100644 --- a/drivers/eisa/eisa-bus.c +++ b/drivers/eisa/eisa-bus.c | |||
@@ -232,8 +232,10 @@ static int __init eisa_init_device(struct eisa_root_device *root, | |||
232 | static int __init eisa_register_device(struct eisa_device *edev) | 232 | static int __init eisa_register_device(struct eisa_device *edev) |
233 | { | 233 | { |
234 | int rc = device_register(&edev->dev); | 234 | int rc = device_register(&edev->dev); |
235 | if (rc) | 235 | if (rc) { |
236 | put_device(&edev->dev); | ||
236 | return rc; | 237 | return rc; |
238 | } | ||
237 | 239 | ||
238 | rc = device_create_file(&edev->dev, &dev_attr_signature); | 240 | rc = device_create_file(&edev->dev, &dev_attr_signature); |
239 | if (rc) | 241 | if (rc) |
@@ -275,18 +277,19 @@ static int __init eisa_request_resources(struct eisa_root_device *root, | |||
275 | } | 277 | } |
276 | 278 | ||
277 | if (slot) { | 279 | if (slot) { |
280 | edev->res[i].name = NULL; | ||
278 | edev->res[i].start = SLOT_ADDRESS(root, slot) | 281 | edev->res[i].start = SLOT_ADDRESS(root, slot) |
279 | + (i * 0x400); | 282 | + (i * 0x400); |
280 | edev->res[i].end = edev->res[i].start + 0xff; | 283 | edev->res[i].end = edev->res[i].start + 0xff; |
281 | edev->res[i].flags = IORESOURCE_IO; | 284 | edev->res[i].flags = IORESOURCE_IO; |
282 | } else { | 285 | } else { |
286 | edev->res[i].name = NULL; | ||
283 | edev->res[i].start = SLOT_ADDRESS(root, slot) | 287 | edev->res[i].start = SLOT_ADDRESS(root, slot) |
284 | + EISA_VENDOR_ID_OFFSET; | 288 | + EISA_VENDOR_ID_OFFSET; |
285 | edev->res[i].end = edev->res[i].start + 3; | 289 | edev->res[i].end = edev->res[i].start + 3; |
286 | edev->res[i].flags = IORESOURCE_IO | IORESOURCE_BUSY; | 290 | edev->res[i].flags = IORESOURCE_IO | IORESOURCE_BUSY; |
287 | } | 291 | } |
288 | 292 | ||
289 | dev_printk(KERN_DEBUG, &edev->dev, "%pR\n", &edev->res[i]); | ||
290 | if (request_resource(root->res, &edev->res[i])) | 293 | if (request_resource(root->res, &edev->res[i])) |
291 | goto failed; | 294 | goto failed; |
292 | } | 295 | } |
@@ -326,19 +329,20 @@ static int __init eisa_probe(struct eisa_root_device *root) | |||
326 | return -ENOMEM; | 329 | return -ENOMEM; |
327 | } | 330 | } |
328 | 331 | ||
329 | if (eisa_init_device(root, edev, 0)) { | 332 | if (eisa_request_resources(root, edev, 0)) { |
333 | dev_warn(root->dev, | ||
334 | "EISA: Cannot allocate resource for mainboard\n"); | ||
330 | kfree(edev); | 335 | kfree(edev); |
331 | if (!root->force_probe) | 336 | if (!root->force_probe) |
332 | return -ENODEV; | 337 | return -EBUSY; |
333 | goto force_probe; | 338 | goto force_probe; |
334 | } | 339 | } |
335 | 340 | ||
336 | if (eisa_request_resources(root, edev, 0)) { | 341 | if (eisa_init_device(root, edev, 0)) { |
337 | dev_warn(root->dev, | 342 | eisa_release_resources(edev); |
338 | "EISA: Cannot allocate resource for mainboard\n"); | ||
339 | kfree(edev); | 343 | kfree(edev); |
340 | if (!root->force_probe) | 344 | if (!root->force_probe) |
341 | return -EBUSY; | 345 | return -ENODEV; |
342 | goto force_probe; | 346 | goto force_probe; |
343 | } | 347 | } |
344 | 348 | ||
@@ -361,11 +365,6 @@ static int __init eisa_probe(struct eisa_root_device *root) | |||
361 | continue; | 365 | continue; |
362 | } | 366 | } |
363 | 367 | ||
364 | if (eisa_init_device(root, edev, i)) { | ||
365 | kfree(edev); | ||
366 | continue; | ||
367 | } | ||
368 | |||
369 | if (eisa_request_resources(root, edev, i)) { | 368 | if (eisa_request_resources(root, edev, i)) { |
370 | dev_warn(root->dev, | 369 | dev_warn(root->dev, |
371 | "Cannot allocate resource for EISA slot %d\n", | 370 | "Cannot allocate resource for EISA slot %d\n", |
@@ -374,6 +373,12 @@ static int __init eisa_probe(struct eisa_root_device *root) | |||
374 | continue; | 373 | continue; |
375 | } | 374 | } |
376 | 375 | ||
376 | if (eisa_init_device(root, edev, i)) { | ||
377 | eisa_release_resources(edev); | ||
378 | kfree(edev); | ||
379 | continue; | ||
380 | } | ||
381 | |||
377 | if (edev->state == (EISA_CONFIG_ENABLED | EISA_CONFIG_FORCED)) | 382 | if (edev->state == (EISA_CONFIG_ENABLED | EISA_CONFIG_FORCED)) |
378 | enabled_str = " (forced enabled)"; | 383 | enabled_str = " (forced enabled)"; |
379 | else if (edev->state == EISA_CONFIG_FORCED) | 384 | else if (edev->state == EISA_CONFIG_FORCED) |