Skip to content

Commit

Permalink
Revert "EISA: Initialize device before its resources"
Browse files Browse the repository at this point in the history
This reverts commit 26abfee.

In the eisa_probe() force_probe path, if we were unable to request slot
resources (e.g., [io 0x800-0x8ff]), we skipped the slot with "Cannot
allocate resource for EISA slot %d" before reading the EISA signature in
eisa_init_device().

Commit 26abfee moved eisa_init_device() earlier, so we tried to read
the EISA signature before requesting the slot resources, and this caused
hangs during boot.

Link: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1251816
Signed-off-by: Bjorn Helgaas <[email protected]>
CC: [email protected]	# v3.10+ a2080d0: Revert "EISA: Log device resources in dmesg"
  • Loading branch information
bjorn-helgaas committed Jan 17, 2014
1 parent bea1b0b commit 765ee51
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions drivers/eisa/eisa-bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,11 +277,13 @@ 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;
Expand Down Expand Up @@ -327,19 +329,20 @@ static int __init eisa_probe(struct eisa_root_device *root)
return -ENOMEM;
}

if (eisa_init_device(root, edev, 0)) {
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;
}

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)) {
eisa_release_resources(edev);
kfree(edev);
if (!root->force_probe)
return -EBUSY;
return -ENODEV;
goto force_probe;
}

Expand All @@ -362,11 +365,6 @@ static int __init eisa_probe(struct eisa_root_device *root)
continue;
}

if (eisa_init_device(root, edev, i)) {
kfree(edev);
continue;
}

if (eisa_request_resources(root, edev, i)) {
dev_warn(root->dev,
"Cannot allocate resource for EISA slot %d\n",
Expand All @@ -375,6 +373,12 @@ static int __init eisa_probe(struct eisa_root_device *root)
continue;
}

if (eisa_init_device(root, edev, i)) {
eisa_release_resources(edev);
kfree(edev);
continue;
}

if (edev->state == (EISA_CONFIG_ENABLED | EISA_CONFIG_FORCED))
enabled_str = " (forced enabled)";
else if (edev->state == EISA_CONFIG_FORCED)
Expand Down

0 comments on commit 765ee51

Please sign in to comment.