Commit 6f0e0135 authored by Tobias Klauser's avatar Tobias Klauser Committed by David S. Miller

niu: Use resource_size instead of private function

The function res_size in drivers/net/niu.c is a copy of resource_size in
linux/ioport.h. Remove the function and use resource_size instead.
Signed-off-by: default avatarTobias Klauser <tklauser@distanz.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3a5f29c1
...@@ -10145,11 +10145,6 @@ static const struct niu_ops niu_phys_ops = { ...@@ -10145,11 +10145,6 @@ static const struct niu_ops niu_phys_ops = {
.unmap_single = niu_phys_unmap_single, .unmap_single = niu_phys_unmap_single,
}; };
static unsigned long res_size(struct resource *r)
{
return r->end - r->start + 1UL;
}
static int __devinit niu_of_probe(struct of_device *op, static int __devinit niu_of_probe(struct of_device *op,
const struct of_device_id *match) const struct of_device_id *match)
{ {
...@@ -10189,7 +10184,7 @@ static int __devinit niu_of_probe(struct of_device *op, ...@@ -10189,7 +10184,7 @@ static int __devinit niu_of_probe(struct of_device *op,
dev->features |= (NETIF_F_SG | NETIF_F_HW_CSUM); dev->features |= (NETIF_F_SG | NETIF_F_HW_CSUM);
np->regs = of_ioremap(&op->resource[1], 0, np->regs = of_ioremap(&op->resource[1], 0,
res_size(&op->resource[1]), resource_size(&op->resource[1]),
"niu regs"); "niu regs");
if (!np->regs) { if (!np->regs) {
dev_err(&op->dev, PFX "Cannot map device registers, " dev_err(&op->dev, PFX "Cannot map device registers, "
...@@ -10199,7 +10194,7 @@ static int __devinit niu_of_probe(struct of_device *op, ...@@ -10199,7 +10194,7 @@ static int __devinit niu_of_probe(struct of_device *op,
} }
np->vir_regs_1 = of_ioremap(&op->resource[2], 0, np->vir_regs_1 = of_ioremap(&op->resource[2], 0,
res_size(&op->resource[2]), resource_size(&op->resource[2]),
"niu vregs-1"); "niu vregs-1");
if (!np->vir_regs_1) { if (!np->vir_regs_1) {
dev_err(&op->dev, PFX "Cannot map device vir registers 1, " dev_err(&op->dev, PFX "Cannot map device vir registers 1, "
...@@ -10209,7 +10204,7 @@ static int __devinit niu_of_probe(struct of_device *op, ...@@ -10209,7 +10204,7 @@ static int __devinit niu_of_probe(struct of_device *op,
} }
np->vir_regs_2 = of_ioremap(&op->resource[3], 0, np->vir_regs_2 = of_ioremap(&op->resource[3], 0,
res_size(&op->resource[3]), resource_size(&op->resource[3]),
"niu vregs-2"); "niu vregs-2");
if (!np->vir_regs_2) { if (!np->vir_regs_2) {
dev_err(&op->dev, PFX "Cannot map device vir registers 2, " dev_err(&op->dev, PFX "Cannot map device vir registers 2, "
...@@ -10244,19 +10239,19 @@ static int __devinit niu_of_probe(struct of_device *op, ...@@ -10244,19 +10239,19 @@ static int __devinit niu_of_probe(struct of_device *op,
err_out_iounmap: err_out_iounmap:
if (np->vir_regs_1) { if (np->vir_regs_1) {
of_iounmap(&op->resource[2], np->vir_regs_1, of_iounmap(&op->resource[2], np->vir_regs_1,
res_size(&op->resource[2])); resource_size(&op->resource[2]));
np->vir_regs_1 = NULL; np->vir_regs_1 = NULL;
} }
if (np->vir_regs_2) { if (np->vir_regs_2) {
of_iounmap(&op->resource[3], np->vir_regs_2, of_iounmap(&op->resource[3], np->vir_regs_2,
res_size(&op->resource[3])); resource_size(&op->resource[3]));
np->vir_regs_2 = NULL; np->vir_regs_2 = NULL;
} }
if (np->regs) { if (np->regs) {
of_iounmap(&op->resource[1], np->regs, of_iounmap(&op->resource[1], np->regs,
res_size(&op->resource[1])); resource_size(&op->resource[1]));
np->regs = NULL; np->regs = NULL;
} }
...@@ -10281,19 +10276,19 @@ static int __devexit niu_of_remove(struct of_device *op) ...@@ -10281,19 +10276,19 @@ static int __devexit niu_of_remove(struct of_device *op)
if (np->vir_regs_1) { if (np->vir_regs_1) {
of_iounmap(&op->resource[2], np->vir_regs_1, of_iounmap(&op->resource[2], np->vir_regs_1,
res_size(&op->resource[2])); resource_size(&op->resource[2]));
np->vir_regs_1 = NULL; np->vir_regs_1 = NULL;
} }
if (np->vir_regs_2) { if (np->vir_regs_2) {
of_iounmap(&op->resource[3], np->vir_regs_2, of_iounmap(&op->resource[3], np->vir_regs_2,
res_size(&op->resource[3])); resource_size(&op->resource[3]));
np->vir_regs_2 = NULL; np->vir_regs_2 = NULL;
} }
if (np->regs) { if (np->regs) {
of_iounmap(&op->resource[1], np->regs, of_iounmap(&op->resource[1], np->regs,
res_size(&op->resource[1])); resource_size(&op->resource[1]));
np->regs = NULL; np->regs = NULL;
} }
......
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