summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2013-04-15 14:34:02 -0600
committerBjorn Helgaas <bhelgaas@google.com>2013-04-15 14:34:02 -0600
commit26abfeed4341872364386c6a52b9acef8c81a81a (patch)
treedbb7865374312a017bb5d08816c8d0433474b2ab
parent76668257b26957ce2ca815da9e7d7fc740164123 (diff)
downloadlinux-26abfeed4341872364386c6a52b9acef8c81a81a.tar.bz2
EISA: Initialize device before its resources
Move eisa_init_device() before eisa_request_resources() so the device name is set before we set up its resources. That way we can print better messages. Previously edev->res[i].name was set to NULL in eisa_request_resources(), then filled in by eisa_init_device(). Now it is filled in by eisa_init_device() first, and we don't want to clear it out later in eisa_request_resources(). Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
-rw-r--r--drivers/eisa/eisa-bus.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/drivers/eisa/eisa-bus.c b/drivers/eisa/eisa-bus.c
index bf30dcb77bcb..d0c50b477d0b 100644
--- a/drivers/eisa/eisa-bus.c
+++ b/drivers/eisa/eisa-bus.c
@@ -275,13 +275,11 @@ static int __init eisa_request_resources(struct eisa_root_device *root,
}
if (slot) {
- edev->res[i].name = NULL;
edev->res[i].start = SLOT_ADDRESS(root, slot)
+ (i * 0x400);
edev->res[i].end = edev->res[i].start + 0xff;
edev->res[i].flags = IORESOURCE_IO;
} else {
- edev->res[i].name = NULL;
edev->res[i].start = SLOT_ADDRESS(root, slot)
+ EISA_VENDOR_ID_OFFSET;
edev->res[i].end = edev->res[i].start + 3;
@@ -327,20 +325,19 @@ static int __init eisa_probe(struct eisa_root_device *root)
return -ENOMEM;
}
- if (eisa_request_resources(root, edev, 0)) {
- dev_warn(root->dev,
- "EISA: Cannot allocate resource for mainboard\n");
+ if (eisa_init_device(root, edev, 0)) {
kfree(edev);
if (!root->force_probe)
- return -EBUSY;
+ return -ENODEV;
goto force_probe;
}
- if (eisa_init_device(root, edev, 0)) {
- eisa_release_resources(edev);
+ if (eisa_request_resources(root, edev, 0)) {
+ dev_warn(root->dev,
+ "EISA: Cannot allocate resource for mainboard\n");
kfree(edev);
if (!root->force_probe)
- return -ENODEV;
+ return -EBUSY;
goto force_probe;
}
@@ -363,16 +360,15 @@ static int __init eisa_probe(struct eisa_root_device *root)
continue;
}
- if (eisa_request_resources(root, edev, i)) {
- dev_warn(root->dev,
- "Cannot allocate resource for EISA slot %d\n",
- i);
+ if (eisa_init_device(root, edev, i)) {
kfree(edev);
continue;
}
- if (eisa_init_device(root, edev, i)) {
- eisa_release_resources(edev);
+ if (eisa_request_resources(root, edev, i)) {
+ dev_warn(root->dev,
+ "Cannot allocate resource for EISA slot %d\n",
+ i);
kfree(edev);
continue;
}