aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/eisa
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/eisa')
-rw-r--r--drivers/eisa/eisa-bus.c82
-rw-r--r--drivers/eisa/pci_eisa.c5
2 files changed, 38 insertions, 49 deletions
diff --git a/drivers/eisa/eisa-bus.c b/drivers/eisa/eisa-bus.c
index 806c77bfd434..272a3ec35957 100644
--- a/drivers/eisa/eisa-bus.c
+++ b/drivers/eisa/eisa-bus.c
@@ -275,19 +275,18 @@ static int __init eisa_request_resources(struct eisa_root_device *root,
275 } 275 }
276 276
277 if (slot) { 277 if (slot) {
278 edev->res[i].name = NULL;
279 edev->res[i].start = SLOT_ADDRESS(root, slot) 278 edev->res[i].start = SLOT_ADDRESS(root, slot)
280 + (i * 0x400); 279 + (i * 0x400);
281 edev->res[i].end = edev->res[i].start + 0xff; 280 edev->res[i].end = edev->res[i].start + 0xff;
282 edev->res[i].flags = IORESOURCE_IO; 281 edev->res[i].flags = IORESOURCE_IO;
283 } else { 282 } else {
284 edev->res[i].name = NULL;
285 edev->res[i].start = SLOT_ADDRESS(root, slot) 283 edev->res[i].start = SLOT_ADDRESS(root, slot)
286 + EISA_VENDOR_ID_OFFSET; 284 + EISA_VENDOR_ID_OFFSET;
287 edev->res[i].end = edev->res[i].start + 3; 285 edev->res[i].end = edev->res[i].start + 3;
288 edev->res[i].flags = IORESOURCE_BUSY; 286 edev->res[i].flags = IORESOURCE_IO | IORESOURCE_BUSY;
289 } 287 }
290 288
289 dev_printk(KERN_DEBUG, &edev->dev, "%pR\n", &edev->res[i]);
291 if (request_resource(root->res, &edev->res[i])) 290 if (request_resource(root->res, &edev->res[i]))
292 goto failed; 291 goto failed;
293 } 292 }
@@ -314,41 +313,40 @@ static int __init eisa_probe(struct eisa_root_device *root)
314{ 313{
315 int i, c; 314 int i, c;
316 struct eisa_device *edev; 315 struct eisa_device *edev;
316 char *enabled_str;
317 317
318 printk(KERN_INFO "EISA: Probing bus %d at %s\n", 318 dev_info(root->dev, "Probing EISA bus %d\n", root->bus_nr);
319 root->bus_nr, dev_name(root->dev));
320 319
321 /* First try to get hold of slot 0. If there is no device 320 /* First try to get hold of slot 0. If there is no device
322 * here, simply fail, unless root->force_probe is set. */ 321 * here, simply fail, unless root->force_probe is set. */
323 322
324 edev = kzalloc(sizeof(*edev), GFP_KERNEL); 323 edev = kzalloc(sizeof(*edev), GFP_KERNEL);
325 if (!edev) { 324 if (!edev) {
326 printk(KERN_ERR "EISA: Couldn't allocate mainboard slot\n"); 325 dev_err(root->dev, "EISA: Couldn't allocate mainboard slot\n");
327 return -ENOMEM; 326 return -ENOMEM;
328 } 327 }
329 328
330 if (eisa_request_resources(root, edev, 0)) { 329 if (eisa_init_device(root, edev, 0)) {
331 printk(KERN_WARNING \
332 "EISA: Cannot allocate resource for mainboard\n");
333 kfree(edev); 330 kfree(edev);
334 if (!root->force_probe) 331 if (!root->force_probe)
335 return -EBUSY; 332 return -ENODEV;
336 goto force_probe; 333 goto force_probe;
337 } 334 }
338 335
339 if (eisa_init_device(root, edev, 0)) { 336 if (eisa_request_resources(root, edev, 0)) {
340 eisa_release_resources(edev); 337 dev_warn(root->dev,
338 "EISA: Cannot allocate resource for mainboard\n");
341 kfree(edev); 339 kfree(edev);
342 if (!root->force_probe) 340 if (!root->force_probe)
343 return -ENODEV; 341 return -EBUSY;
344 goto force_probe; 342 goto force_probe;
345 } 343 }
346 344
347 printk(KERN_INFO "EISA: Mainboard %s detected.\n", edev->id.sig); 345 dev_info(&edev->dev, "EISA: Mainboard %s detected\n", edev->id.sig);
348 346
349 if (eisa_register_device(edev)) { 347 if (eisa_register_device(edev)) {
350 printk(KERN_ERR "EISA: Failed to register %s\n", 348 dev_err(&edev->dev, "EISA: Failed to register %s\n",
351 edev->id.sig); 349 edev->id.sig);
352 eisa_release_resources(edev); 350 eisa_release_resources(edev);
353 kfree(edev); 351 kfree(edev);
354 } 352 }
@@ -358,55 +356,47 @@ static int __init eisa_probe(struct eisa_root_device *root)
358 for (c = 0, i = 1; i <= root->slots; i++) { 356 for (c = 0, i = 1; i <= root->slots; i++) {
359 edev = kzalloc(sizeof(*edev), GFP_KERNEL); 357 edev = kzalloc(sizeof(*edev), GFP_KERNEL);
360 if (!edev) { 358 if (!edev) {
361 printk(KERN_ERR "EISA: Out of memory for slot %d\n", i); 359 dev_err(root->dev, "EISA: Out of memory for slot %d\n",
360 i);
362 continue; 361 continue;
363 } 362 }
364 363
365 if (eisa_request_resources(root, edev, i)) { 364 if (eisa_init_device(root, edev, i)) {
366 printk(KERN_WARNING \
367 "Cannot allocate resource for EISA slot %d\n",
368 i);
369 kfree(edev); 365 kfree(edev);
370 continue; 366 continue;
371 } 367 }
372 368
373 if (eisa_init_device(root, edev, i)) { 369 if (eisa_request_resources(root, edev, i)) {
374 eisa_release_resources(edev); 370 dev_warn(root->dev,
371 "Cannot allocate resource for EISA slot %d\n",
372 i);
375 kfree(edev); 373 kfree(edev);
376 continue; 374 continue;
377 } 375 }
378 376
379 printk(KERN_INFO "EISA: slot %d : %s detected", 377 if (edev->state == (EISA_CONFIG_ENABLED | EISA_CONFIG_FORCED))
380 i, edev->id.sig); 378 enabled_str = " (forced enabled)";
381 379 else if (edev->state == EISA_CONFIG_FORCED)
382 switch (edev->state) { 380 enabled_str = " (forced disabled)";
383 case EISA_CONFIG_ENABLED | EISA_CONFIG_FORCED: 381 else if (edev->state == 0)
384 printk(" (forced enabled)"); 382 enabled_str = " (disabled)";
385 break; 383 else
386 384 enabled_str = "";
387 case EISA_CONFIG_FORCED: 385
388 printk(" (forced disabled)"); 386 dev_info(&edev->dev, "EISA: slot %d: %s detected%s\n", i,
389 break; 387 edev->id.sig, enabled_str);
390
391 case 0:
392 printk(" (disabled)");
393 break;
394 }
395
396 printk (".\n");
397 388
398 c++; 389 c++;
399 390
400 if (eisa_register_device(edev)) { 391 if (eisa_register_device(edev)) {
401 printk(KERN_ERR "EISA: Failed to register %s\n", 392 dev_err(&edev->dev, "EISA: Failed to register %s\n",
402 edev->id.sig); 393 edev->id.sig);
403 eisa_release_resources(edev); 394 eisa_release_resources(edev);
404 kfree(edev); 395 kfree(edev);
405 } 396 }
406 } 397 }
407 398
408 printk(KERN_INFO "EISA: Detected %d card%s.\n", c, c == 1 ? "" : "s"); 399 dev_info(root->dev, "EISA: Detected %d card%s\n", c, c == 1 ? "" : "s");
409
410 return 0; 400 return 0;
411} 401}
412 402
diff --git a/drivers/eisa/pci_eisa.c b/drivers/eisa/pci_eisa.c
index 6c3fca97d346..a333bf3517de 100644
--- a/drivers/eisa/pci_eisa.c
+++ b/drivers/eisa/pci_eisa.c
@@ -25,8 +25,7 @@ static int __init pci_eisa_init(struct pci_dev *pdev)
25 struct resource *res, *bus_res = NULL; 25 struct resource *res, *bus_res = NULL;
26 26
27 if ((rc = pci_enable_device (pdev))) { 27 if ((rc = pci_enable_device (pdev))) {
28 printk (KERN_ERR "pci_eisa : Could not enable device %s\n", 28 dev_err(&pdev->dev, "Could not enable device\n");
29 pci_name(pdev));
30 return rc; 29 return rc;
31 } 30 }
32 31
@@ -59,7 +58,7 @@ static int __init pci_eisa_init(struct pci_dev *pdev)
59 dev_set_drvdata(pci_eisa_root.dev, &pci_eisa_root); 58 dev_set_drvdata(pci_eisa_root.dev, &pci_eisa_root);
60 59
61 if (eisa_root_register (&pci_eisa_root)) { 60 if (eisa_root_register (&pci_eisa_root)) {
62 printk (KERN_ERR "pci_eisa : Could not register EISA root\n"); 61 dev_err(&pdev->dev, "Could not register EISA root\n");
63 return -1; 62 return -1;
64 } 63 }
65 64