diff options
Diffstat (limited to 'drivers/net/niu.c')
-rw-r--r-- | drivers/net/niu.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/drivers/net/niu.c b/drivers/net/niu.c index 119fd4e04141..76cc2614f480 100644 --- a/drivers/net/niu.c +++ b/drivers/net/niu.c | |||
@@ -10145,11 +10145,6 @@ static const struct niu_ops niu_phys_ops = { | |||
10145 | .unmap_single = niu_phys_unmap_single, | 10145 | .unmap_single = niu_phys_unmap_single, |
10146 | }; | 10146 | }; |
10147 | 10147 | ||
10148 | static unsigned long res_size(struct resource *r) | ||
10149 | { | ||
10150 | return r->end - r->start + 1UL; | ||
10151 | } | ||
10152 | |||
10153 | static int __devinit niu_of_probe(struct of_device *op, | 10148 | static int __devinit niu_of_probe(struct of_device *op, |
10154 | const struct of_device_id *match) | 10149 | const struct of_device_id *match) |
10155 | { | 10150 | { |
@@ -10189,7 +10184,7 @@ static int __devinit niu_of_probe(struct of_device *op, | |||
10189 | dev->features |= (NETIF_F_SG | NETIF_F_HW_CSUM); | 10184 | dev->features |= (NETIF_F_SG | NETIF_F_HW_CSUM); |
10190 | 10185 | ||
10191 | np->regs = of_ioremap(&op->resource[1], 0, | 10186 | np->regs = of_ioremap(&op->resource[1], 0, |
10192 | res_size(&op->resource[1]), | 10187 | resource_size(&op->resource[1]), |
10193 | "niu regs"); | 10188 | "niu regs"); |
10194 | if (!np->regs) { | 10189 | if (!np->regs) { |
10195 | dev_err(&op->dev, PFX "Cannot map device registers, " | 10190 | dev_err(&op->dev, PFX "Cannot map device registers, " |
@@ -10199,7 +10194,7 @@ static int __devinit niu_of_probe(struct of_device *op, | |||
10199 | } | 10194 | } |
10200 | 10195 | ||
10201 | np->vir_regs_1 = of_ioremap(&op->resource[2], 0, | 10196 | np->vir_regs_1 = of_ioremap(&op->resource[2], 0, |
10202 | res_size(&op->resource[2]), | 10197 | resource_size(&op->resource[2]), |
10203 | "niu vregs-1"); | 10198 | "niu vregs-1"); |
10204 | if (!np->vir_regs_1) { | 10199 | if (!np->vir_regs_1) { |
10205 | dev_err(&op->dev, PFX "Cannot map device vir registers 1, " | 10200 | 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 | } | 10204 | } |
10210 | 10205 | ||
10211 | np->vir_regs_2 = of_ioremap(&op->resource[3], 0, | 10206 | np->vir_regs_2 = of_ioremap(&op->resource[3], 0, |
10212 | res_size(&op->resource[3]), | 10207 | resource_size(&op->resource[3]), |
10213 | "niu vregs-2"); | 10208 | "niu vregs-2"); |
10214 | if (!np->vir_regs_2) { | 10209 | if (!np->vir_regs_2) { |
10215 | dev_err(&op->dev, PFX "Cannot map device vir registers 2, " | 10210 | 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 | err_out_iounmap: | 10239 | err_out_iounmap: |
10245 | if (np->vir_regs_1) { | 10240 | if (np->vir_regs_1) { |
10246 | of_iounmap(&op->resource[2], np->vir_regs_1, | 10241 | of_iounmap(&op->resource[2], np->vir_regs_1, |
10247 | res_size(&op->resource[2])); | 10242 | resource_size(&op->resource[2])); |
10248 | np->vir_regs_1 = NULL; | 10243 | np->vir_regs_1 = NULL; |
10249 | } | 10244 | } |
10250 | 10245 | ||
10251 | if (np->vir_regs_2) { | 10246 | if (np->vir_regs_2) { |
10252 | of_iounmap(&op->resource[3], np->vir_regs_2, | 10247 | of_iounmap(&op->resource[3], np->vir_regs_2, |
10253 | res_size(&op->resource[3])); | 10248 | resource_size(&op->resource[3])); |
10254 | np->vir_regs_2 = NULL; | 10249 | np->vir_regs_2 = NULL; |
10255 | } | 10250 | } |
10256 | 10251 | ||
10257 | if (np->regs) { | 10252 | if (np->regs) { |
10258 | of_iounmap(&op->resource[1], np->regs, | 10253 | of_iounmap(&op->resource[1], np->regs, |
10259 | res_size(&op->resource[1])); | 10254 | resource_size(&op->resource[1])); |
10260 | np->regs = NULL; | 10255 | np->regs = NULL; |
10261 | } | 10256 | } |
10262 | 10257 | ||
@@ -10281,19 +10276,19 @@ static int __devexit niu_of_remove(struct of_device *op) | |||
10281 | 10276 | ||
10282 | if (np->vir_regs_1) { | 10277 | if (np->vir_regs_1) { |
10283 | of_iounmap(&op->resource[2], np->vir_regs_1, | 10278 | of_iounmap(&op->resource[2], np->vir_regs_1, |
10284 | res_size(&op->resource[2])); | 10279 | resource_size(&op->resource[2])); |
10285 | np->vir_regs_1 = NULL; | 10280 | np->vir_regs_1 = NULL; |
10286 | } | 10281 | } |
10287 | 10282 | ||
10288 | if (np->vir_regs_2) { | 10283 | if (np->vir_regs_2) { |
10289 | of_iounmap(&op->resource[3], np->vir_regs_2, | 10284 | of_iounmap(&op->resource[3], np->vir_regs_2, |
10290 | res_size(&op->resource[3])); | 10285 | resource_size(&op->resource[3])); |
10291 | np->vir_regs_2 = NULL; | 10286 | np->vir_regs_2 = NULL; |
10292 | } | 10287 | } |
10293 | 10288 | ||
10294 | if (np->regs) { | 10289 | if (np->regs) { |
10295 | of_iounmap(&op->resource[1], np->regs, | 10290 | of_iounmap(&op->resource[1], np->regs, |
10296 | res_size(&op->resource[1])); | 10291 | resource_size(&op->resource[1])); |
10297 | np->regs = NULL; | 10292 | np->regs = NULL; |
10298 | } | 10293 | } |
10299 | 10294 | ||