openwrt-owl/target/linux/brcm63xx/patches-3.3/412-bcm63xx_enet-use-resour...

70 lines
2.2 KiB
Diff
Raw Normal View History

From dbd9b51204aa4114756b8659e180139ef3878032 Mon Sep 17 00:00:00 2001
From: Maxime Bizon <mbizon@freebox.fr>
Date: Thu, 21 Jan 2010 17:28:36 +0100
Subject: [PATCH 28/63] bcm63xx_enet: use resource_size().
---
drivers/net/ethernet/broadcom/bcm63xx_enet.c | 18 ++++++++----------
1 files changed, 8 insertions(+), 10 deletions(-)
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
@@ -1594,7 +1594,6 @@ static int __devinit bcm_enet_probe(stru
struct resource *res_mem, *res_irq, *res_irq_rx, *res_irq_tx;
struct mii_bus *bus;
const char *clk_name;
- unsigned int iomem_size;
int i, ret;
/* stop if shared driver failed, assume driver->probe will be
@@ -1619,13 +1618,13 @@ static int __devinit bcm_enet_probe(stru
if (ret)
goto out;
- iomem_size = resource_size(res_mem);
- if (!request_mem_region(res_mem->start, iomem_size, "bcm63xx_enet")) {
+ if (!request_mem_region(res_mem->start, resource_size(res_mem),
+ "bcm63xx_enet")) {
ret = -EBUSY;
goto out;
}
- priv->base = ioremap(res_mem->start, iomem_size);
+ priv->base = ioremap(res_mem->start, resource_size(res_mem));
if (priv->base == NULL) {
ret = -ENOMEM;
goto out_release_mem;
@@ -1831,7 +1830,7 @@ out_unmap:
iounmap(priv->base);
out_release_mem:
- release_mem_region(res_mem->start, iomem_size);
+ release_mem_region(res_mem->start, resource_size(res_mem));
out:
free_netdev(dev);
return ret;
@@ -1903,19 +1902,18 @@ struct platform_driver bcm63xx_enet_driv
static int __devinit bcm_enet_shared_probe(struct platform_device *pdev)
{
struct resource *res;
- unsigned int iomem_size;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res)
return -ENODEV;
- iomem_size = resource_size(res);
- if (!request_mem_region(res->start, iomem_size, "bcm63xx_enet_dma"))
+ if (!request_mem_region(res->start, resource_size(res),
+ "bcm63xx_enet_dma"))
return -EBUSY;
- bcm_enet_shared_base = ioremap(res->start, iomem_size);
+ bcm_enet_shared_base = ioremap(res->start, resource_size(res));
if (!bcm_enet_shared_base) {
- release_mem_region(res->start, iomem_size);
+ release_mem_region(res->start, resource_size(res));
return -ENOMEM;
}
return 0;