[PATCH] eisa: do not force probe if cannot allocate resource onmainboard

From: Eduardo Silva
Date: Thu May 19 2011 - 17:01:06 EST


if the eisa_probe() function fails to allocate resource for the
mainboard in question, it performs a force probe over the available
slots and print all fails in the logs. e.g:

[ 1.264550] EISA: Cannot allocate resource for mainboard
[ 1.264552] Cannot allocate resource for EISA slot 1
[ 1.264554] Cannot allocate resource for EISA slot 2
[ 1.264556] Cannot allocate resource for EISA slot 3
[ 1.264557] Cannot allocate resource for EISA slot 4
[ 1.264559] Cannot allocate resource for EISA slot 5
[ 1.264561] Cannot allocate resource for EISA slot 6
[ 1.264563] Cannot allocate resource for EISA slot 7
[ 1.264564] Cannot allocate resource for EISA slot 8
[ 1.264566] EISA: Detected 0 cards.

The force probe for this specific condition always fails. The
patch make it to skip the force probe and print a more detailed ending
message to the log adding the number available slots:

[ 1.264550] EISA: Cannot allocate resource for mainboard
[ 1.264566] EISA: Detected 0 cards in 8 slots.

Signed-off-by: Eduardo Silva <edsiper@xxxxxxxxx>
---
drivers/eisa/eisa-bus.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/eisa/eisa-bus.c b/drivers/eisa/eisa-bus.c
index 806c77b..1cf37e0 100644
--- a/drivers/eisa/eisa-bus.c
+++ b/drivers/eisa/eisa-bus.c
@@ -312,7 +312,7 @@ static void __init eisa_release_resources(struct eisa_device *edev)

static int __init eisa_probe(struct eisa_root_device *root)
{
- int i, c;
+ int i, c = 0;
struct eisa_device *edev;

printk(KERN_INFO "EISA: Probing bus %d at %s\n",
@@ -333,7 +333,7 @@ static int __init eisa_probe(struct eisa_root_device *root)
kfree(edev);
if (!root->force_probe)
return -EBUSY;
- goto force_probe;
+ goto out;
}

if (eisa_init_device(root, edev, 0)) {
@@ -355,7 +355,7 @@ static int __init eisa_probe(struct eisa_root_device *root)

force_probe:

- for (c = 0, i = 1; i <= root->slots; i++) {
+ for (i = 1; i <= root->slots; i++) {
edev = kzalloc(sizeof(*edev), GFP_KERNEL);
if (!edev) {
printk(KERN_ERR "EISA: Out of memory for slot %d\n", i);
@@ -405,7 +405,9 @@ static int __init eisa_probe(struct eisa_root_device *root)
}
}

- printk(KERN_INFO "EISA: Detected %d card%s.\n", c, c == 1 ? "" : "s");
+ out:
+ printk(KERN_INFO "EISA: Detected %d card%s in %d slots.\n", c,
+ c == 1 ? "" : "s", root->slots);

return 0;
}
--
1.7.4.1




--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/