Commit 26c0995e authored by Bjorn Helgaas's avatar Bjorn Helgaas

Merge branch 'pci/bjorn-eisa' into next

* pci/bjorn-eisa:
  EISA: Log device resources in dmesg
  EISA: Initialize device before its resources
  EISA: Mark vendor ID resource as I/O port space
  EISA: Use dev_printk() when possible
parents 272e70c0 a2080d0c
...@@ -275,19 +275,18 @@ static int __init eisa_request_resources(struct eisa_root_device *root, ...@@ -275,19 +275,18 @@ static int __init eisa_request_resources(struct eisa_root_device *root,
} }
if (slot) { if (slot) {
edev->res[i].name = NULL;
edev->res[i].start = SLOT_ADDRESS(root, slot) edev->res[i].start = SLOT_ADDRESS(root, slot)
+ (i * 0x400); + (i * 0x400);
edev->res[i].end = edev->res[i].start + 0xff; edev->res[i].end = edev->res[i].start + 0xff;
edev->res[i].flags = IORESOURCE_IO; edev->res[i].flags = IORESOURCE_IO;
} else { } else {
edev->res[i].name = NULL;
edev->res[i].start = SLOT_ADDRESS(root, slot) edev->res[i].start = SLOT_ADDRESS(root, slot)
+ EISA_VENDOR_ID_OFFSET; + EISA_VENDOR_ID_OFFSET;
edev->res[i].end = edev->res[i].start + 3; edev->res[i].end = edev->res[i].start + 3;
edev->res[i].flags = IORESOURCE_BUSY; edev->res[i].flags = IORESOURCE_IO | IORESOURCE_BUSY;
} }
dev_printk(KERN_DEBUG, &edev->dev, "%pR\n", &edev->res[i]);
if (request_resource(root->res, &edev->res[i])) if (request_resource(root->res, &edev->res[i]))
goto failed; goto failed;
} }
...@@ -314,40 +313,39 @@ static int __init eisa_probe(struct eisa_root_device *root) ...@@ -314,40 +313,39 @@ static int __init eisa_probe(struct eisa_root_device *root)
{ {
int i, c; int i, c;
struct eisa_device *edev; struct eisa_device *edev;
char *enabled_str;
printk(KERN_INFO "EISA: Probing bus %d at %s\n", dev_info(root->dev, "Probing EISA bus %d\n", root->bus_nr);
root->bus_nr, dev_name(root->dev));
/* First try to get hold of slot 0. If there is no device /* First try to get hold of slot 0. If there is no device
* here, simply fail, unless root->force_probe is set. */ * here, simply fail, unless root->force_probe is set. */
edev = kzalloc(sizeof(*edev), GFP_KERNEL); edev = kzalloc(sizeof(*edev), GFP_KERNEL);
if (!edev) { if (!edev) {
printk(KERN_ERR "EISA: Couldn't allocate mainboard slot\n"); dev_err(root->dev, "EISA: Couldn't allocate mainboard slot\n");
return -ENOMEM; return -ENOMEM;
} }
if (eisa_request_resources(root, edev, 0)) { if (eisa_init_device(root, edev, 0)) {
printk(KERN_WARNING \
"EISA: Cannot allocate resource for mainboard\n");
kfree(edev); kfree(edev);
if (!root->force_probe) if (!root->force_probe)
return -EBUSY; return -ENODEV;
goto force_probe; goto force_probe;
} }
if (eisa_init_device(root, edev, 0)) { if (eisa_request_resources(root, edev, 0)) {
eisa_release_resources(edev); dev_warn(root->dev,
"EISA: Cannot allocate resource for mainboard\n");
kfree(edev); kfree(edev);
if (!root->force_probe) if (!root->force_probe)
return -ENODEV; return -EBUSY;
goto force_probe; goto force_probe;
} }
printk(KERN_INFO "EISA: Mainboard %s detected.\n", edev->id.sig); dev_info(&edev->dev, "EISA: Mainboard %s detected\n", edev->id.sig);
if (eisa_register_device(edev)) { if (eisa_register_device(edev)) {
printk(KERN_ERR "EISA: Failed to register %s\n", dev_err(&edev->dev, "EISA: Failed to register %s\n",
edev->id.sig); edev->id.sig);
eisa_release_resources(edev); eisa_release_resources(edev);
kfree(edev); kfree(edev);
...@@ -358,55 +356,47 @@ static int __init eisa_probe(struct eisa_root_device *root) ...@@ -358,55 +356,47 @@ static int __init eisa_probe(struct eisa_root_device *root)
for (c = 0, i = 1; i <= root->slots; i++) { for (c = 0, i = 1; i <= root->slots; i++) {
edev = kzalloc(sizeof(*edev), GFP_KERNEL); edev = kzalloc(sizeof(*edev), GFP_KERNEL);
if (!edev) { if (!edev) {
printk(KERN_ERR "EISA: Out of memory for slot %d\n", i); dev_err(root->dev, "EISA: Out of memory for slot %d\n",
i);
continue; continue;
} }
if (eisa_request_resources(root, edev, i)) { if (eisa_init_device(root, edev, i)) {
printk(KERN_WARNING \
"Cannot allocate resource for EISA slot %d\n",
i);
kfree(edev); kfree(edev);
continue; continue;
} }
if (eisa_init_device(root, edev, i)) { if (eisa_request_resources(root, edev, i)) {
eisa_release_resources(edev); dev_warn(root->dev,
"Cannot allocate resource for EISA slot %d\n",
i);
kfree(edev); kfree(edev);
continue; continue;
} }
printk(KERN_INFO "EISA: slot %d : %s detected", if (edev->state == (EISA_CONFIG_ENABLED | EISA_CONFIG_FORCED))
i, edev->id.sig); enabled_str = " (forced enabled)";
else if (edev->state == EISA_CONFIG_FORCED)
switch (edev->state) { enabled_str = " (forced disabled)";
case EISA_CONFIG_ENABLED | EISA_CONFIG_FORCED: else if (edev->state == 0)
printk(" (forced enabled)"); enabled_str = " (disabled)";
break; else
enabled_str = "";
case EISA_CONFIG_FORCED:
printk(" (forced disabled)");
break;
case 0: dev_info(&edev->dev, "EISA: slot %d: %s detected%s\n", i,
printk(" (disabled)"); edev->id.sig, enabled_str);
break;
}
printk (".\n");
c++; c++;
if (eisa_register_device(edev)) { if (eisa_register_device(edev)) {
printk(KERN_ERR "EISA: Failed to register %s\n", dev_err(&edev->dev, "EISA: Failed to register %s\n",
edev->id.sig); edev->id.sig);
eisa_release_resources(edev); eisa_release_resources(edev);
kfree(edev); kfree(edev);
} }
} }
printk(KERN_INFO "EISA: Detected %d card%s.\n", c, c == 1 ? "" : "s"); dev_info(root->dev, "EISA: Detected %d card%s\n", c, c == 1 ? "" : "s");
return 0; return 0;
} }
......
...@@ -25,8 +25,7 @@ static int __init pci_eisa_init(struct pci_dev *pdev, ...@@ -25,8 +25,7 @@ static int __init pci_eisa_init(struct pci_dev *pdev,
int rc; int rc;
if ((rc = pci_enable_device (pdev))) { if ((rc = pci_enable_device (pdev))) {
printk (KERN_ERR "pci_eisa : Could not enable device %s\n", dev_err(&pdev->dev, "Could not enable device\n");
pci_name(pdev));
return rc; return rc;
} }
...@@ -38,7 +37,7 @@ static int __init pci_eisa_init(struct pci_dev *pdev, ...@@ -38,7 +37,7 @@ static int __init pci_eisa_init(struct pci_dev *pdev,
dev_set_drvdata(pci_eisa_root.dev, &pci_eisa_root); dev_set_drvdata(pci_eisa_root.dev, &pci_eisa_root);
if (eisa_root_register (&pci_eisa_root)) { if (eisa_root_register (&pci_eisa_root)) {
printk (KERN_ERR "pci_eisa : Could not register EISA root\n"); dev_err(&pdev->dev, "Could not register EISA root\n");
return -1; return -1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment