Commit fe12455c authored by Russell King's avatar Russell King

[ARM] Use ecard_{request,release}_resources() for resource management

Signed-off-by: default avatarRussell King <rmk@arm.linux.org.uk>
parent 7af60616
......@@ -997,15 +997,18 @@ static int __devinit
ether1_probe(struct expansion_card *ec, const struct ecard_id *id)
{
struct net_device *dev;
struct ether1_priv *priv;
int i, ret = 0;
ether1_banner();
ret = ecard_request_resources(ec);
if (ret)
goto out;
dev = alloc_etherdev(sizeof(struct ether1_priv));
if (!dev) {
ret = -ENOMEM;
goto out;
goto release;
}
SET_MODULE_OWNER(dev);
......@@ -1013,15 +1016,9 @@ ether1_probe(struct expansion_card *ec, const struct ecard_id *id)
dev->base_addr = ecard_address(ec, ECARD_IOC, ECARD_FAST);
dev->irq = ec->irq;
/*
* these will not fail - the nature of the bus ensures this
*/
request_region(dev->base_addr, 16, dev->name);
request_region(dev->base_addr + 0x800, 4096, dev->name);
if ((priv(dev)->bus_type = ether1_reset(dev)) == 0) {
ret = -ENODEV;
goto release;
goto free;
}
for (i = 0; i < 6; i++)
......@@ -1029,7 +1026,7 @@ ether1_probe(struct expansion_card *ec, const struct ecard_id *id)
if (ether1_init_2(dev)) {
ret = -ENODEV;
goto release;
goto free;
}
dev->open = ether1_open;
......@@ -1042,7 +1039,7 @@ ether1_probe(struct expansion_card *ec, const struct ecard_id *id)
ret = register_netdev(dev);
if (ret)
goto release;
goto free;
printk(KERN_INFO "%s: ether1 in slot %d, ",
dev->name, ec->slot_no);
......@@ -1053,11 +1050,11 @@ ether1_probe(struct expansion_card *ec, const struct ecard_id *id)
ecard_set_drvdata(ec, dev);
return 0;
release:
release_region(dev->base_addr, 16);
release_region(dev->base_addr + 0x800, 4096);
free:
free_netdev(dev);
out:
release:
ecard_release_resources(ec);
out:
return ret;
}
......@@ -1068,10 +1065,8 @@ static void __devexit ether1_remove(struct expansion_card *ec)
ecard_set_drvdata(ec, NULL);
unregister_netdev(dev);
release_region(dev->base_addr, 16);
release_region(dev->base_addr + 0x800, 4096);
free_netdev(dev);
ecard_release_resources(ec);
}
static const struct ecard_id ether1_ids[] = {
......
......@@ -804,10 +804,14 @@ ether3_probe(struct expansion_card *ec, const struct ecard_id *id)
ether3_banner();
ret = ecard_request_resources(ec);
if (ret)
goto out;
dev = alloc_etherdev(sizeof(struct dev_priv));
if (!dev) {
ret = -ENOMEM;
goto out;
goto release;
}
SET_MODULE_OWNER(dev);
......@@ -818,14 +822,6 @@ ether3_probe(struct expansion_card *ec, const struct ecard_id *id)
goto free;
}
/*
* this will not fail - the nature of the bus ensures this
*/
if (!request_region(dev->base_addr, 128, dev->name)) {
ret = -EBUSY;
goto free;
}
init_timer(&priv(dev)->timer);
/* Reset card...
......@@ -850,13 +846,13 @@ ether3_probe(struct expansion_card *ec, const struct ecard_id *id)
case BUS_UNKNOWN:
printk(KERN_ERR "%s: unable to identify bus width\n", dev->name);
ret = -ENODEV;
goto failed;
goto free;
case BUS_8:
printk(KERN_ERR "%s: %s found, but is an unsupported "
"8-bit card\n", dev->name, name);
ret = -ENODEV;
goto failed;
goto free;
default:
break;
......@@ -864,7 +860,7 @@ ether3_probe(struct expansion_card *ec, const struct ecard_id *id)
if (ether3_init_2(dev)) {
ret = -ENODEV;
goto failed;
goto free;
}
dev->open = ether3_open;
......@@ -877,7 +873,7 @@ ether3_probe(struct expansion_card *ec, const struct ecard_id *id)
ret = register_netdev(dev);
if (ret)
goto failed;
goto free;
printk("%s: %s in slot %d, ", dev->name, name, ec->slot_no);
for (i = 0; i < 6; i++)
......@@ -886,11 +882,11 @@ ether3_probe(struct expansion_card *ec, const struct ecard_id *id)
ecard_set_drvdata(ec, dev);
return 0;
failed:
release_region(dev->base_addr, 128);
free:
free:
free_netdev(dev);
out:
release:
ecard_release_resources(ec);
out:
return ret;
}
......@@ -901,8 +897,8 @@ static void __devexit ether3_remove(struct expansion_card *ec)
ecard_set_drvdata(ec, NULL);
unregister_netdev(dev);
release_region(dev->base_addr, 128);
free_netdev(dev);
ecard_release_resources(ec);
}
static const struct ecard_id ether3_ids[] = {
......
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