diff options
Diffstat (limited to 'drivers')
101 files changed, 190 insertions, 204 deletions
diff --git a/drivers/char/bsr.c b/drivers/char/bsr.c index cf39bc08ce08..0c688232aab3 100644 --- a/drivers/char/bsr.c +++ b/drivers/char/bsr.c | |||
@@ -212,7 +212,7 @@ static int bsr_add_node(struct device_node *bn) | |||
212 | 212 | ||
213 | cur->bsr_minor = i + total_bsr_devs; | 213 | cur->bsr_minor = i + total_bsr_devs; |
214 | cur->bsr_addr = res.start; | 214 | cur->bsr_addr = res.start; |
215 | cur->bsr_len = res.end - res.start + 1; | 215 | cur->bsr_len = resource_size(&res); |
216 | cur->bsr_bytes = bsr_bytes[i]; | 216 | cur->bsr_bytes = bsr_bytes[i]; |
217 | cur->bsr_stride = bsr_stride[i]; | 217 | cur->bsr_stride = bsr_stride[i]; |
218 | cur->bsr_dev = MKDEV(bsr_major, i + total_bsr_devs); | 218 | cur->bsr_dev = MKDEV(bsr_major, i + total_bsr_devs); |
diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c index 39ccdeada791..e90e1c74fd4c 100644 --- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c +++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c | |||
@@ -621,7 +621,7 @@ static int __devinit hwicap_setup(struct device *dev, int id, | |||
621 | 621 | ||
622 | drvdata->mem_start = regs_res->start; | 622 | drvdata->mem_start = regs_res->start; |
623 | drvdata->mem_end = regs_res->end; | 623 | drvdata->mem_end = regs_res->end; |
624 | drvdata->mem_size = regs_res->end - regs_res->start + 1; | 624 | drvdata->mem_size = resource_size(regs_res); |
625 | 625 | ||
626 | if (!request_mem_region(drvdata->mem_start, | 626 | if (!request_mem_region(drvdata->mem_start, |
627 | drvdata->mem_size, DRIVER_NAME)) { | 627 | drvdata->mem_size, DRIVER_NAME)) { |
diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c index 954e334e01bb..06f9f27dbe7c 100644 --- a/drivers/dma/mv_xor.c +++ b/drivers/dma/mv_xor.c | |||
@@ -1304,8 +1304,7 @@ static int mv_xor_shared_probe(struct platform_device *pdev) | |||
1304 | if (!res) | 1304 | if (!res) |
1305 | return -ENODEV; | 1305 | return -ENODEV; |
1306 | 1306 | ||
1307 | msp->xor_base = devm_ioremap(&pdev->dev, res->start, | 1307 | msp->xor_base = devm_ioremap(&pdev->dev, res->start, resource_size(res)); |
1308 | res->end - res->start + 1); | ||
1309 | if (!msp->xor_base) | 1308 | if (!msp->xor_base) |
1310 | return -EBUSY; | 1309 | return -EBUSY; |
1311 | 1310 | ||
@@ -1314,7 +1313,7 @@ static int mv_xor_shared_probe(struct platform_device *pdev) | |||
1314 | return -ENODEV; | 1313 | return -ENODEV; |
1315 | 1314 | ||
1316 | msp->xor_high_base = devm_ioremap(&pdev->dev, res->start, | 1315 | msp->xor_high_base = devm_ioremap(&pdev->dev, res->start, |
1317 | res->end - res->start + 1); | 1316 | resource_size(res)); |
1318 | if (!msp->xor_high_base) | 1317 | if (!msp->xor_high_base) |
1319 | return -EBUSY; | 1318 | return -EBUSY; |
1320 | 1319 | ||
diff --git a/drivers/edac/cell_edac.c b/drivers/edac/cell_edac.c index db1df59ae2b6..9a6a274e6925 100644 --- a/drivers/edac/cell_edac.c +++ b/drivers/edac/cell_edac.c | |||
@@ -140,7 +140,7 @@ static void __devinit cell_edac_init_csrows(struct mem_ctl_info *mci) | |||
140 | if (of_node_to_nid(np) != priv->node) | 140 | if (of_node_to_nid(np) != priv->node) |
141 | continue; | 141 | continue; |
142 | csrow->first_page = r.start >> PAGE_SHIFT; | 142 | csrow->first_page = r.start >> PAGE_SHIFT; |
143 | csrow->nr_pages = (r.end - r.start + 1) >> PAGE_SHIFT; | 143 | csrow->nr_pages = resource_size(&r) >> PAGE_SHIFT; |
144 | csrow->last_page = csrow->first_page + csrow->nr_pages - 1; | 144 | csrow->last_page = csrow->first_page + csrow->nr_pages - 1; |
145 | csrow->mtype = MEM_XDR; | 145 | csrow->mtype = MEM_XDR; |
146 | csrow->edac_mode = EDAC_SECDED; | 146 | csrow->edac_mode = EDAC_SECDED; |
diff --git a/drivers/edac/mpc85xx_edac.c b/drivers/edac/mpc85xx_edac.c index 38ab8e2cd7f4..11e1a5dad96f 100644 --- a/drivers/edac/mpc85xx_edac.c +++ b/drivers/edac/mpc85xx_edac.c | |||
@@ -538,15 +538,15 @@ static int __devinit mpc85xx_l2_err_probe(struct platform_device *op) | |||
538 | /* we only need the error registers */ | 538 | /* we only need the error registers */ |
539 | r.start += 0xe00; | 539 | r.start += 0xe00; |
540 | 540 | ||
541 | if (!devm_request_mem_region(&op->dev, r.start, | 541 | if (!devm_request_mem_region(&op->dev, r.start, resource_size(&r), |
542 | r.end - r.start + 1, pdata->name)) { | 542 | pdata->name)) { |
543 | printk(KERN_ERR "%s: Error while requesting mem region\n", | 543 | printk(KERN_ERR "%s: Error while requesting mem region\n", |
544 | __func__); | 544 | __func__); |
545 | res = -EBUSY; | 545 | res = -EBUSY; |
546 | goto err; | 546 | goto err; |
547 | } | 547 | } |
548 | 548 | ||
549 | pdata->l2_vbase = devm_ioremap(&op->dev, r.start, r.end - r.start + 1); | 549 | pdata->l2_vbase = devm_ioremap(&op->dev, r.start, resource_size(&r)); |
550 | if (!pdata->l2_vbase) { | 550 | if (!pdata->l2_vbase) { |
551 | printk(KERN_ERR "%s: Unable to setup L2 err regs\n", __func__); | 551 | printk(KERN_ERR "%s: Unable to setup L2 err regs\n", __func__); |
552 | res = -ENOMEM; | 552 | res = -ENOMEM; |
@@ -987,15 +987,15 @@ static int __devinit mpc85xx_mc_err_probe(struct platform_device *op) | |||
987 | goto err; | 987 | goto err; |
988 | } | 988 | } |
989 | 989 | ||
990 | if (!devm_request_mem_region(&op->dev, r.start, | 990 | if (!devm_request_mem_region(&op->dev, r.start, resource_size(&r), |
991 | r.end - r.start + 1, pdata->name)) { | 991 | pdata->name)) { |
992 | printk(KERN_ERR "%s: Error while requesting mem region\n", | 992 | printk(KERN_ERR "%s: Error while requesting mem region\n", |
993 | __func__); | 993 | __func__); |
994 | res = -EBUSY; | 994 | res = -EBUSY; |
995 | goto err; | 995 | goto err; |
996 | } | 996 | } |
997 | 997 | ||
998 | pdata->mc_vbase = devm_ioremap(&op->dev, r.start, r.end - r.start + 1); | 998 | pdata->mc_vbase = devm_ioremap(&op->dev, r.start, resource_size(&r)); |
999 | if (!pdata->mc_vbase) { | 999 | if (!pdata->mc_vbase) { |
1000 | printk(KERN_ERR "%s: Unable to setup MC err regs\n", __func__); | 1000 | printk(KERN_ERR "%s: Unable to setup MC err regs\n", __func__); |
1001 | res = -ENOMEM; | 1001 | res = -ENOMEM; |
diff --git a/drivers/gpio/gpio-u300.c b/drivers/gpio/gpio-u300.c index d92790140fe5..1a86fefd0f83 100644 --- a/drivers/gpio/gpio-u300.c +++ b/drivers/gpio/gpio-u300.c | |||
@@ -581,8 +581,8 @@ static int __init gpio_probe(struct platform_device *pdev) | |||
581 | if (!memres) | 581 | if (!memres) |
582 | goto err_no_resource; | 582 | goto err_no_resource; |
583 | 583 | ||
584 | if (request_mem_region(memres->start, memres->end - memres->start, "GPIO Controller") | 584 | if (!request_mem_region(memres->start, resource_size(memres), |
585 | == NULL) { | 585 | "GPIO Controller")) { |
586 | err = -ENODEV; | 586 | err = -ENODEV; |
587 | goto err_no_ioregion; | 587 | goto err_no_ioregion; |
588 | } | 588 | } |
@@ -640,7 +640,7 @@ static int __init gpio_probe(struct platform_device *pdev) | |||
640 | free_irq(gpio_ports[i].irq, &gpio_ports[i]); | 640 | free_irq(gpio_ports[i].irq, &gpio_ports[i]); |
641 | iounmap(virtbase); | 641 | iounmap(virtbase); |
642 | err_no_ioremap: | 642 | err_no_ioremap: |
643 | release_mem_region(memres->start, memres->end - memres->start); | 643 | release_mem_region(memres->start, resource_size(memres)); |
644 | err_no_ioregion: | 644 | err_no_ioregion: |
645 | err_no_resource: | 645 | err_no_resource: |
646 | clk_disable(clk); | 646 | clk_disable(clk); |
@@ -660,7 +660,7 @@ static int __exit gpio_remove(struct platform_device *pdev) | |||
660 | for (i = 0 ; i < U300_GPIO_NUM_PORTS; i++) | 660 | for (i = 0 ; i < U300_GPIO_NUM_PORTS; i++) |
661 | free_irq(gpio_ports[i].irq, &gpio_ports[i]); | 661 | free_irq(gpio_ports[i].irq, &gpio_ports[i]); |
662 | iounmap(virtbase); | 662 | iounmap(virtbase); |
663 | release_mem_region(memres->start, memres->end - memres->start); | 663 | release_mem_region(memres->start, resource_size(memres)); |
664 | clk_disable(clk); | 664 | clk_disable(clk); |
665 | clk_put(clk); | 665 | clk_put(clk); |
666 | return 0; | 666 | return 0; |
diff --git a/drivers/ide/palm_bk3710.c b/drivers/ide/palm_bk3710.c index 9e8f4e1b0cc9..712c7904d03e 100644 --- a/drivers/ide/palm_bk3710.c +++ b/drivers/ide/palm_bk3710.c | |||
@@ -342,7 +342,7 @@ static int __init palm_bk3710_probe(struct platform_device *pdev) | |||
342 | return -ENODEV; | 342 | return -ENODEV; |
343 | } | 343 | } |
344 | 344 | ||
345 | mem_size = mem->end - mem->start + 1; | 345 | mem_size = resource_size(mem); |
346 | if (request_mem_region(mem->start, mem_size, "palm_bk3710") == NULL) { | 346 | if (request_mem_region(mem->start, mem_size, "palm_bk3710") == NULL) { |
347 | printk(KERN_ERR "failed to request memory region\n"); | 347 | printk(KERN_ERR "failed to request memory region\n"); |
348 | return -EBUSY; | 348 | return -EBUSY; |
diff --git a/drivers/ide/tx4939ide.c b/drivers/ide/tx4939ide.c index bed3e39aac96..71c231954972 100644 --- a/drivers/ide/tx4939ide.c +++ b/drivers/ide/tx4939ide.c | |||
@@ -551,10 +551,10 @@ static int __init tx4939ide_probe(struct platform_device *pdev) | |||
551 | return -ENODEV; | 551 | return -ENODEV; |
552 | 552 | ||
553 | if (!devm_request_mem_region(&pdev->dev, res->start, | 553 | if (!devm_request_mem_region(&pdev->dev, res->start, |
554 | res->end - res->start + 1, "tx4938ide")) | 554 | resource_size(res), "tx4938ide")) |
555 | return -EBUSY; | 555 | return -EBUSY; |
556 | mapbase = (unsigned long)devm_ioremap(&pdev->dev, res->start, | 556 | mapbase = (unsigned long)devm_ioremap(&pdev->dev, res->start, |
557 | res->end - res->start + 1); | 557 | resource_size(res)); |
558 | if (!mapbase) | 558 | if (!mapbase) |
559 | return -EBUSY; | 559 | return -EBUSY; |
560 | memset(&hw, 0, sizeof(hw)); | 560 | memset(&hw, 0, sizeof(hw)); |
diff --git a/drivers/input/serio/sa1111ps2.c b/drivers/input/serio/sa1111ps2.c index d55874e5d1c2..44fc8b4bcd81 100644 --- a/drivers/input/serio/sa1111ps2.c +++ b/drivers/input/serio/sa1111ps2.c | |||
@@ -300,8 +300,7 @@ static int __devinit ps2_probe(struct sa1111_dev *dev) | |||
300 | 300 | ||
301 | out: | 301 | out: |
302 | sa1111_disable_device(ps2if->dev); | 302 | sa1111_disable_device(ps2if->dev); |
303 | release_mem_region(dev->res.start, | 303 | release_mem_region(dev->res.start, resource_size(&dev->res)); |
304 | dev->res.end - dev->res.start + 1); | ||
305 | free: | 304 | free: |
306 | sa1111_set_drvdata(dev, NULL); | 305 | sa1111_set_drvdata(dev, NULL); |
307 | kfree(ps2if); | 306 | kfree(ps2if); |
@@ -317,8 +316,7 @@ static int __devexit ps2_remove(struct sa1111_dev *dev) | |||
317 | struct ps2if *ps2if = sa1111_get_drvdata(dev); | 316 | struct ps2if *ps2if = sa1111_get_drvdata(dev); |
318 | 317 | ||
319 | serio_unregister_port(ps2if->io); | 318 | serio_unregister_port(ps2if->io); |
320 | release_mem_region(dev->res.start, | 319 | release_mem_region(dev->res.start, resource_size(&dev->res)); |
321 | dev->res.end - dev->res.start + 1); | ||
322 | sa1111_set_drvdata(dev, NULL); | 320 | sa1111_set_drvdata(dev, NULL); |
323 | 321 | ||
324 | kfree(ps2if); | 322 | kfree(ps2if); |
diff --git a/drivers/media/video/davinci/vpif.c b/drivers/media/video/davinci/vpif.c index 9f3bfc1eb240..af9680273ff9 100644 --- a/drivers/media/video/davinci/vpif.c +++ b/drivers/media/video/davinci/vpif.c | |||
@@ -422,7 +422,7 @@ static int __init vpif_probe(struct platform_device *pdev) | |||
422 | if (!res) | 422 | if (!res) |
423 | return -ENOENT; | 423 | return -ENOENT; |
424 | 424 | ||
425 | res_len = res->end - res->start + 1; | 425 | res_len = resource_size(res); |
426 | 426 | ||
427 | res = request_mem_region(res->start, res_len, res->name); | 427 | res = request_mem_region(res->start, res_len, res->name); |
428 | if (!res) | 428 | if (!res) |
diff --git a/drivers/media/video/omap24xxcam.c b/drivers/media/video/omap24xxcam.c index f6626e87dbc5..69b60ba5dd7a 100644 --- a/drivers/media/video/omap24xxcam.c +++ b/drivers/media/video/omap24xxcam.c | |||
@@ -1768,14 +1768,13 @@ static int __devinit omap24xxcam_probe(struct platform_device *pdev) | |||
1768 | dev_err(cam->dev, "no mem resource?\n"); | 1768 | dev_err(cam->dev, "no mem resource?\n"); |
1769 | goto err; | 1769 | goto err; |
1770 | } | 1770 | } |
1771 | if (!request_mem_region(mem->start, (mem->end - mem->start) + 1, | 1771 | if (!request_mem_region(mem->start, resource_size(mem), pdev->name)) { |
1772 | pdev->name)) { | ||
1773 | dev_err(cam->dev, | 1772 | dev_err(cam->dev, |
1774 | "cannot reserve camera register I/O region\n"); | 1773 | "cannot reserve camera register I/O region\n"); |
1775 | goto err; | 1774 | goto err; |
1776 | } | 1775 | } |
1777 | cam->mmio_base_phys = mem->start; | 1776 | cam->mmio_base_phys = mem->start; |
1778 | cam->mmio_size = (mem->end - mem->start) + 1; | 1777 | cam->mmio_size = resource_size(mem); |
1779 | 1778 | ||
1780 | /* map the region */ | 1779 | /* map the region */ |
1781 | cam->mmio_base = (unsigned long) | 1780 | cam->mmio_base = (unsigned long) |
diff --git a/drivers/message/i2o/iop.c b/drivers/message/i2o/iop.c index 090d2a3a6548..a8c08f332da0 100644 --- a/drivers/message/i2o/iop.c +++ b/drivers/message/i2o/iop.c | |||
@@ -681,11 +681,11 @@ static int i2o_iop_systab_set(struct i2o_controller *c) | |||
681 | if (root && allocate_resource(root, res, sb->desired_mem_size, sb->desired_mem_size, sb->desired_mem_size, 1 << 20, /* Unspecified, so use 1Mb and play safe */ | 681 | if (root && allocate_resource(root, res, sb->desired_mem_size, sb->desired_mem_size, sb->desired_mem_size, 1 << 20, /* Unspecified, so use 1Mb and play safe */ |
682 | NULL, NULL) >= 0) { | 682 | NULL, NULL) >= 0) { |
683 | c->mem_alloc = 1; | 683 | c->mem_alloc = 1; |
684 | sb->current_mem_size = 1 + res->end - res->start; | 684 | sb->current_mem_size = resource_size(res); |
685 | sb->current_mem_base = res->start; | 685 | sb->current_mem_base = res->start; |
686 | osm_info("%s: allocated %llu bytes of PCI memory at " | 686 | osm_info("%s: allocated %llu bytes of PCI memory at " |
687 | "0x%016llX.\n", c->name, | 687 | "0x%016llX.\n", c->name, |
688 | (unsigned long long)(1 + res->end - res->start), | 688 | (unsigned long long)resource_size(res), |
689 | (unsigned long long)res->start); | 689 | (unsigned long long)res->start); |
690 | } | 690 | } |
691 | } | 691 | } |
@@ -703,11 +703,11 @@ static int i2o_iop_systab_set(struct i2o_controller *c) | |||
703 | if (root && allocate_resource(root, res, sb->desired_io_size, sb->desired_io_size, sb->desired_io_size, 1 << 20, /* Unspecified, so use 1Mb and play safe */ | 703 | if (root && allocate_resource(root, res, sb->desired_io_size, sb->desired_io_size, sb->desired_io_size, 1 << 20, /* Unspecified, so use 1Mb and play safe */ |
704 | NULL, NULL) >= 0) { | 704 | NULL, NULL) >= 0) { |
705 | c->io_alloc = 1; | 705 | c->io_alloc = 1; |
706 | sb->current_io_size = 1 + res->end - res->start; | 706 | sb->current_io_size = resource_size(res); |
707 | sb->current_mem_base = res->start; | 707 | sb->current_mem_base = res->start; |
708 | osm_info("%s: allocated %llu bytes of PCI I/O at " | 708 | osm_info("%s: allocated %llu bytes of PCI I/O at " |
709 | "0x%016llX.\n", c->name, | 709 | "0x%016llX.\n", c->name, |
710 | (unsigned long long)(1 + res->end - res->start), | 710 | (unsigned long long)resource_size(res), |
711 | (unsigned long long)res->start); | 711 | (unsigned long long)res->start); |
712 | } | 712 | } |
713 | } | 713 | } |
diff --git a/drivers/mfd/tc6387xb.c b/drivers/mfd/tc6387xb.c index ad715bf49cac..71bc835324d8 100644 --- a/drivers/mfd/tc6387xb.c +++ b/drivers/mfd/tc6387xb.c | |||
@@ -177,7 +177,7 @@ static int __devinit tc6387xb_probe(struct platform_device *dev) | |||
177 | if (ret) | 177 | if (ret) |
178 | goto err_resource; | 178 | goto err_resource; |
179 | 179 | ||
180 | tc6387xb->scr = ioremap(rscr->start, rscr->end - rscr->start + 1); | 180 | tc6387xb->scr = ioremap(rscr->start, resource_size(rscr)); |
181 | if (!tc6387xb->scr) { | 181 | if (!tc6387xb->scr) { |
182 | ret = -ENOMEM; | 182 | ret = -ENOMEM; |
183 | goto err_ioremap; | 183 | goto err_ioremap; |
diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c index 4afffe610f99..769a4e8e10dc 100644 --- a/drivers/misc/atmel-ssc.c +++ b/drivers/misc/atmel-ssc.c | |||
@@ -95,7 +95,7 @@ static int __init ssc_probe(struct platform_device *pdev) | |||
95 | } | 95 | } |
96 | 96 | ||
97 | ssc->pdev = pdev; | 97 | ssc->pdev = pdev; |
98 | ssc->regs = ioremap(regs->start, regs->end - regs->start + 1); | 98 | ssc->regs = ioremap(regs->start, resource_size(regs)); |
99 | if (!ssc->regs) { | 99 | if (!ssc->regs) { |
100 | dev_dbg(&pdev->dev, "ioremap failed\n"); | 100 | dev_dbg(&pdev->dev, "ioremap failed\n"); |
101 | retval = -EINVAL; | 101 | retval = -EINVAL; |
diff --git a/drivers/misc/atmel_pwm.c b/drivers/misc/atmel_pwm.c index 0f3fb4f03bdf..28f5aaa19d4a 100644 --- a/drivers/misc/atmel_pwm.c +++ b/drivers/misc/atmel_pwm.c | |||
@@ -329,7 +329,7 @@ static int __init pwm_probe(struct platform_device *pdev) | |||
329 | p->pdev = pdev; | 329 | p->pdev = pdev; |
330 | p->mask = *mp; | 330 | p->mask = *mp; |
331 | p->irq = irq; | 331 | p->irq = irq; |
332 | p->base = ioremap(r->start, r->end - r->start + 1); | 332 | p->base = ioremap(r->start, resource_size(r)); |
333 | if (!p->base) | 333 | if (!p->base) |
334 | goto fail; | 334 | goto fail; |
335 | p->clk = clk_get(&pdev->dev, "pwm_clk"); | 335 | p->clk = clk_get(&pdev->dev, "pwm_clk"); |
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 66dcddb9c205..2a069f908b27 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c | |||
@@ -1595,7 +1595,7 @@ static int dw_mci_probe(struct platform_device *pdev) | |||
1595 | INIT_LIST_HEAD(&host->queue); | 1595 | INIT_LIST_HEAD(&host->queue); |
1596 | 1596 | ||
1597 | ret = -ENOMEM; | 1597 | ret = -ENOMEM; |
1598 | host->regs = ioremap(regs->start, regs->end - regs->start + 1); | 1598 | host->regs = ioremap(regs->start, resource_size(regs)); |
1599 | if (!host->regs) | 1599 | if (!host->regs) |
1600 | goto err_freehost; | 1600 | goto err_freehost; |
1601 | 1601 | ||
diff --git a/drivers/mtd/maps/bfin-async-flash.c b/drivers/mtd/maps/bfin-async-flash.c index d4297a97e100..67815eed2f00 100644 --- a/drivers/mtd/maps/bfin-async-flash.c +++ b/drivers/mtd/maps/bfin-async-flash.c | |||
@@ -142,7 +142,7 @@ static int __devinit bfin_flash_probe(struct platform_device *pdev) | |||
142 | state->map.write = bfin_flash_write; | 142 | state->map.write = bfin_flash_write; |
143 | state->map.copy_to = bfin_flash_copy_to; | 143 | state->map.copy_to = bfin_flash_copy_to; |
144 | state->map.bankwidth = pdata->width; | 144 | state->map.bankwidth = pdata->width; |
145 | state->map.size = memory->end - memory->start + 1; | 145 | state->map.size = resource_size(memory); |
146 | state->map.virt = (void __iomem *)memory->start; | 146 | state->map.virt = (void __iomem *)memory->start; |
147 | state->map.phys = memory->start; | 147 | state->map.phys = memory->start; |
148 | state->map.map_priv_1 = (unsigned long)state; | 148 | state->map.map_priv_1 = (unsigned long)state; |
diff --git a/drivers/mtd/maps/ixp2000.c b/drivers/mtd/maps/ixp2000.c index c00b9175ba9e..1594a802631d 100644 --- a/drivers/mtd/maps/ixp2000.c +++ b/drivers/mtd/maps/ixp2000.c | |||
@@ -155,7 +155,7 @@ static int ixp2000_flash_probe(struct platform_device *dev) | |||
155 | if (!plat) | 155 | if (!plat) |
156 | return -ENODEV; | 156 | return -ENODEV; |
157 | 157 | ||
158 | window_size = dev->resource->end - dev->resource->start + 1; | 158 | window_size = resource_size(dev->resource); |
159 | dev_info(&dev->dev, "Probe of IXP2000 flash(%d banks x %dMiB)\n", | 159 | dev_info(&dev->dev, "Probe of IXP2000 flash(%d banks x %dMiB)\n", |
160 | ixp_data->nr_banks, ((u32)window_size >> 20)); | 160 | ixp_data->nr_banks, ((u32)window_size >> 20)); |
161 | 161 | ||
@@ -194,16 +194,17 @@ static int ixp2000_flash_probe(struct platform_device *dev) | |||
194 | info->map.copy_to = ixp2000_flash_copy_to; | 194 | info->map.copy_to = ixp2000_flash_copy_to; |
195 | 195 | ||
196 | info->res = request_mem_region(dev->resource->start, | 196 | info->res = request_mem_region(dev->resource->start, |
197 | dev->resource->end - dev->resource->start + 1, | 197 | resource_size(dev->resource), |
198 | dev_name(&dev->dev)); | 198 | dev_name(&dev->dev)); |
199 | if (!info->res) { | 199 | if (!info->res) { |
200 | dev_err(&dev->dev, "Could not reserve memory region\n"); | 200 | dev_err(&dev->dev, "Could not reserve memory region\n"); |
201 | err = -ENOMEM; | 201 | err = -ENOMEM; |
202 | goto Error; | 202 | goto Error; |
203 | } | 203 | } |
204 | 204 | ||
205 | info->map.map_priv_1 = (unsigned long) ioremap(dev->resource->start, | 205 | info->map.map_priv_1 = |
206 | dev->resource->end - dev->resource->start + 1); | 206 | (unsigned long)ioremap(dev->resource->start, |
207 | resource_size(dev->resource)); | ||
207 | if (!info->map.map_priv_1) { | 208 | if (!info->map.map_priv_1) { |
208 | dev_err(&dev->dev, "Failed to ioremap flash region\n"); | 209 | dev_err(&dev->dev, "Failed to ioremap flash region\n"); |
209 | err = -EIO; | 210 | err = -EIO; |
diff --git a/drivers/mtd/maps/pxa2xx-flash.c b/drivers/mtd/maps/pxa2xx-flash.c index f59d62f74d44..7ae137d4b998 100644 --- a/drivers/mtd/maps/pxa2xx-flash.c +++ b/drivers/mtd/maps/pxa2xx-flash.c | |||
@@ -70,7 +70,7 @@ static int __devinit pxa2xx_flash_probe(struct platform_device *pdev) | |||
70 | info->map.name = (char *) flash->name; | 70 | info->map.name = (char *) flash->name; |
71 | info->map.bankwidth = flash->width; | 71 | info->map.bankwidth = flash->width; |
72 | info->map.phys = res->start; | 72 | info->map.phys = res->start; |
73 | info->map.size = res->end - res->start + 1; | 73 | info->map.size = resource_size(res); |
74 | info->parts = flash->parts; | 74 | info->parts = flash->parts; |
75 | info->nr_parts = flash->nr_parts; | 75 | info->nr_parts = flash->nr_parts; |
76 | 76 | ||
diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c index b300705d41cb..d4ba1f218e9a 100644 --- a/drivers/mtd/nand/atmel_nand.c +++ b/drivers/mtd/nand/atmel_nand.c | |||
@@ -513,7 +513,7 @@ static int __init atmel_nand_probe(struct platform_device *pdev) | |||
513 | 513 | ||
514 | host->io_phys = (dma_addr_t)mem->start; | 514 | host->io_phys = (dma_addr_t)mem->start; |
515 | 515 | ||
516 | host->io_base = ioremap(mem->start, mem->end - mem->start + 1); | 516 | host->io_base = ioremap(mem->start, resource_size(mem)); |
517 | if (host->io_base == NULL) { | 517 | if (host->io_base == NULL) { |
518 | printk(KERN_ERR "atmel_nand: ioremap failed\n"); | 518 | printk(KERN_ERR "atmel_nand: ioremap failed\n"); |
519 | res = -EIO; | 519 | res = -EIO; |
@@ -547,7 +547,7 @@ static int __init atmel_nand_probe(struct platform_device *pdev) | |||
547 | if (no_ecc) | 547 | if (no_ecc) |
548 | nand_chip->ecc.mode = NAND_ECC_NONE; | 548 | nand_chip->ecc.mode = NAND_ECC_NONE; |
549 | if (hard_ecc && regs) { | 549 | if (hard_ecc && regs) { |
550 | host->ecc = ioremap(regs->start, regs->end - regs->start + 1); | 550 | host->ecc = ioremap(regs->start, resource_size(regs)); |
551 | if (host->ecc == NULL) { | 551 | if (host->ecc == NULL) { |
552 | printk(KERN_ERR "atmel_nand: ioremap failed\n"); | 552 | printk(KERN_ERR "atmel_nand: ioremap failed\n"); |
553 | res = -EIO; | 553 | res = -EIO; |
diff --git a/drivers/mtd/nand/bcm_umi_nand.c b/drivers/mtd/nand/bcm_umi_nand.c index 9ec280738a9a..8c569e454dc5 100644 --- a/drivers/mtd/nand/bcm_umi_nand.c +++ b/drivers/mtd/nand/bcm_umi_nand.c | |||
@@ -380,7 +380,7 @@ static int __devinit bcm_umi_nand_probe(struct platform_device *pdev) | |||
380 | return -ENXIO; | 380 | return -ENXIO; |
381 | 381 | ||
382 | /* map physical address */ | 382 | /* map physical address */ |
383 | bcm_umi_io_base = ioremap(r->start, r->end - r->start + 1); | 383 | bcm_umi_io_base = ioremap(r->start, resource_size(r)); |
384 | 384 | ||
385 | if (!bcm_umi_io_base) { | 385 | if (!bcm_umi_io_base) { |
386 | printk(KERN_ERR "ioremap to access BCM UMI NAND chip failed\n"); | 386 | printk(KERN_ERR "ioremap to access BCM UMI NAND chip failed\n"); |
diff --git a/drivers/mtd/nand/mpc5121_nfc.c b/drivers/mtd/nand/mpc5121_nfc.c index 2f7c930872f9..eb1fbac63eb6 100644 --- a/drivers/mtd/nand/mpc5121_nfc.c +++ b/drivers/mtd/nand/mpc5121_nfc.c | |||
@@ -713,7 +713,7 @@ static int __devinit mpc5121_nfc_probe(struct platform_device *op) | |||
713 | } | 713 | } |
714 | 714 | ||
715 | regs_paddr = res.start; | 715 | regs_paddr = res.start; |
716 | regs_size = res.end - res.start + 1; | 716 | regs_size = resource_size(&res); |
717 | 717 | ||
718 | if (!devm_request_mem_region(dev, regs_paddr, regs_size, DRV_NAME)) { | 718 | if (!devm_request_mem_region(dev, regs_paddr, regs_size, DRV_NAME)) { |
719 | dev_err(dev, "Error requesting memory region!\n"); | 719 | dev_err(dev, "Error requesting memory region!\n"); |
diff --git a/drivers/net/bcm63xx_enet.c b/drivers/net/bcm63xx_enet.c index f1573d492e90..85045cde3126 100644 --- a/drivers/net/bcm63xx_enet.c +++ b/drivers/net/bcm63xx_enet.c | |||
@@ -1646,7 +1646,7 @@ static int __devinit bcm_enet_probe(struct platform_device *pdev) | |||
1646 | if (ret) | 1646 | if (ret) |
1647 | goto out; | 1647 | goto out; |
1648 | 1648 | ||
1649 | iomem_size = res_mem->end - res_mem->start + 1; | 1649 | iomem_size = resource_size(res_mem); |
1650 | if (!request_mem_region(res_mem->start, iomem_size, "bcm63xx_enet")) { | 1650 | if (!request_mem_region(res_mem->start, iomem_size, "bcm63xx_enet")) { |
1651 | ret = -EBUSY; | 1651 | ret = -EBUSY; |
1652 | goto out; | 1652 | goto out; |
@@ -1861,7 +1861,7 @@ static int __devexit bcm_enet_remove(struct platform_device *pdev) | |||
1861 | /* release device resources */ | 1861 | /* release device resources */ |
1862 | iounmap(priv->base); | 1862 | iounmap(priv->base); |
1863 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 1863 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
1864 | release_mem_region(res->start, res->end - res->start + 1); | 1864 | release_mem_region(res->start, resource_size(res)); |
1865 | 1865 | ||
1866 | /* disable hw block clocks */ | 1866 | /* disable hw block clocks */ |
1867 | if (priv->phy_clk) { | 1867 | if (priv->phy_clk) { |
@@ -1897,7 +1897,7 @@ static int __devinit bcm_enet_shared_probe(struct platform_device *pdev) | |||
1897 | if (!res) | 1897 | if (!res) |
1898 | return -ENODEV; | 1898 | return -ENODEV; |
1899 | 1899 | ||
1900 | iomem_size = res->end - res->start + 1; | 1900 | iomem_size = resource_size(res); |
1901 | if (!request_mem_region(res->start, iomem_size, "bcm63xx_enet_dma")) | 1901 | if (!request_mem_region(res->start, iomem_size, "bcm63xx_enet_dma")) |
1902 | return -EBUSY; | 1902 | return -EBUSY; |
1903 | 1903 | ||
@@ -1915,7 +1915,7 @@ static int __devexit bcm_enet_shared_remove(struct platform_device *pdev) | |||
1915 | 1915 | ||
1916 | iounmap(bcm_enet_shared_base); | 1916 | iounmap(bcm_enet_shared_base); |
1917 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 1917 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
1918 | release_mem_region(res->start, res->end - res->start + 1); | 1918 | release_mem_region(res->start, resource_size(res)); |
1919 | return 0; | 1919 | return 0; |
1920 | } | 1920 | } |
1921 | 1921 | ||
diff --git a/drivers/net/can/softing/softing_main.c b/drivers/net/can/softing/softing_main.c index 60a49e5a2a53..f76e88e74285 100644 --- a/drivers/net/can/softing/softing_main.c +++ b/drivers/net/can/softing/softing_main.c | |||
@@ -799,7 +799,7 @@ static __devinit int softing_pdev_probe(struct platform_device *pdev) | |||
799 | if (!pres) | 799 | if (!pres) |
800 | goto platform_resource_failed; | 800 | goto platform_resource_failed; |
801 | card->dpram_phys = pres->start; | 801 | card->dpram_phys = pres->start; |
802 | card->dpram_size = pres->end - pres->start + 1; | 802 | card->dpram_size = resource_size(pres); |
803 | card->dpram = ioremap_nocache(card->dpram_phys, card->dpram_size); | 803 | card->dpram = ioremap_nocache(card->dpram_phys, card->dpram_size); |
804 | if (!card->dpram) { | 804 | if (!card->dpram) { |
805 | dev_alert(&card->pdev->dev, "dpram ioremap failed\n"); | 805 | dev_alert(&card->pdev->dev, "dpram ioremap failed\n"); |
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c index dcc4a170b0f3..c35ba5fba8f6 100644 --- a/drivers/net/davinci_emac.c +++ b/drivers/net/davinci_emac.c | |||
@@ -1821,7 +1821,7 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev) | |||
1821 | } | 1821 | } |
1822 | 1822 | ||
1823 | priv->emac_base_phys = res->start + pdata->ctrl_reg_offset; | 1823 | priv->emac_base_phys = res->start + pdata->ctrl_reg_offset; |
1824 | size = res->end - res->start + 1; | 1824 | size = resource_size(res); |
1825 | if (!request_mem_region(res->start, size, ndev->name)) { | 1825 | if (!request_mem_region(res->start, size, ndev->name)) { |
1826 | dev_err(&pdev->dev, "failed request_mem_region() for regs\n"); | 1826 | dev_err(&pdev->dev, "failed request_mem_region() for regs\n"); |
1827 | rc = -ENXIO; | 1827 | rc = -ENXIO; |
@@ -1926,7 +1926,7 @@ no_irq_res: | |||
1926 | cpdma_ctlr_destroy(priv->dma); | 1926 | cpdma_ctlr_destroy(priv->dma); |
1927 | no_dma: | 1927 | no_dma: |
1928 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 1928 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
1929 | release_mem_region(res->start, res->end - res->start + 1); | 1929 | release_mem_region(res->start, resource_size(res)); |
1930 | iounmap(priv->remap_addr); | 1930 | iounmap(priv->remap_addr); |
1931 | 1931 | ||
1932 | probe_quit: | 1932 | probe_quit: |
@@ -1960,7 +1960,7 @@ static int __devexit davinci_emac_remove(struct platform_device *pdev) | |||
1960 | cpdma_chan_destroy(priv->rxchan); | 1960 | cpdma_chan_destroy(priv->rxchan); |
1961 | cpdma_ctlr_destroy(priv->dma); | 1961 | cpdma_ctlr_destroy(priv->dma); |
1962 | 1962 | ||
1963 | release_mem_region(res->start, res->end - res->start + 1); | 1963 | release_mem_region(res->start, resource_size(res)); |
1964 | 1964 | ||
1965 | unregister_netdev(ndev); | 1965 | unregister_netdev(ndev); |
1966 | iounmap(priv->remap_addr); | 1966 | iounmap(priv->remap_addr); |
diff --git a/drivers/net/ethoc.c b/drivers/net/ethoc.c index a83dd312c3ac..15e4a71fbf1e 100644 --- a/drivers/net/ethoc.c +++ b/drivers/net/ethoc.c | |||
@@ -965,7 +965,7 @@ static int __devinit ethoc_probe(struct platform_device *pdev) | |||
965 | priv = netdev_priv(netdev); | 965 | priv = netdev_priv(netdev); |
966 | priv->netdev = netdev; | 966 | priv->netdev = netdev; |
967 | priv->dma_alloc = 0; | 967 | priv->dma_alloc = 0; |
968 | priv->io_region_size = mmio->end - mmio->start + 1; | 968 | priv->io_region_size = resource_size(mmio); |
969 | 969 | ||
970 | priv->iobase = devm_ioremap_nocache(&pdev->dev, netdev->base_addr, | 970 | priv->iobase = devm_ioremap_nocache(&pdev->dev, netdev->base_addr, |
971 | resource_size(mmio)); | 971 | resource_size(mmio)); |
diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c index 9f81b1ac130e..fe57eee8a679 100644 --- a/drivers/net/fec_mpc52xx.c +++ b/drivers/net/fec_mpc52xx.c | |||
@@ -867,10 +867,11 @@ static int __devinit mpc52xx_fec_probe(struct platform_device *op) | |||
867 | "Error while parsing device node resource\n" ); | 867 | "Error while parsing device node resource\n" ); |
868 | goto err_netdev; | 868 | goto err_netdev; |
869 | } | 869 | } |
870 | if ((mem.end - mem.start + 1) < sizeof(struct mpc52xx_fec)) { | 870 | if (resource_size(&mem) < sizeof(struct mpc52xx_fec)) { |
871 | printk(KERN_ERR DRIVER_NAME | 871 | printk(KERN_ERR DRIVER_NAME |
872 | " - invalid resource size (%lx < %x), check mpc52xx_devices.c\n", | 872 | " - invalid resource size (%lx < %x), check mpc52xx_devices.c\n", |
873 | (unsigned long)(mem.end - mem.start + 1), sizeof(struct mpc52xx_fec)); | 873 | (unsigned long)resource_size(&mem), |
874 | sizeof(struct mpc52xx_fec)); | ||
874 | rv = -EINVAL; | 875 | rv = -EINVAL; |
875 | goto err_netdev; | 876 | goto err_netdev; |
876 | } | 877 | } |
diff --git a/drivers/net/fs_enet/mii-bitbang.c b/drivers/net/fs_enet/mii-bitbang.c index ad2975440719..b09270b5d0a5 100644 --- a/drivers/net/fs_enet/mii-bitbang.c +++ b/drivers/net/fs_enet/mii-bitbang.c | |||
@@ -120,7 +120,7 @@ static int __devinit fs_mii_bitbang_init(struct mii_bus *bus, | |||
120 | if (ret) | 120 | if (ret) |
121 | return ret; | 121 | return ret; |
122 | 122 | ||
123 | if (res.end - res.start < 13) | 123 | if (resource_size(&res) <= 13) |
124 | return -ENODEV; | 124 | return -ENODEV; |
125 | 125 | ||
126 | /* This should really encode the pin number as well, but all | 126 | /* This should really encode the pin number as well, but all |
@@ -139,7 +139,7 @@ static int __devinit fs_mii_bitbang_init(struct mii_bus *bus, | |||
139 | return -ENODEV; | 139 | return -ENODEV; |
140 | mdc_pin = *data; | 140 | mdc_pin = *data; |
141 | 141 | ||
142 | bitbang->dir = ioremap(res.start, res.end - res.start + 1); | 142 | bitbang->dir = ioremap(res.start, resource_size(&res)); |
143 | if (!bitbang->dir) | 143 | if (!bitbang->dir) |
144 | return -ENOMEM; | 144 | return -ENOMEM; |
145 | 145 | ||
diff --git a/drivers/net/fs_enet/mii-fec.c b/drivers/net/fs_enet/mii-fec.c index 6a2e150e75bb..e0e9d6c35d83 100644 --- a/drivers/net/fs_enet/mii-fec.c +++ b/drivers/net/fs_enet/mii-fec.c | |||
@@ -136,7 +136,7 @@ static int __devinit fs_enet_mdio_probe(struct platform_device *ofdev) | |||
136 | 136 | ||
137 | snprintf(new_bus->id, MII_BUS_ID_SIZE, "%x", res.start); | 137 | snprintf(new_bus->id, MII_BUS_ID_SIZE, "%x", res.start); |
138 | 138 | ||
139 | fec->fecp = ioremap(res.start, res.end - res.start + 1); | 139 | fec->fecp = ioremap(res.start, resource_size(&res)); |
140 | if (!fec->fecp) | 140 | if (!fec->fecp) |
141 | goto out_fec; | 141 | goto out_fec; |
142 | 142 | ||
diff --git a/drivers/net/gianfar_ptp.c b/drivers/net/gianfar_ptp.c index d8e175382d1d..1c97861596f0 100644 --- a/drivers/net/gianfar_ptp.c +++ b/drivers/net/gianfar_ptp.c | |||
@@ -491,7 +491,7 @@ static int gianfar_ptp_probe(struct platform_device *dev) | |||
491 | spin_lock_init(&etsects->lock); | 491 | spin_lock_init(&etsects->lock); |
492 | 492 | ||
493 | etsects->regs = ioremap(etsects->rsrc->start, | 493 | etsects->regs = ioremap(etsects->rsrc->start, |
494 | 1 + etsects->rsrc->end - etsects->rsrc->start); | 494 | resource_size(etsects->rsrc)); |
495 | if (!etsects->regs) { | 495 | if (!etsects->regs) { |
496 | pr_err("ioremap ptp registers failed\n"); | 496 | pr_err("ioremap ptp registers failed\n"); |
497 | goto no_ioremap; | 497 | goto no_ioremap; |
diff --git a/drivers/net/ibm_newemac/core.c b/drivers/net/ibm_newemac/core.c index 079450fe5e96..725399ea0690 100644 --- a/drivers/net/ibm_newemac/core.c +++ b/drivers/net/ibm_newemac/core.c | |||
@@ -2770,7 +2770,7 @@ static int __devinit emac_probe(struct platform_device *ofdev) | |||
2770 | } | 2770 | } |
2771 | // TODO : request_mem_region | 2771 | // TODO : request_mem_region |
2772 | dev->emacp = ioremap(dev->rsrc_regs.start, | 2772 | dev->emacp = ioremap(dev->rsrc_regs.start, |
2773 | dev->rsrc_regs.end - dev->rsrc_regs.start + 1); | 2773 | resource_size(&dev->rsrc_regs)); |
2774 | if (dev->emacp == NULL) { | 2774 | if (dev->emacp == NULL) { |
2775 | printk(KERN_ERR "%s: Can't map device registers!\n", | 2775 | printk(KERN_ERR "%s: Can't map device registers!\n", |
2776 | np->full_name); | 2776 | np->full_name); |
diff --git a/drivers/net/macb.c b/drivers/net/macb.c index 6c6a02869dfc..27125cdd7e01 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c | |||
@@ -1169,7 +1169,7 @@ static int __init macb_probe(struct platform_device *pdev) | |||
1169 | clk_enable(bp->hclk); | 1169 | clk_enable(bp->hclk); |
1170 | #endif | 1170 | #endif |
1171 | 1171 | ||
1172 | bp->regs = ioremap(regs->start, regs->end - regs->start + 1); | 1172 | bp->regs = ioremap(regs->start, resource_size(regs)); |
1173 | if (!bp->regs) { | 1173 | if (!bp->regs) { |
1174 | dev_err(&pdev->dev, "failed to map registers, aborting.\n"); | 1174 | dev_err(&pdev->dev, "failed to map registers, aborting.\n"); |
1175 | err = -ENOMEM; | 1175 | err = -ENOMEM; |
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c index a5d9b1c310b3..b75648257381 100644 --- a/drivers/net/mv643xx_eth.c +++ b/drivers/net/mv643xx_eth.c | |||
@@ -2593,7 +2593,7 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev) | |||
2593 | if (msp == NULL) | 2593 | if (msp == NULL) |
2594 | goto out; | 2594 | goto out; |
2595 | 2595 | ||
2596 | msp->base = ioremap(res->start, res->end - res->start + 1); | 2596 | msp->base = ioremap(res->start, resource_size(res)); |
2597 | if (msp->base == NULL) | 2597 | if (msp->base == NULL) |
2598 | goto out_free; | 2598 | goto out_free; |
2599 | 2599 | ||
diff --git a/drivers/net/pxa168_eth.c b/drivers/net/pxa168_eth.c index 89f7540d90f9..df1292eb9c2e 100644 --- a/drivers/net/pxa168_eth.c +++ b/drivers/net/pxa168_eth.c | |||
@@ -1502,7 +1502,7 @@ static int pxa168_eth_probe(struct platform_device *pdev) | |||
1502 | err = -ENODEV; | 1502 | err = -ENODEV; |
1503 | goto err_netdev; | 1503 | goto err_netdev; |
1504 | } | 1504 | } |
1505 | pep->base = ioremap(res->start, res->end - res->start + 1); | 1505 | pep->base = ioremap(res->start, resource_size(res)); |
1506 | if (pep->base == NULL) { | 1506 | if (pep->base == NULL) { |
1507 | err = -ENOMEM; | 1507 | err = -ENOMEM; |
1508 | goto err_netdev; | 1508 | goto err_netdev; |
diff --git a/drivers/net/sb1250-mac.c b/drivers/net/sb1250-mac.c index 68d50429ddf3..ea65f7ec360a 100644 --- a/drivers/net/sb1250-mac.c +++ b/drivers/net/sb1250-mac.c | |||
@@ -2597,7 +2597,7 @@ static int __devinit sbmac_probe(struct platform_device *pldev) | |||
2597 | 2597 | ||
2598 | res = platform_get_resource(pldev, IORESOURCE_MEM, 0); | 2598 | res = platform_get_resource(pldev, IORESOURCE_MEM, 0); |
2599 | BUG_ON(!res); | 2599 | BUG_ON(!res); |
2600 | sbm_base = ioremap_nocache(res->start, res->end - res->start + 1); | 2600 | sbm_base = ioremap_nocache(res->start, resource_size(res)); |
2601 | if (!sbm_base) { | 2601 | if (!sbm_base) { |
2602 | printk(KERN_ERR "%s: unable to map device registers\n", | 2602 | printk(KERN_ERR "%s: unable to map device registers\n", |
2603 | dev_name(&pldev->dev)); | 2603 | dev_name(&pldev->dev)); |
diff --git a/drivers/parport/parport_ax88796.c b/drivers/parport/parport_ax88796.c index 2c5ac2bf5c56..844f6137970a 100644 --- a/drivers/parport/parport_ax88796.c +++ b/drivers/parport/parport_ax88796.c | |||
@@ -293,7 +293,7 @@ static int parport_ax88796_probe(struct platform_device *pdev) | |||
293 | goto exit_mem; | 293 | goto exit_mem; |
294 | } | 294 | } |
295 | 295 | ||
296 | size = (res->end - res->start) + 1; | 296 | size = resource_size(res); |
297 | spacing = size / 3; | 297 | spacing = size / 3; |
298 | 298 | ||
299 | dd->io = request_mem_region(res->start, size, pdev->name); | 299 | dd->io = request_mem_region(res->start, size, pdev->name); |
diff --git a/drivers/pci/hotplug/shpchp_sysfs.c b/drivers/pci/hotplug/shpchp_sysfs.c index 071b7dc0094b..efa30da1ae8f 100644 --- a/drivers/pci/hotplug/shpchp_sysfs.c +++ b/drivers/pci/hotplug/shpchp_sysfs.c | |||
@@ -50,29 +50,26 @@ static ssize_t show_ctrl (struct device *dev, struct device_attribute *attr, cha | |||
50 | pci_bus_for_each_resource(bus, res, index) { | 50 | pci_bus_for_each_resource(bus, res, index) { |
51 | if (res && (res->flags & IORESOURCE_MEM) && | 51 | if (res && (res->flags & IORESOURCE_MEM) && |
52 | !(res->flags & IORESOURCE_PREFETCH)) { | 52 | !(res->flags & IORESOURCE_PREFETCH)) { |
53 | out += sprintf(out, "start = %8.8llx, " | 53 | out += sprintf(out, "start = %8.8llx, length = %8.8llx\n", |
54 | "length = %8.8llx\n", | 54 | (unsigned long long)res->start, |
55 | (unsigned long long)res->start, | 55 | (unsigned long long)resource_size(res)); |
56 | (unsigned long long)(res->end - res->start)); | ||
57 | } | 56 | } |
58 | } | 57 | } |
59 | out += sprintf(out, "Free resources: prefetchable memory\n"); | 58 | out += sprintf(out, "Free resources: prefetchable memory\n"); |
60 | pci_bus_for_each_resource(bus, res, index) { | 59 | pci_bus_for_each_resource(bus, res, index) { |
61 | if (res && (res->flags & IORESOURCE_MEM) && | 60 | if (res && (res->flags & IORESOURCE_MEM) && |
62 | (res->flags & IORESOURCE_PREFETCH)) { | 61 | (res->flags & IORESOURCE_PREFETCH)) { |
63 | out += sprintf(out, "start = %8.8llx, " | 62 | out += sprintf(out, "start = %8.8llx, length = %8.8llx\n", |
64 | "length = %8.8llx\n", | 63 | (unsigned long long)res->start, |
65 | (unsigned long long)res->start, | 64 | (unsigned long long)resource_size(res)); |
66 | (unsigned long long)(res->end - res->start)); | ||
67 | } | 65 | } |
68 | } | 66 | } |
69 | out += sprintf(out, "Free resources: IO\n"); | 67 | out += sprintf(out, "Free resources: IO\n"); |
70 | pci_bus_for_each_resource(bus, res, index) { | 68 | pci_bus_for_each_resource(bus, res, index) { |
71 | if (res && (res->flags & IORESOURCE_IO)) { | 69 | if (res && (res->flags & IORESOURCE_IO)) { |
72 | out += sprintf(out, "start = %8.8llx, " | 70 | out += sprintf(out, "start = %8.8llx, length = %8.8llx\n", |
73 | "length = %8.8llx\n", | 71 | (unsigned long long)res->start, |
74 | (unsigned long long)res->start, | 72 | (unsigned long long)resource_size(res)); |
75 | (unsigned long long)(res->end - res->start)); | ||
76 | } | 73 | } |
77 | } | 74 | } |
78 | out += sprintf(out, "Free resources: bus numbers\n"); | 75 | out += sprintf(out, "Free resources: bus numbers\n"); |
diff --git a/drivers/pcmcia/at91_cf.c b/drivers/pcmcia/at91_cf.c index fb33fa42d249..4902206f53d9 100644 --- a/drivers/pcmcia/at91_cf.c +++ b/drivers/pcmcia/at91_cf.c | |||
@@ -283,8 +283,7 @@ static int __init at91_cf_probe(struct platform_device *pdev) | |||
283 | } | 283 | } |
284 | 284 | ||
285 | /* reserve chip-select regions */ | 285 | /* reserve chip-select regions */ |
286 | if (!request_mem_region(io->start, io->end + 1 - io->start, | 286 | if (!request_mem_region(io->start, resource_size(io), driver_name)) { |
287 | driver_name)) { | ||
288 | status = -ENXIO; | 287 | status = -ENXIO; |
289 | goto fail1; | 288 | goto fail1; |
290 | } | 289 | } |
@@ -308,7 +307,7 @@ static int __init at91_cf_probe(struct platform_device *pdev) | |||
308 | return 0; | 307 | return 0; |
309 | 308 | ||
310 | fail2: | 309 | fail2: |
311 | release_mem_region(io->start, io->end + 1 - io->start); | 310 | release_mem_region(io->start, resource_size(io)); |
312 | fail1: | 311 | fail1: |
313 | if (cf->socket.io_offset) | 312 | if (cf->socket.io_offset) |
314 | iounmap((void __iomem *) cf->socket.io_offset); | 313 | iounmap((void __iomem *) cf->socket.io_offset); |
@@ -339,7 +338,7 @@ static int __exit at91_cf_remove(struct platform_device *pdev) | |||
339 | struct resource *io = cf->socket.io[0].res; | 338 | struct resource *io = cf->socket.io[0].res; |
340 | 339 | ||
341 | pcmcia_unregister_socket(&cf->socket); | 340 | pcmcia_unregister_socket(&cf->socket); |
342 | release_mem_region(io->start, io->end + 1 - io->start); | 341 | release_mem_region(io->start, resource_size(io)); |
343 | iounmap((void __iomem *) cf->socket.io_offset); | 342 | iounmap((void __iomem *) cf->socket.io_offset); |
344 | if (board->irq_pin) { | 343 | if (board->irq_pin) { |
345 | free_irq(board->irq_pin, cf); | 344 | free_irq(board->irq_pin, cf); |
diff --git a/drivers/pcmcia/electra_cf.c b/drivers/pcmcia/electra_cf.c index 6defd4a8168e..06ad3e5e7d3d 100644 --- a/drivers/pcmcia/electra_cf.c +++ b/drivers/pcmcia/electra_cf.c | |||
@@ -209,9 +209,9 @@ static int __devinit electra_cf_probe(struct platform_device *ofdev) | |||
209 | 209 | ||
210 | cf->ofdev = ofdev; | 210 | cf->ofdev = ofdev; |
211 | cf->mem_phys = mem.start; | 211 | cf->mem_phys = mem.start; |
212 | cf->mem_size = PAGE_ALIGN(mem.end - mem.start); | 212 | cf->mem_size = PAGE_ALIGN(resource_size(&mem)); |
213 | cf->mem_base = ioremap(cf->mem_phys, cf->mem_size); | 213 | cf->mem_base = ioremap(cf->mem_phys, cf->mem_size); |
214 | cf->io_size = PAGE_ALIGN(io.end - io.start); | 214 | cf->io_size = PAGE_ALIGN(resource_size(&io)); |
215 | 215 | ||
216 | area = __get_vm_area(cf->io_size, 0, PHB_IO_BASE, PHB_IO_END); | 216 | area = __get_vm_area(cf->io_size, 0, PHB_IO_BASE, PHB_IO_END); |
217 | if (area == NULL) | 217 | if (area == NULL) |
diff --git a/drivers/pcmcia/rsrc_iodyn.c b/drivers/pcmcia/rsrc_iodyn.c index 523eb691c30b..f53c237bda2f 100644 --- a/drivers/pcmcia/rsrc_iodyn.c +++ b/drivers/pcmcia/rsrc_iodyn.c | |||
@@ -135,7 +135,7 @@ static int iodyn_find_io(struct pcmcia_socket *s, unsigned int attr, | |||
135 | try = res->end + 1; | 135 | try = res->end + 1; |
136 | if ((*base == 0) || (*base == try)) { | 136 | if ((*base == 0) || (*base == try)) { |
137 | if (adjust_resource(s->io[i].res, res->start, | 137 | if (adjust_resource(s->io[i].res, res->start, |
138 | res->end - res->start + num + 1)) | 138 | resource_size(res) + num)) |
139 | continue; | 139 | continue; |
140 | *base = try; | 140 | *base = try; |
141 | s->io[i].InUse += num; | 141 | s->io[i].InUse += num; |
@@ -147,8 +147,8 @@ static int iodyn_find_io(struct pcmcia_socket *s, unsigned int attr, | |||
147 | try = res->start - num; | 147 | try = res->start - num; |
148 | if ((*base == 0) || (*base == try)) { | 148 | if ((*base == 0) || (*base == try)) { |
149 | if (adjust_resource(s->io[i].res, | 149 | if (adjust_resource(s->io[i].res, |
150 | res->start - num, | 150 | res->start - num, |
151 | res->end - res->start + num + 1)) | 151 | resource_size(res) + num)) |
152 | continue; | 152 | continue; |
153 | *base = try; | 153 | *base = try; |
154 | s->io[i].InUse += num; | 154 | s->io[i].InUse += num; |
diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstatic.c index b187555d4388..9da9656242af 100644 --- a/drivers/pcmcia/rsrc_nonstatic.c +++ b/drivers/pcmcia/rsrc_nonstatic.c | |||
@@ -770,7 +770,7 @@ static int nonstatic_find_io(struct pcmcia_socket *s, unsigned int attr, | |||
770 | res->end + num); | 770 | res->end + num); |
771 | if (!ret) { | 771 | if (!ret) { |
772 | ret = adjust_resource(s->io[i].res, res->start, | 772 | ret = adjust_resource(s->io[i].res, res->start, |
773 | res->end - res->start + num + 1); | 773 | resource_size(res) + num); |
774 | if (ret) | 774 | if (ret) |
775 | continue; | 775 | continue; |
776 | *base = try; | 776 | *base = try; |
@@ -788,8 +788,8 @@ static int nonstatic_find_io(struct pcmcia_socket *s, unsigned int attr, | |||
788 | res->end); | 788 | res->end); |
789 | if (!ret) { | 789 | if (!ret) { |
790 | ret = adjust_resource(s->io[i].res, | 790 | ret = adjust_resource(s->io[i].res, |
791 | res->start - num, | 791 | res->start - num, |
792 | res->end - res->start + num + 1); | 792 | resource_size(res) + num); |
793 | if (ret) | 793 | if (ret) |
794 | continue; | 794 | continue; |
795 | *base = try; | 795 | *base = try; |
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index 100e4d9372f1..1a6937d9118f 100644 --- a/drivers/pnp/pnpacpi/rsparser.c +++ b/drivers/pnp/pnpacpi/rsparser.c | |||
@@ -1018,7 +1018,7 @@ static void pnpacpi_encode_io(struct pnp_dev *dev, | |||
1018 | io->minimum = p->start; | 1018 | io->minimum = p->start; |
1019 | io->maximum = p->end; | 1019 | io->maximum = p->end; |
1020 | io->alignment = 0; /* Correct? */ | 1020 | io->alignment = 0; /* Correct? */ |
1021 | io->address_length = p->end - p->start + 1; | 1021 | io->address_length = resource_size(p); |
1022 | } else { | 1022 | } else { |
1023 | io->minimum = 0; | 1023 | io->minimum = 0; |
1024 | io->address_length = 0; | 1024 | io->address_length = 0; |
@@ -1036,7 +1036,7 @@ static void pnpacpi_encode_fixed_io(struct pnp_dev *dev, | |||
1036 | 1036 | ||
1037 | if (pnp_resource_enabled(p)) { | 1037 | if (pnp_resource_enabled(p)) { |
1038 | fixed_io->address = p->start; | 1038 | fixed_io->address = p->start; |
1039 | fixed_io->address_length = p->end - p->start + 1; | 1039 | fixed_io->address_length = resource_size(p); |
1040 | } else { | 1040 | } else { |
1041 | fixed_io->address = 0; | 1041 | fixed_io->address = 0; |
1042 | fixed_io->address_length = 0; | 1042 | fixed_io->address_length = 0; |
@@ -1059,7 +1059,7 @@ static void pnpacpi_encode_mem24(struct pnp_dev *dev, | |||
1059 | memory24->minimum = p->start; | 1059 | memory24->minimum = p->start; |
1060 | memory24->maximum = p->end; | 1060 | memory24->maximum = p->end; |
1061 | memory24->alignment = 0; | 1061 | memory24->alignment = 0; |
1062 | memory24->address_length = p->end - p->start + 1; | 1062 | memory24->address_length = resource_size(p); |
1063 | } else { | 1063 | } else { |
1064 | memory24->minimum = 0; | 1064 | memory24->minimum = 0; |
1065 | memory24->address_length = 0; | 1065 | memory24->address_length = 0; |
@@ -1083,7 +1083,7 @@ static void pnpacpi_encode_mem32(struct pnp_dev *dev, | |||
1083 | memory32->minimum = p->start; | 1083 | memory32->minimum = p->start; |
1084 | memory32->maximum = p->end; | 1084 | memory32->maximum = p->end; |
1085 | memory32->alignment = 0; | 1085 | memory32->alignment = 0; |
1086 | memory32->address_length = p->end - p->start + 1; | 1086 | memory32->address_length = resource_size(p); |
1087 | } else { | 1087 | } else { |
1088 | memory32->minimum = 0; | 1088 | memory32->minimum = 0; |
1089 | memory32->alignment = 0; | 1089 | memory32->alignment = 0; |
@@ -1106,7 +1106,7 @@ static void pnpacpi_encode_fixed_mem32(struct pnp_dev *dev, | |||
1106 | p->flags & IORESOURCE_MEM_WRITEABLE ? | 1106 | p->flags & IORESOURCE_MEM_WRITEABLE ? |
1107 | ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; | 1107 | ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; |
1108 | fixed_memory32->address = p->start; | 1108 | fixed_memory32->address = p->start; |
1109 | fixed_memory32->address_length = p->end - p->start + 1; | 1109 | fixed_memory32->address_length = resource_size(p); |
1110 | } else { | 1110 | } else { |
1111 | fixed_memory32->address = 0; | 1111 | fixed_memory32->address = 0; |
1112 | fixed_memory32->address_length = 0; | 1112 | fixed_memory32->address_length = 0; |
diff --git a/drivers/pnp/pnpbios/rsparser.c b/drivers/pnp/pnpbios/rsparser.c index cb1f47bfee96..cca2f9f9f3e3 100644 --- a/drivers/pnp/pnpbios/rsparser.c +++ b/drivers/pnp/pnpbios/rsparser.c | |||
@@ -505,7 +505,7 @@ static void pnpbios_encode_mem(struct pnp_dev *dev, unsigned char *p, | |||
505 | 505 | ||
506 | if (pnp_resource_enabled(res)) { | 506 | if (pnp_resource_enabled(res)) { |
507 | base = res->start; | 507 | base = res->start; |
508 | len = res->end - res->start + 1; | 508 | len = resource_size(res); |
509 | } else { | 509 | } else { |
510 | base = 0; | 510 | base = 0; |
511 | len = 0; | 511 | len = 0; |
@@ -529,7 +529,7 @@ static void pnpbios_encode_mem32(struct pnp_dev *dev, unsigned char *p, | |||
529 | 529 | ||
530 | if (pnp_resource_enabled(res)) { | 530 | if (pnp_resource_enabled(res)) { |
531 | base = res->start; | 531 | base = res->start; |
532 | len = res->end - res->start + 1; | 532 | len = resource_size(res); |
533 | } else { | 533 | } else { |
534 | base = 0; | 534 | base = 0; |
535 | len = 0; | 535 | len = 0; |
@@ -559,7 +559,7 @@ static void pnpbios_encode_fixed_mem32(struct pnp_dev *dev, unsigned char *p, | |||
559 | 559 | ||
560 | if (pnp_resource_enabled(res)) { | 560 | if (pnp_resource_enabled(res)) { |
561 | base = res->start; | 561 | base = res->start; |
562 | len = res->end - res->start + 1; | 562 | len = resource_size(res); |
563 | } else { | 563 | } else { |
564 | base = 0; | 564 | base = 0; |
565 | len = 0; | 565 | len = 0; |
@@ -617,7 +617,7 @@ static void pnpbios_encode_port(struct pnp_dev *dev, unsigned char *p, | |||
617 | 617 | ||
618 | if (pnp_resource_enabled(res)) { | 618 | if (pnp_resource_enabled(res)) { |
619 | base = res->start; | 619 | base = res->start; |
620 | len = res->end - res->start + 1; | 620 | len = resource_size(res); |
621 | } else { | 621 | } else { |
622 | base = 0; | 622 | base = 0; |
623 | len = 0; | 623 | len = 0; |
@@ -636,11 +636,11 @@ static void pnpbios_encode_fixed_port(struct pnp_dev *dev, unsigned char *p, | |||
636 | struct resource *res) | 636 | struct resource *res) |
637 | { | 637 | { |
638 | unsigned long base = res->start; | 638 | unsigned long base = res->start; |
639 | unsigned long len = res->end - res->start + 1; | 639 | unsigned long len = resource_size(res); |
640 | 640 | ||
641 | if (pnp_resource_enabled(res)) { | 641 | if (pnp_resource_enabled(res)) { |
642 | base = res->start; | 642 | base = res->start; |
643 | len = res->end - res->start + 1; | 643 | len = resource_size(res); |
644 | } else { | 644 | } else { |
645 | base = 0; | 645 | base = 0; |
646 | len = 0; | 646 | len = 0; |
diff --git a/drivers/rtc/rtc-at32ap700x.c b/drivers/rtc/rtc-at32ap700x.c index e725d51e773d..8dd08305aae1 100644 --- a/drivers/rtc/rtc-at32ap700x.c +++ b/drivers/rtc/rtc-at32ap700x.c | |||
@@ -223,7 +223,7 @@ static int __init at32_rtc_probe(struct platform_device *pdev) | |||
223 | } | 223 | } |
224 | 224 | ||
225 | rtc->irq = irq; | 225 | rtc->irq = irq; |
226 | rtc->regs = ioremap(regs->start, regs->end - regs->start + 1); | 226 | rtc->regs = ioremap(regs->start, resource_size(regs)); |
227 | if (!rtc->regs) { | 227 | if (!rtc->regs) { |
228 | ret = -ENOMEM; | 228 | ret = -ENOMEM; |
229 | dev_dbg(&pdev->dev, "could not map I/O memory\n"); | 229 | dev_dbg(&pdev->dev, "could not map I/O memory\n"); |
diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c index 911e75cdc125..05beb6c1ca79 100644 --- a/drivers/rtc/rtc-cmos.c +++ b/drivers/rtc/rtc-cmos.c | |||
@@ -606,7 +606,7 @@ cmos_do_probe(struct device *dev, struct resource *ports, int rtc_irq) | |||
606 | * (needing ioremap etc), not i/o space resources like this ... | 606 | * (needing ioremap etc), not i/o space resources like this ... |
607 | */ | 607 | */ |
608 | ports = request_region(ports->start, | 608 | ports = request_region(ports->start, |
609 | ports->end + 1 - ports->start, | 609 | resource_size(ports), |
610 | driver_name); | 610 | driver_name); |
611 | if (!ports) { | 611 | if (!ports) { |
612 | dev_dbg(dev, "i/o registers already in use\n"); | 612 | dev_dbg(dev, "i/o registers already in use\n"); |
@@ -750,7 +750,7 @@ cleanup1: | |||
750 | cmos_rtc.dev = NULL; | 750 | cmos_rtc.dev = NULL; |
751 | rtc_device_unregister(cmos_rtc.rtc); | 751 | rtc_device_unregister(cmos_rtc.rtc); |
752 | cleanup0: | 752 | cleanup0: |
753 | release_region(ports->start, ports->end + 1 - ports->start); | 753 | release_region(ports->start, resource_size(ports)); |
754 | return retval; | 754 | return retval; |
755 | } | 755 | } |
756 | 756 | ||
@@ -779,7 +779,7 @@ static void __exit cmos_do_remove(struct device *dev) | |||
779 | cmos->rtc = NULL; | 779 | cmos->rtc = NULL; |
780 | 780 | ||
781 | ports = cmos->iomem; | 781 | ports = cmos->iomem; |
782 | release_region(ports->start, ports->end + 1 - ports->start); | 782 | release_region(ports->start, resource_size(ports)); |
783 | cmos->iomem = NULL; | 783 | cmos->iomem = NULL; |
784 | 784 | ||
785 | cmos->dev = NULL; | 785 | cmos->dev = NULL; |
diff --git a/drivers/rtc/rtc-ds1286.c b/drivers/rtc/rtc-ds1286.c index 47e681df31e2..68e6caf25496 100644 --- a/drivers/rtc/rtc-ds1286.c +++ b/drivers/rtc/rtc-ds1286.c | |||
@@ -343,7 +343,7 @@ static int __devinit ds1286_probe(struct platform_device *pdev) | |||
343 | if (!priv) | 343 | if (!priv) |
344 | return -ENOMEM; | 344 | return -ENOMEM; |
345 | 345 | ||
346 | priv->size = res->end - res->start + 1; | 346 | priv->size = resource_size(res); |
347 | if (!request_mem_region(res->start, priv->size, pdev->name)) { | 347 | if (!request_mem_region(res->start, priv->size, pdev->name)) { |
348 | ret = -EBUSY; | 348 | ret = -EBUSY; |
349 | goto out; | 349 | goto out; |
diff --git a/drivers/rtc/rtc-ds1511.c b/drivers/rtc/rtc-ds1511.c index fbabc773dded..568ad30617e7 100644 --- a/drivers/rtc/rtc-ds1511.c +++ b/drivers/rtc/rtc-ds1511.c | |||
@@ -490,7 +490,7 @@ ds1511_rtc_probe(struct platform_device *pdev) | |||
490 | pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); | 490 | pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); |
491 | if (!pdata) | 491 | if (!pdata) |
492 | return -ENOMEM; | 492 | return -ENOMEM; |
493 | pdata->size = res->end - res->start + 1; | 493 | pdata->size = resource_size(res); |
494 | if (!devm_request_mem_region(&pdev->dev, res->start, pdata->size, | 494 | if (!devm_request_mem_region(&pdev->dev, res->start, pdata->size, |
495 | pdev->name)) | 495 | pdev->name)) |
496 | return -EBUSY; | 496 | return -EBUSY; |
diff --git a/drivers/rtc/rtc-ds1742.c b/drivers/rtc/rtc-ds1742.c index 042630c90dd3..d84a448dd754 100644 --- a/drivers/rtc/rtc-ds1742.c +++ b/drivers/rtc/rtc-ds1742.c | |||
@@ -173,7 +173,7 @@ static int __devinit ds1742_rtc_probe(struct platform_device *pdev) | |||
173 | pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); | 173 | pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); |
174 | if (!pdata) | 174 | if (!pdata) |
175 | return -ENOMEM; | 175 | return -ENOMEM; |
176 | pdata->size = res->end - res->start + 1; | 176 | pdata->size = resource_size(res); |
177 | if (!devm_request_mem_region(&pdev->dev, res->start, pdata->size, | 177 | if (!devm_request_mem_region(&pdev->dev, res->start, pdata->size, |
178 | pdev->name)) | 178 | pdev->name)) |
179 | return -EBUSY; | 179 | return -EBUSY; |
diff --git a/drivers/rtc/rtc-m48t35.c b/drivers/rtc/rtc-m48t35.c index 7410875e5838..8e2a24e33ed6 100644 --- a/drivers/rtc/rtc-m48t35.c +++ b/drivers/rtc/rtc-m48t35.c | |||
@@ -154,7 +154,7 @@ static int __devinit m48t35_probe(struct platform_device *pdev) | |||
154 | if (!priv) | 154 | if (!priv) |
155 | return -ENOMEM; | 155 | return -ENOMEM; |
156 | 156 | ||
157 | priv->size = res->end - res->start + 1; | 157 | priv->size = resource_size(res); |
158 | /* | 158 | /* |
159 | * kludge: remove the #ifndef after ioc3 resource | 159 | * kludge: remove the #ifndef after ioc3 resource |
160 | * conflicts are resolved | 160 | * conflicts are resolved |
diff --git a/drivers/rtc/rtc-m48t59.c b/drivers/rtc/rtc-m48t59.c index 3978f4caf724..28365388fb6c 100644 --- a/drivers/rtc/rtc-m48t59.c +++ b/drivers/rtc/rtc-m48t59.c | |||
@@ -433,7 +433,7 @@ static int __devinit m48t59_rtc_probe(struct platform_device *pdev) | |||
433 | 433 | ||
434 | if (!m48t59->ioaddr) { | 434 | if (!m48t59->ioaddr) { |
435 | /* ioaddr not mapped externally */ | 435 | /* ioaddr not mapped externally */ |
436 | m48t59->ioaddr = ioremap(res->start, res->end - res->start + 1); | 436 | m48t59->ioaddr = ioremap(res->start, resource_size(res)); |
437 | if (!m48t59->ioaddr) | 437 | if (!m48t59->ioaddr) |
438 | goto out; | 438 | goto out; |
439 | } | 439 | } |
diff --git a/drivers/rtc/rtc-mrst.c b/drivers/rtc/rtc-mrst.c index 0cec5650d56a..d33544802a2e 100644 --- a/drivers/rtc/rtc-mrst.c +++ b/drivers/rtc/rtc-mrst.c | |||
@@ -332,9 +332,8 @@ vrtc_mrst_do_probe(struct device *dev, struct resource *iomem, int rtc_irq) | |||
332 | if (!iomem) | 332 | if (!iomem) |
333 | return -ENODEV; | 333 | return -ENODEV; |
334 | 334 | ||
335 | iomem = request_mem_region(iomem->start, | 335 | iomem = request_mem_region(iomem->start, resource_size(iomem), |
336 | iomem->end + 1 - iomem->start, | 336 | driver_name); |
337 | driver_name); | ||
338 | if (!iomem) { | 337 | if (!iomem) { |
339 | dev_dbg(dev, "i/o mem already in use.\n"); | 338 | dev_dbg(dev, "i/o mem already in use.\n"); |
340 | return -EBUSY; | 339 | return -EBUSY; |
diff --git a/drivers/rtc/rtc-puv3.c b/drivers/rtc/rtc-puv3.c index 46f14b82f3ab..b3eba3cddd42 100644 --- a/drivers/rtc/rtc-puv3.c +++ b/drivers/rtc/rtc-puv3.c | |||
@@ -267,9 +267,8 @@ static int puv3_rtc_probe(struct platform_device *pdev) | |||
267 | return -ENOENT; | 267 | return -ENOENT; |
268 | } | 268 | } |
269 | 269 | ||
270 | puv3_rtc_mem = request_mem_region(res->start, | 270 | puv3_rtc_mem = request_mem_region(res->start, resource_size(res), |
271 | res->end-res->start+1, | 271 | pdev->name); |
272 | pdev->name); | ||
273 | 272 | ||
274 | if (puv3_rtc_mem == NULL) { | 273 | if (puv3_rtc_mem == NULL) { |
275 | dev_err(&pdev->dev, "failed to reserve memory region\n"); | 274 | dev_err(&pdev->dev, "failed to reserve memory region\n"); |
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index 16512ecae31a..2a65e85e0f56 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c | |||
@@ -455,8 +455,7 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev) | |||
455 | return -ENOENT; | 455 | return -ENOENT; |
456 | } | 456 | } |
457 | 457 | ||
458 | s3c_rtc_mem = request_mem_region(res->start, | 458 | s3c_rtc_mem = request_mem_region(res->start, resource_size(res), |
459 | res->end-res->start+1, | ||
460 | pdev->name); | 459 | pdev->name); |
461 | 460 | ||
462 | if (s3c_rtc_mem == NULL) { | 461 | if (s3c_rtc_mem == NULL) { |
@@ -465,7 +464,7 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev) | |||
465 | goto err_nores; | 464 | goto err_nores; |
466 | } | 465 | } |
467 | 466 | ||
468 | s3c_rtc_base = ioremap(res->start, res->end - res->start + 1); | 467 | s3c_rtc_base = ioremap(res->start, resource_size(res)); |
469 | if (s3c_rtc_base == NULL) { | 468 | if (s3c_rtc_base == NULL) { |
470 | dev_err(&pdev->dev, "failed ioremap()\n"); | 469 | dev_err(&pdev->dev, "failed ioremap()\n"); |
471 | ret = -EINVAL; | 470 | ret = -EINVAL; |
diff --git a/drivers/staging/generic_serial/ser_a2232.c b/drivers/staging/generic_serial/ser_a2232.c index 3f47c2ead8e5..0c08e1c25583 100644 --- a/drivers/staging/generic_serial/ser_a2232.c +++ b/drivers/staging/generic_serial/ser_a2232.c | |||
@@ -746,7 +746,8 @@ static int __init a2232board_init(void) | |||
746 | zd_a2232[nr_a2232] = z; | 746 | zd_a2232[nr_a2232] = z; |
747 | 747 | ||
748 | boardaddr = ZTWO_VADDR( z->resource.start ); | 748 | boardaddr = ZTWO_VADDR( z->resource.start ); |
749 | printk("Board is located at address 0x%x, size is 0x%x.\n", boardaddr, (unsigned int) ((z->resource.end+1) - (z->resource.start))); | 749 | printk("Board is located at address 0x%x, size is 0x%x\n", |
750 | boardaddr, (unsigned int)resource_size(&z->resource)); | ||
750 | 751 | ||
751 | mem = (volatile struct a2232memory *) boardaddr; | 752 | mem = (volatile struct a2232memory *) boardaddr; |
752 | 753 | ||
diff --git a/drivers/staging/gma500/psb_gtt.c b/drivers/staging/gma500/psb_gtt.c index 74c5a6569d08..280f9d445468 100644 --- a/drivers/staging/gma500/psb_gtt.c +++ b/drivers/staging/gma500/psb_gtt.c | |||
@@ -80,7 +80,7 @@ static int psb_gtt_insert(struct drm_device *dev, struct gtt_range *r) | |||
80 | { | 80 | { |
81 | struct drm_psb_private *dev_priv = dev->dev_private; | 81 | struct drm_psb_private *dev_priv = dev->dev_private; |
82 | u32 *gtt_slot, pte; | 82 | u32 *gtt_slot, pte; |
83 | int numpages = (r->resource.end + 1 - r->resource.start) >> PAGE_SHIFT; | 83 | int numpages = resource_size(&r->resource) >> PAGE_SHIFT; |
84 | struct page **pages; | 84 | struct page **pages; |
85 | int i; | 85 | int i; |
86 | 86 | ||
@@ -121,7 +121,7 @@ static void psb_gtt_remove(struct drm_device *dev, struct gtt_range *r) | |||
121 | { | 121 | { |
122 | struct drm_psb_private *dev_priv = dev->dev_private; | 122 | struct drm_psb_private *dev_priv = dev->dev_private; |
123 | u32 *gtt_slot, pte; | 123 | u32 *gtt_slot, pte; |
124 | int numpages = (r->resource.end + 1 - r->resource.start) >> PAGE_SHIFT; | 124 | int numpages = resource_size(&r->resource) >> PAGE_SHIFT; |
125 | int i; | 125 | int i; |
126 | 126 | ||
127 | WARN_ON(r->stolen); | 127 | WARN_ON(r->stolen); |
@@ -149,7 +149,7 @@ static int psb_gtt_attach_pages(struct gtt_range *gt) | |||
149 | struct address_space *mapping; | 149 | struct address_space *mapping; |
150 | int i; | 150 | int i; |
151 | struct page *p; | 151 | struct page *p; |
152 | int pages = (gt->resource.end + 1 - gt->resource.start) >> PAGE_SHIFT; | 152 | int pages = resource_size(>->resource) >> PAGE_SHIFT; |
153 | 153 | ||
154 | WARN_ON(gt->pages); | 154 | WARN_ON(gt->pages); |
155 | 155 | ||
@@ -191,7 +191,7 @@ err: | |||
191 | static void psb_gtt_detach_pages(struct gtt_range *gt) | 191 | static void psb_gtt_detach_pages(struct gtt_range *gt) |
192 | { | 192 | { |
193 | int i; | 193 | int i; |
194 | int pages = (gt->resource.end + 1 - gt->resource.start) >> PAGE_SHIFT; | 194 | int pages = resource_size(>->resource) >> PAGE_SHIFT; |
195 | 195 | ||
196 | for (i = 0; i < pages; i++) { | 196 | for (i = 0; i < pages; i++) { |
197 | /* FIXME: do we need to force dirty */ | 197 | /* FIXME: do we need to force dirty */ |
diff --git a/drivers/tty/serial/bfin_5xx.c b/drivers/tty/serial/bfin_5xx.c index 9b1ff2b6bb37..ff6979181ac5 100644 --- a/drivers/tty/serial/bfin_5xx.c +++ b/drivers/tty/serial/bfin_5xx.c | |||
@@ -1304,8 +1304,7 @@ static int bfin_serial_probe(struct platform_device *pdev) | |||
1304 | goto out_error_free_peripherals; | 1304 | goto out_error_free_peripherals; |
1305 | } | 1305 | } |
1306 | 1306 | ||
1307 | uart->port.membase = ioremap(res->start, | 1307 | uart->port.membase = ioremap(res->start, resource_size(res)); |
1308 | res->end - res->start); | ||
1309 | if (!uart->port.membase) { | 1308 | if (!uart->port.membase) { |
1310 | dev_err(&pdev->dev, "Cannot map uart IO\n"); | 1309 | dev_err(&pdev->dev, "Cannot map uart IO\n"); |
1311 | ret = -ENXIO; | 1310 | ret = -ENXIO; |
@@ -1483,7 +1482,7 @@ static int bfin_earlyprintk_probe(struct platform_device *pdev) | |||
1483 | } | 1482 | } |
1484 | 1483 | ||
1485 | bfin_earlyprintk_port.port.membase = ioremap(res->start, | 1484 | bfin_earlyprintk_port.port.membase = ioremap(res->start, |
1486 | res->end - res->start); | 1485 | resource_size(res)); |
1487 | if (!bfin_earlyprintk_port.port.membase) { | 1486 | if (!bfin_earlyprintk_port.port.membase) { |
1488 | dev_err(&pdev->dev, "Cannot map uart IO\n"); | 1487 | dev_err(&pdev->dev, "Cannot map uart IO\n"); |
1489 | ret = -ENXIO; | 1488 | ret = -ENXIO; |
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index a54473123e0a..22fe801cce31 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c | |||
@@ -954,7 +954,7 @@ static void imx_release_port(struct uart_port *port) | |||
954 | struct resource *mmres; | 954 | struct resource *mmres; |
955 | 955 | ||
956 | mmres = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 956 | mmres = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
957 | release_mem_region(mmres->start, mmres->end - mmres->start + 1); | 957 | release_mem_region(mmres->start, resource_size(mmres)); |
958 | } | 958 | } |
959 | 959 | ||
960 | /* | 960 | /* |
@@ -970,8 +970,7 @@ static int imx_request_port(struct uart_port *port) | |||
970 | if (!mmres) | 970 | if (!mmres) |
971 | return -ENODEV; | 971 | return -ENODEV; |
972 | 972 | ||
973 | ret = request_mem_region(mmres->start, mmres->end - mmres->start + 1, | 973 | ret = request_mem_region(mmres->start, resource_size(mmres), "imx-uart"); |
974 | "imx-uart"); | ||
975 | 974 | ||
976 | return ret ? 0 : -EBUSY; | 975 | return ret ? 0 : -EBUSY; |
977 | } | 976 | } |
diff --git a/drivers/tty/serial/m32r_sio.c b/drivers/tty/serial/m32r_sio.c index 84db7321cce8..8e07517f8acd 100644 --- a/drivers/tty/serial/m32r_sio.c +++ b/drivers/tty/serial/m32r_sio.c | |||
@@ -892,7 +892,7 @@ static int m32r_sio_request_port(struct uart_port *port) | |||
892 | * If we have a mapbase, then request that as well. | 892 | * If we have a mapbase, then request that as well. |
893 | */ | 893 | */ |
894 | if (ret == 0 && up->port.flags & UPF_IOREMAP) { | 894 | if (ret == 0 && up->port.flags & UPF_IOREMAP) { |
895 | int size = res->end - res->start + 1; | 895 | int size = resource_size(res); |
896 | 896 | ||
897 | up->port.membase = ioremap(up->port.mapbase, size); | 897 | up->port.membase = ioremap(up->port.mapbase, size); |
898 | if (!up->port.membase) | 898 | if (!up->port.membase) |
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c index 47cadf474149..c37df8d0fa28 100644 --- a/drivers/tty/serial/omap-serial.c +++ b/drivers/tty/serial/omap-serial.c | |||
@@ -1241,8 +1241,8 @@ static int serial_omap_probe(struct platform_device *pdev) | |||
1241 | return -ENODEV; | 1241 | return -ENODEV; |
1242 | } | 1242 | } |
1243 | 1243 | ||
1244 | if (!request_mem_region(mem->start, (mem->end - mem->start) + 1, | 1244 | if (!request_mem_region(mem->start, resource_size(mem), |
1245 | pdev->dev.driver->name)) { | 1245 | pdev->dev.driver->name)) { |
1246 | dev_err(&pdev->dev, "memory region already claimed\n"); | 1246 | dev_err(&pdev->dev, "memory region already claimed\n"); |
1247 | return -EBUSY; | 1247 | return -EBUSY; |
1248 | } | 1248 | } |
@@ -1308,7 +1308,7 @@ err: | |||
1308 | dev_err(&pdev->dev, "[UART%d]: failure [%s]: %d\n", | 1308 | dev_err(&pdev->dev, "[UART%d]: failure [%s]: %d\n", |
1309 | pdev->id, __func__, ret); | 1309 | pdev->id, __func__, ret); |
1310 | do_release_region: | 1310 | do_release_region: |
1311 | release_mem_region(mem->start, (mem->end - mem->start) + 1); | 1311 | release_mem_region(mem->start, resource_size(mem)); |
1312 | return ret; | 1312 | return ret; |
1313 | } | 1313 | } |
1314 | 1314 | ||
diff --git a/drivers/tty/serial/pxa.c b/drivers/tty/serial/pxa.c index 4302e6e3768e..531931c1b250 100644 --- a/drivers/tty/serial/pxa.c +++ b/drivers/tty/serial/pxa.c | |||
@@ -803,7 +803,7 @@ static int serial_pxa_probe(struct platform_device *dev) | |||
803 | break; | 803 | break; |
804 | } | 804 | } |
805 | 805 | ||
806 | sport->port.membase = ioremap(mmres->start, mmres->end - mmres->start + 1); | 806 | sport->port.membase = ioremap(mmres->start, resource_size(mmres)); |
807 | if (!sport->port.membase) { | 807 | if (!sport->port.membase) { |
808 | ret = -ENOMEM; | 808 | ret = -ENOMEM; |
809 | goto err_clk; | 809 | goto err_clk; |
diff --git a/drivers/tty/serial/sunsu.c b/drivers/tty/serial/sunsu.c index 92aa54550e84..ad0f8f5f6ea1 100644 --- a/drivers/tty/serial/sunsu.c +++ b/drivers/tty/serial/sunsu.c | |||
@@ -1435,7 +1435,7 @@ static int __devinit su_probe(struct platform_device *op) | |||
1435 | 1435 | ||
1436 | rp = &op->resource[0]; | 1436 | rp = &op->resource[0]; |
1437 | up->port.mapbase = rp->start; | 1437 | up->port.mapbase = rp->start; |
1438 | up->reg_size = (rp->end - rp->start) + 1; | 1438 | up->reg_size = resource_size(rp); |
1439 | up->port.membase = of_ioremap(rp, 0, up->reg_size, "su"); | 1439 | up->port.membase = of_ioremap(rp, 0, up->reg_size, "su"); |
1440 | if (!up->port.membase) { | 1440 | if (!up->port.membase) { |
1441 | if (type != SU_PORT_PORT) | 1441 | if (type != SU_PORT_PORT) |
diff --git a/drivers/tty/serial/vt8500_serial.c b/drivers/tty/serial/vt8500_serial.c index 37fc4e3d487c..026cb9ea5cd1 100644 --- a/drivers/tty/serial/vt8500_serial.c +++ b/drivers/tty/serial/vt8500_serial.c | |||
@@ -573,8 +573,7 @@ static int __init vt8500_serial_probe(struct platform_device *pdev) | |||
573 | snprintf(vt8500_port->name, sizeof(vt8500_port->name), | 573 | snprintf(vt8500_port->name, sizeof(vt8500_port->name), |
574 | "VT8500 UART%d", pdev->id); | 574 | "VT8500 UART%d", pdev->id); |
575 | 575 | ||
576 | vt8500_port->uart.membase = ioremap(mmres->start, | 576 | vt8500_port->uart.membase = ioremap(mmres->start, resource_size(mmres)); |
577 | mmres->end - mmres->start + 1); | ||
578 | if (!vt8500_port->uart.membase) { | 577 | if (!vt8500_port->uart.membase) { |
579 | ret = -ENOMEM; | 578 | ret = -ENOMEM; |
580 | goto err; | 579 | goto err; |
diff --git a/drivers/uio/uio_pdrv.c b/drivers/uio/uio_pdrv.c index 7d3e469b9904..bdc3db946122 100644 --- a/drivers/uio/uio_pdrv.c +++ b/drivers/uio/uio_pdrv.c | |||
@@ -58,7 +58,7 @@ static int uio_pdrv_probe(struct platform_device *pdev) | |||
58 | 58 | ||
59 | uiomem->memtype = UIO_MEM_PHYS; | 59 | uiomem->memtype = UIO_MEM_PHYS; |
60 | uiomem->addr = r->start; | 60 | uiomem->addr = r->start; |
61 | uiomem->size = r->end - r->start + 1; | 61 | uiomem->size = resource_size(r); |
62 | ++uiomem; | 62 | ++uiomem; |
63 | } | 63 | } |
64 | 64 | ||
diff --git a/drivers/uio/uio_pdrv_genirq.c b/drivers/uio/uio_pdrv_genirq.c index 0f424af7f109..31e799d9efe5 100644 --- a/drivers/uio/uio_pdrv_genirq.c +++ b/drivers/uio/uio_pdrv_genirq.c | |||
@@ -137,7 +137,7 @@ static int uio_pdrv_genirq_probe(struct platform_device *pdev) | |||
137 | 137 | ||
138 | uiomem->memtype = UIO_MEM_PHYS; | 138 | uiomem->memtype = UIO_MEM_PHYS; |
139 | uiomem->addr = r->start; | 139 | uiomem->addr = r->start; |
140 | uiomem->size = r->end - r->start + 1; | 140 | uiomem->size = resource_size(r); |
141 | ++uiomem; | 141 | ++uiomem; |
142 | } | 142 | } |
143 | 143 | ||
diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c index db1a659702ba..f045c8968a6e 100644 --- a/drivers/usb/gadget/atmel_usba_udc.c +++ b/drivers/usb/gadget/atmel_usba_udc.c | |||
@@ -272,7 +272,7 @@ static void usba_init_debugfs(struct usba_udc *udc) | |||
272 | 272 | ||
273 | regs_resource = platform_get_resource(udc->pdev, IORESOURCE_MEM, | 273 | regs_resource = platform_get_resource(udc->pdev, IORESOURCE_MEM, |
274 | CTRL_IOMEM_ID); | 274 | CTRL_IOMEM_ID); |
275 | regs->d_inode->i_size = regs_resource->end - regs_resource->start + 1; | 275 | regs->d_inode->i_size = resource_size(regs_resource); |
276 | udc->debugfs_regs = regs; | 276 | udc->debugfs_regs = regs; |
277 | 277 | ||
278 | usba_ep_init_debugfs(udc, to_usba_ep(udc->gadget.ep0)); | 278 | usba_ep_init_debugfs(udc, to_usba_ep(udc->gadget.ep0)); |
diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c index 2cd9a60c7f3a..9c8e56fd0ffe 100644 --- a/drivers/usb/gadget/fsl_udc_core.c +++ b/drivers/usb/gadget/fsl_udc_core.c | |||
@@ -2445,7 +2445,7 @@ static int __init fsl_udc_probe(struct platform_device *pdev) | |||
2445 | } | 2445 | } |
2446 | 2446 | ||
2447 | if (pdata->operating_mode == FSL_USB2_DR_DEVICE) { | 2447 | if (pdata->operating_mode == FSL_USB2_DR_DEVICE) { |
2448 | if (!request_mem_region(res->start, res->end - res->start + 1, | 2448 | if (!request_mem_region(res->start, resource_size(res), |
2449 | driver_name)) { | 2449 | driver_name)) { |
2450 | ERR("request mem region for %s failed\n", pdev->name); | 2450 | ERR("request mem region for %s failed\n", pdev->name); |
2451 | ret = -EBUSY; | 2451 | ret = -EBUSY; |
@@ -2593,7 +2593,7 @@ err_iounmap_noclk: | |||
2593 | iounmap(dr_regs); | 2593 | iounmap(dr_regs); |
2594 | err_release_mem_region: | 2594 | err_release_mem_region: |
2595 | if (pdata->operating_mode == FSL_USB2_DR_DEVICE) | 2595 | if (pdata->operating_mode == FSL_USB2_DR_DEVICE) |
2596 | release_mem_region(res->start, res->end - res->start + 1); | 2596 | release_mem_region(res->start, resource_size(res)); |
2597 | err_kfree: | 2597 | err_kfree: |
2598 | kfree(udc_controller); | 2598 | kfree(udc_controller); |
2599 | udc_controller = NULL; | 2599 | udc_controller = NULL; |
@@ -2628,7 +2628,7 @@ static int __exit fsl_udc_remove(struct platform_device *pdev) | |||
2628 | free_irq(udc_controller->irq, udc_controller); | 2628 | free_irq(udc_controller->irq, udc_controller); |
2629 | iounmap(dr_regs); | 2629 | iounmap(dr_regs); |
2630 | if (pdata->operating_mode == FSL_USB2_DR_DEVICE) | 2630 | if (pdata->operating_mode == FSL_USB2_DR_DEVICE) |
2631 | release_mem_region(res->start, res->end - res->start + 1); | 2631 | release_mem_region(res->start, resource_size(res)); |
2632 | 2632 | ||
2633 | device_unregister(&udc_controller->gadget.dev); | 2633 | device_unregister(&udc_controller->gadget.dev); |
2634 | /* free udc --wait for the release() finished */ | 2634 | /* free udc --wait for the release() finished */ |
diff --git a/drivers/usb/host/ehci-ath79.c b/drivers/usb/host/ehci-ath79.c index 98cc8a13169c..eab3d7059fbe 100644 --- a/drivers/usb/host/ehci-ath79.c +++ b/drivers/usb/host/ehci-ath79.c | |||
@@ -146,7 +146,7 @@ static int ehci_ath79_probe(struct platform_device *pdev) | |||
146 | return -ENOMEM; | 146 | return -ENOMEM; |
147 | 147 | ||
148 | hcd->rsrc_start = res->start; | 148 | hcd->rsrc_start = res->start; |
149 | hcd->rsrc_len = res->end - res->start + 1; | 149 | hcd->rsrc_len = resource_size(res); |
150 | 150 | ||
151 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { | 151 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { |
152 | dev_dbg(&pdev->dev, "controller already in use\n"); | 152 | dev_dbg(&pdev->dev, "controller already in use\n"); |
diff --git a/drivers/usb/host/ehci-cns3xxx.c b/drivers/usb/host/ehci-cns3xxx.c index d41745c6f0c4..6536abdea6e6 100644 --- a/drivers/usb/host/ehci-cns3xxx.c +++ b/drivers/usb/host/ehci-cns3xxx.c | |||
@@ -107,7 +107,7 @@ static int cns3xxx_ehci_probe(struct platform_device *pdev) | |||
107 | } | 107 | } |
108 | 108 | ||
109 | hcd->rsrc_start = res->start; | 109 | hcd->rsrc_start = res->start; |
110 | hcd->rsrc_len = res->end - res->start + 1; | 110 | hcd->rsrc_len = resource_size(res); |
111 | 111 | ||
112 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, | 112 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, |
113 | driver->description)) { | 113 | driver->description)) { |
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c index f380bf97e5af..34a3140d1e5f 100644 --- a/drivers/usb/host/ehci-fsl.c +++ b/drivers/usb/host/ehci-fsl.c | |||
@@ -100,7 +100,7 @@ static int usb_hcd_fsl_probe(const struct hc_driver *driver, | |||
100 | goto err2; | 100 | goto err2; |
101 | } | 101 | } |
102 | hcd->rsrc_start = res->start; | 102 | hcd->rsrc_start = res->start; |
103 | hcd->rsrc_len = res->end - res->start + 1; | 103 | hcd->rsrc_len = resource_size(res); |
104 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, | 104 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, |
105 | driver->description)) { | 105 | driver->description)) { |
106 | dev_dbg(&pdev->dev, "controller already in use\n"); | 106 | dev_dbg(&pdev->dev, "controller already in use\n"); |
diff --git a/drivers/usb/host/ehci-grlib.c b/drivers/usb/host/ehci-grlib.c index 93b230dc51a2..fdfd8c5b639b 100644 --- a/drivers/usb/host/ehci-grlib.c +++ b/drivers/usb/host/ehci-grlib.c | |||
@@ -130,7 +130,7 @@ static int __devinit ehci_hcd_grlib_probe(struct platform_device *op) | |||
130 | return -ENOMEM; | 130 | return -ENOMEM; |
131 | 131 | ||
132 | hcd->rsrc_start = res.start; | 132 | hcd->rsrc_start = res.start; |
133 | hcd->rsrc_len = res.end - res.start + 1; | 133 | hcd->rsrc_len = resource_size(&res); |
134 | 134 | ||
135 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { | 135 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { |
136 | printk(KERN_ERR "%s: request_mem_region failed\n", __FILE__); | 136 | printk(KERN_ERR "%s: request_mem_region failed\n", __FILE__); |
diff --git a/drivers/usb/host/ehci-ixp4xx.c b/drivers/usb/host/ehci-ixp4xx.c index 50e600d26e28..c4460f3d009f 100644 --- a/drivers/usb/host/ehci-ixp4xx.c +++ b/drivers/usb/host/ehci-ixp4xx.c | |||
@@ -100,7 +100,7 @@ static int ixp4xx_ehci_probe(struct platform_device *pdev) | |||
100 | goto fail_request_resource; | 100 | goto fail_request_resource; |
101 | } | 101 | } |
102 | hcd->rsrc_start = res->start; | 102 | hcd->rsrc_start = res->start; |
103 | hcd->rsrc_len = res->end - res->start + 1; | 103 | hcd->rsrc_len = resource_size(res); |
104 | 104 | ||
105 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, | 105 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, |
106 | driver->description)) { | 106 | driver->description)) { |
diff --git a/drivers/usb/host/ehci-octeon.c b/drivers/usb/host/ehci-octeon.c index ff55757ba7d8..c3ba3ed5f3a6 100644 --- a/drivers/usb/host/ehci-octeon.c +++ b/drivers/usb/host/ehci-octeon.c | |||
@@ -124,7 +124,7 @@ static int ehci_octeon_drv_probe(struct platform_device *pdev) | |||
124 | return -ENOMEM; | 124 | return -ENOMEM; |
125 | 125 | ||
126 | hcd->rsrc_start = res_mem->start; | 126 | hcd->rsrc_start = res_mem->start; |
127 | hcd->rsrc_len = res_mem->end - res_mem->start + 1; | 127 | hcd->rsrc_len = resource_size(res_mem); |
128 | 128 | ||
129 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, | 129 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, |
130 | OCTEON_EHCI_HCD_NAME)) { | 130 | OCTEON_EHCI_HCD_NAME)) { |
diff --git a/drivers/usb/host/ehci-pmcmsp.c b/drivers/usb/host/ehci-pmcmsp.c index cd69099cda19..e8d54de44acc 100644 --- a/drivers/usb/host/ehci-pmcmsp.c +++ b/drivers/usb/host/ehci-pmcmsp.c | |||
@@ -124,7 +124,7 @@ static int usb_hcd_msp_map_regs(struct mspusb_device *dev) | |||
124 | res = platform_get_resource(pdev, IORESOURCE_MEM, 1); | 124 | res = platform_get_resource(pdev, IORESOURCE_MEM, 1); |
125 | if (res == NULL) | 125 | if (res == NULL) |
126 | return -ENOMEM; | 126 | return -ENOMEM; |
127 | res_len = res->end - res->start + 1; | 127 | res_len = resource_size(res); |
128 | if (!request_mem_region(res->start, res_len, "mab regs")) | 128 | if (!request_mem_region(res->start, res_len, "mab regs")) |
129 | return -EBUSY; | 129 | return -EBUSY; |
130 | 130 | ||
@@ -140,7 +140,7 @@ static int usb_hcd_msp_map_regs(struct mspusb_device *dev) | |||
140 | retval = -ENOMEM; | 140 | retval = -ENOMEM; |
141 | goto err2; | 141 | goto err2; |
142 | } | 142 | } |
143 | res_len = res->end - res->start + 1; | 143 | res_len = resource_size(res); |
144 | if (!request_mem_region(res->start, res_len, "usbid regs")) { | 144 | if (!request_mem_region(res->start, res_len, "usbid regs")) { |
145 | retval = -EBUSY; | 145 | retval = -EBUSY; |
146 | goto err2; | 146 | goto err2; |
@@ -154,13 +154,13 @@ static int usb_hcd_msp_map_regs(struct mspusb_device *dev) | |||
154 | return 0; | 154 | return 0; |
155 | err3: | 155 | err3: |
156 | res = platform_get_resource(pdev, IORESOURCE_MEM, 2); | 156 | res = platform_get_resource(pdev, IORESOURCE_MEM, 2); |
157 | res_len = res->end - res->start + 1; | 157 | res_len = resource_size(res); |
158 | release_mem_region(res->start, res_len); | 158 | release_mem_region(res->start, res_len); |
159 | err2: | 159 | err2: |
160 | iounmap(dev->mab_regs); | 160 | iounmap(dev->mab_regs); |
161 | err1: | 161 | err1: |
162 | res = platform_get_resource(pdev, IORESOURCE_MEM, 1); | 162 | res = platform_get_resource(pdev, IORESOURCE_MEM, 1); |
163 | res_len = res->end - res->start + 1; | 163 | res_len = resource_size(res); |
164 | release_mem_region(res->start, res_len); | 164 | release_mem_region(res->start, res_len); |
165 | dev_err(&pdev->dev, "Failed to map non-EHCI regs.\n"); | 165 | dev_err(&pdev->dev, "Failed to map non-EHCI regs.\n"); |
166 | return retval; | 166 | return retval; |
@@ -194,7 +194,7 @@ int usb_hcd_msp_probe(const struct hc_driver *driver, | |||
194 | goto err1; | 194 | goto err1; |
195 | } | 195 | } |
196 | hcd->rsrc_start = res->start; | 196 | hcd->rsrc_start = res->start; |
197 | hcd->rsrc_len = res->end - res->start + 1; | 197 | hcd->rsrc_len = resource_size(res); |
198 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, dev->name)) { | 198 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, dev->name)) { |
199 | retval = -EBUSY; | 199 | retval = -EBUSY; |
200 | goto err1; | 200 | goto err1; |
diff --git a/drivers/usb/host/ehci-ppc-of.c b/drivers/usb/host/ehci-ppc-of.c index 8552db6c29c9..41d11fe14252 100644 --- a/drivers/usb/host/ehci-ppc-of.c +++ b/drivers/usb/host/ehci-ppc-of.c | |||
@@ -130,7 +130,7 @@ static int __devinit ehci_hcd_ppc_of_probe(struct platform_device *op) | |||
130 | return -ENOMEM; | 130 | return -ENOMEM; |
131 | 131 | ||
132 | hcd->rsrc_start = res.start; | 132 | hcd->rsrc_start = res.start; |
133 | hcd->rsrc_len = res.end - res.start + 1; | 133 | hcd->rsrc_len = resource_size(&res); |
134 | 134 | ||
135 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { | 135 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { |
136 | printk(KERN_ERR "%s: request_mem_region failed\n", __FILE__); | 136 | printk(KERN_ERR "%s: request_mem_region failed\n", __FILE__); |
diff --git a/drivers/usb/host/ehci-w90x900.c b/drivers/usb/host/ehci-w90x900.c index 52a027aaa370..d661cf7de140 100644 --- a/drivers/usb/host/ehci-w90x900.c +++ b/drivers/usb/host/ehci-w90x900.c | |||
@@ -41,7 +41,7 @@ static int __devinit usb_w90x900_probe(const struct hc_driver *driver, | |||
41 | } | 41 | } |
42 | 42 | ||
43 | hcd->rsrc_start = res->start; | 43 | hcd->rsrc_start = res->start; |
44 | hcd->rsrc_len = res->end - res->start + 1; | 44 | hcd->rsrc_len = resource_size(res); |
45 | 45 | ||
46 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { | 46 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { |
47 | retval = -EBUSY; | 47 | retval = -EBUSY; |
diff --git a/drivers/usb/host/ehci-xilinx-of.c b/drivers/usb/host/ehci-xilinx-of.c index a64d6d66d760..32793ce3d9e9 100644 --- a/drivers/usb/host/ehci-xilinx-of.c +++ b/drivers/usb/host/ehci-xilinx-of.c | |||
@@ -174,7 +174,7 @@ static int __devinit ehci_hcd_xilinx_of_probe(struct platform_device *op) | |||
174 | return -ENOMEM; | 174 | return -ENOMEM; |
175 | 175 | ||
176 | hcd->rsrc_start = res.start; | 176 | hcd->rsrc_start = res.start; |
177 | hcd->rsrc_len = res.end - res.start + 1; | 177 | hcd->rsrc_len = resource_size(&res); |
178 | 178 | ||
179 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { | 179 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { |
180 | printk(KERN_ERR "%s: request_mem_region failed\n", __FILE__); | 180 | printk(KERN_ERR "%s: request_mem_region failed\n", __FILE__); |
diff --git a/drivers/usb/host/fhci-hcd.c b/drivers/usb/host/fhci-hcd.c index 19223c7449e1..572ea53b0226 100644 --- a/drivers/usb/host/fhci-hcd.c +++ b/drivers/usb/host/fhci-hcd.c | |||
@@ -605,7 +605,7 @@ static int __devinit of_fhci_probe(struct platform_device *ofdev) | |||
605 | goto err_regs; | 605 | goto err_regs; |
606 | } | 606 | } |
607 | 607 | ||
608 | hcd->regs = ioremap(usb_regs.start, usb_regs.end - usb_regs.start + 1); | 608 | hcd->regs = ioremap(usb_regs.start, resource_size(&usb_regs)); |
609 | if (!hcd->regs) { | 609 | if (!hcd->regs) { |
610 | dev_err(dev, "could not ioremap regs\n"); | 610 | dev_err(dev, "could not ioremap regs\n"); |
611 | ret = -ENOMEM; | 611 | ret = -ENOMEM; |
diff --git a/drivers/usb/host/ohci-ath79.c b/drivers/usb/host/ohci-ath79.c index ffea3e7cb0a8..c620c50f6770 100644 --- a/drivers/usb/host/ohci-ath79.c +++ b/drivers/usb/host/ohci-ath79.c | |||
@@ -93,8 +93,8 @@ static int ohci_ath79_probe(struct platform_device *pdev) | |||
93 | ret = -ENODEV; | 93 | ret = -ENODEV; |
94 | goto err_put_hcd; | 94 | goto err_put_hcd; |
95 | } | 95 | } |
96 | hcd->rsrc_start = res->start; | 96 | hcd->rsrc_start = res->start; |
97 | hcd->rsrc_len = res->end - res->start + 1; | 97 | hcd->rsrc_len = resource_size(res); |
98 | 98 | ||
99 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { | 99 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { |
100 | dev_dbg(&pdev->dev, "controller already in use\n"); | 100 | dev_dbg(&pdev->dev, "controller already in use\n"); |
diff --git a/drivers/usb/host/ohci-cns3xxx.c b/drivers/usb/host/ohci-cns3xxx.c index f05ef87e934c..5a00a1e1c6ca 100644 --- a/drivers/usb/host/ohci-cns3xxx.c +++ b/drivers/usb/host/ohci-cns3xxx.c | |||
@@ -100,7 +100,7 @@ static int cns3xxx_ohci_probe(struct platform_device *pdev) | |||
100 | goto err1; | 100 | goto err1; |
101 | } | 101 | } |
102 | hcd->rsrc_start = res->start; | 102 | hcd->rsrc_start = res->start; |
103 | hcd->rsrc_len = res->end - res->start + 1; | 103 | hcd->rsrc_len = resource_size(res); |
104 | 104 | ||
105 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, | 105 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, |
106 | driver->description)) { | 106 | driver->description)) { |
diff --git a/drivers/usb/host/ohci-da8xx.c b/drivers/usb/host/ohci-da8xx.c index d22fb4d577b7..6aca2c4453f7 100644 --- a/drivers/usb/host/ohci-da8xx.c +++ b/drivers/usb/host/ohci-da8xx.c | |||
@@ -322,7 +322,7 @@ static int usb_hcd_da8xx_probe(const struct hc_driver *driver, | |||
322 | goto err2; | 322 | goto err2; |
323 | } | 323 | } |
324 | hcd->rsrc_start = mem->start; | 324 | hcd->rsrc_start = mem->start; |
325 | hcd->rsrc_len = mem->end - mem->start + 1; | 325 | hcd->rsrc_len = resource_size(mem); |
326 | 326 | ||
327 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { | 327 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { |
328 | dev_dbg(&pdev->dev, "request_mem_region failed\n"); | 328 | dev_dbg(&pdev->dev, "request_mem_region failed\n"); |
diff --git a/drivers/usb/host/ohci-octeon.c b/drivers/usb/host/ohci-octeon.c index e4ddfaf8870f..d8b45647d1dc 100644 --- a/drivers/usb/host/ohci-octeon.c +++ b/drivers/usb/host/ohci-octeon.c | |||
@@ -135,7 +135,7 @@ static int ohci_octeon_drv_probe(struct platform_device *pdev) | |||
135 | return -ENOMEM; | 135 | return -ENOMEM; |
136 | 136 | ||
137 | hcd->rsrc_start = res_mem->start; | 137 | hcd->rsrc_start = res_mem->start; |
138 | hcd->rsrc_len = res_mem->end - res_mem->start + 1; | 138 | hcd->rsrc_len = resource_size(res_mem); |
139 | 139 | ||
140 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, | 140 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, |
141 | OCTEON_OHCI_HCD_NAME)) { | 141 | OCTEON_OHCI_HCD_NAME)) { |
diff --git a/drivers/usb/host/ohci-ppc-of.c b/drivers/usb/host/ohci-ppc-of.c index 1ca1821320f4..0c12f4e14dcd 100644 --- a/drivers/usb/host/ohci-ppc-of.c +++ b/drivers/usb/host/ohci-ppc-of.c | |||
@@ -110,7 +110,7 @@ static int __devinit ohci_hcd_ppc_of_probe(struct platform_device *op) | |||
110 | return -ENOMEM; | 110 | return -ENOMEM; |
111 | 111 | ||
112 | hcd->rsrc_start = res.start; | 112 | hcd->rsrc_start = res.start; |
113 | hcd->rsrc_len = res.end - res.start + 1; | 113 | hcd->rsrc_len = resource_size(&res); |
114 | 114 | ||
115 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { | 115 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { |
116 | printk(KERN_ERR "%s: request_mem_region failed\n", __FILE__); | 116 | printk(KERN_ERR "%s: request_mem_region failed\n", __FILE__); |
diff --git a/drivers/usb/host/ohci-ppc-soc.c b/drivers/usb/host/ohci-ppc-soc.c index 89e670e38c10..c0f595c44487 100644 --- a/drivers/usb/host/ohci-ppc-soc.c +++ b/drivers/usb/host/ohci-ppc-soc.c | |||
@@ -56,7 +56,7 @@ static int usb_hcd_ppc_soc_probe(const struct hc_driver *driver, | |||
56 | if (!hcd) | 56 | if (!hcd) |
57 | return -ENOMEM; | 57 | return -ENOMEM; |
58 | hcd->rsrc_start = res->start; | 58 | hcd->rsrc_start = res->start; |
59 | hcd->rsrc_len = res->end - res->start + 1; | 59 | hcd->rsrc_len = resource_size(res); |
60 | 60 | ||
61 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { | 61 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { |
62 | pr_debug("%s: request_mem_region failed\n", __FILE__); | 62 | pr_debug("%s: request_mem_region failed\n", __FILE__); |
diff --git a/drivers/usb/host/ohci-sa1111.c b/drivers/usb/host/ohci-sa1111.c index d8eb3bdafabb..4204d9720d23 100644 --- a/drivers/usb/host/ohci-sa1111.c +++ b/drivers/usb/host/ohci-sa1111.c | |||
@@ -131,7 +131,7 @@ int usb_hcd_sa1111_probe (const struct hc_driver *driver, | |||
131 | if (!hcd) | 131 | if (!hcd) |
132 | return -ENOMEM; | 132 | return -ENOMEM; |
133 | hcd->rsrc_start = dev->res.start; | 133 | hcd->rsrc_start = dev->res.start; |
134 | hcd->rsrc_len = dev->res.end - dev->res.start + 1; | 134 | hcd->rsrc_len = resource_size(&dev->res); |
135 | 135 | ||
136 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { | 136 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { |
137 | dbg("request_mem_region failed"); | 137 | dbg("request_mem_region failed"); |
diff --git a/drivers/usb/host/ohci-sm501.c b/drivers/usb/host/ohci-sm501.c index 041d30f30c10..78918ca0da23 100644 --- a/drivers/usb/host/ohci-sm501.c +++ b/drivers/usb/host/ohci-sm501.c | |||
@@ -103,8 +103,7 @@ static int ohci_hcd_sm501_drv_probe(struct platform_device *pdev) | |||
103 | goto err0; | 103 | goto err0; |
104 | } | 104 | } |
105 | 105 | ||
106 | if (!request_mem_region(mem->start, mem->end - mem->start + 1, | 106 | if (!request_mem_region(mem->start, resource_size(mem), pdev->name)) { |
107 | pdev->name)) { | ||
108 | dev_err(dev, "request_mem_region failed\n"); | 107 | dev_err(dev, "request_mem_region failed\n"); |
109 | retval = -EBUSY; | 108 | retval = -EBUSY; |
110 | goto err0; | 109 | goto err0; |
@@ -126,7 +125,7 @@ static int ohci_hcd_sm501_drv_probe(struct platform_device *pdev) | |||
126 | 125 | ||
127 | if (!dma_declare_coherent_memory(dev, mem->start, | 126 | if (!dma_declare_coherent_memory(dev, mem->start, |
128 | mem->start - mem->parent->start, | 127 | mem->start - mem->parent->start, |
129 | (mem->end - mem->start) + 1, | 128 | resource_size(mem), |
130 | DMA_MEMORY_MAP | | 129 | DMA_MEMORY_MAP | |
131 | DMA_MEMORY_EXCLUSIVE)) { | 130 | DMA_MEMORY_EXCLUSIVE)) { |
132 | dev_err(dev, "cannot declare coherent memory\n"); | 131 | dev_err(dev, "cannot declare coherent memory\n"); |
@@ -149,7 +148,7 @@ static int ohci_hcd_sm501_drv_probe(struct platform_device *pdev) | |||
149 | } | 148 | } |
150 | 149 | ||
151 | hcd->rsrc_start = res->start; | 150 | hcd->rsrc_start = res->start; |
152 | hcd->rsrc_len = res->end - res->start + 1; | 151 | hcd->rsrc_len = resource_size(res); |
153 | 152 | ||
154 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, pdev->name)) { | 153 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, pdev->name)) { |
155 | dev_err(dev, "request_mem_region failed\n"); | 154 | dev_err(dev, "request_mem_region failed\n"); |
@@ -185,7 +184,7 @@ err3: | |||
185 | err2: | 184 | err2: |
186 | dma_release_declared_memory(dev); | 185 | dma_release_declared_memory(dev); |
187 | err1: | 186 | err1: |
188 | release_mem_region(mem->start, mem->end - mem->start + 1); | 187 | release_mem_region(mem->start, resource_size(mem)); |
189 | err0: | 188 | err0: |
190 | return retval; | 189 | return retval; |
191 | } | 190 | } |
@@ -201,7 +200,7 @@ static int ohci_hcd_sm501_drv_remove(struct platform_device *pdev) | |||
201 | dma_release_declared_memory(&pdev->dev); | 200 | dma_release_declared_memory(&pdev->dev); |
202 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 1); | 201 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 1); |
203 | if (mem) | 202 | if (mem) |
204 | release_mem_region(mem->start, mem->end - mem->start + 1); | 203 | release_mem_region(mem->start, resource_size(mem)); |
205 | 204 | ||
206 | /* mask interrupts and disable power */ | 205 | /* mask interrupts and disable power */ |
207 | 206 | ||
diff --git a/drivers/usb/host/ohci-tmio.c b/drivers/usb/host/ohci-tmio.c index 3558491dd87d..57ad1271fc9b 100644 --- a/drivers/usb/host/ohci-tmio.c +++ b/drivers/usb/host/ohci-tmio.c | |||
@@ -208,13 +208,13 @@ static int __devinit ohci_hcd_tmio_drv_probe(struct platform_device *dev) | |||
208 | } | 208 | } |
209 | 209 | ||
210 | hcd->rsrc_start = regs->start; | 210 | hcd->rsrc_start = regs->start; |
211 | hcd->rsrc_len = regs->end - regs->start + 1; | 211 | hcd->rsrc_len = resource_size(regs); |
212 | 212 | ||
213 | tmio = hcd_to_tmio(hcd); | 213 | tmio = hcd_to_tmio(hcd); |
214 | 214 | ||
215 | spin_lock_init(&tmio->lock); | 215 | spin_lock_init(&tmio->lock); |
216 | 216 | ||
217 | tmio->ccr = ioremap(config->start, config->end - config->start + 1); | 217 | tmio->ccr = ioremap(config->start, resource_size(config)); |
218 | if (!tmio->ccr) { | 218 | if (!tmio->ccr) { |
219 | ret = -ENOMEM; | 219 | ret = -ENOMEM; |
220 | goto err_ioremap_ccr; | 220 | goto err_ioremap_ccr; |
@@ -228,7 +228,7 @@ static int __devinit ohci_hcd_tmio_drv_probe(struct platform_device *dev) | |||
228 | 228 | ||
229 | if (!dma_declare_coherent_memory(&dev->dev, sram->start, | 229 | if (!dma_declare_coherent_memory(&dev->dev, sram->start, |
230 | sram->start, | 230 | sram->start, |
231 | sram->end - sram->start + 1, | 231 | resource_size(sram), |
232 | DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE)) { | 232 | DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE)) { |
233 | ret = -EBUSY; | 233 | ret = -EBUSY; |
234 | goto err_dma_declare; | 234 | goto err_dma_declare; |
diff --git a/drivers/usb/host/oxu210hp-hcd.c b/drivers/usb/host/oxu210hp-hcd.c index 5fbe997dc6df..dcd889803f0f 100644 --- a/drivers/usb/host/oxu210hp-hcd.c +++ b/drivers/usb/host/oxu210hp-hcd.c | |||
@@ -3828,7 +3828,7 @@ static int oxu_drv_probe(struct platform_device *pdev) | |||
3828 | return -ENODEV; | 3828 | return -ENODEV; |
3829 | } | 3829 | } |
3830 | memstart = res->start; | 3830 | memstart = res->start; |
3831 | memlen = res->end - res->start + 1; | 3831 | memlen = resource_size(res); |
3832 | dev_dbg(&pdev->dev, "MEM resource %lx-%lx\n", memstart, memlen); | 3832 | dev_dbg(&pdev->dev, "MEM resource %lx-%lx\n", memstart, memlen); |
3833 | if (!request_mem_region(memstart, memlen, | 3833 | if (!request_mem_region(memstart, memlen, |
3834 | oxu_hc_driver.description)) { | 3834 | oxu_hc_driver.description)) { |
diff --git a/drivers/usb/host/uhci-grlib.c b/drivers/usb/host/uhci-grlib.c index d01c1e227681..f7a62138e3e0 100644 --- a/drivers/usb/host/uhci-grlib.c +++ b/drivers/usb/host/uhci-grlib.c | |||
@@ -111,7 +111,7 @@ static int __devinit uhci_hcd_grlib_probe(struct platform_device *op) | |||
111 | return -ENOMEM; | 111 | return -ENOMEM; |
112 | 112 | ||
113 | hcd->rsrc_start = res.start; | 113 | hcd->rsrc_start = res.start; |
114 | hcd->rsrc_len = res.end - res.start + 1; | 114 | hcd->rsrc_len = resource_size(&res); |
115 | 115 | ||
116 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { | 116 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { |
117 | printk(KERN_ERR "%s: request_mem_region failed\n", __FILE__); | 117 | printk(KERN_ERR "%s: request_mem_region failed\n", __FILE__); |
diff --git a/drivers/usb/host/whci/init.c b/drivers/usb/host/whci/init.c index f7582e8e2169..d3e13b640d4b 100644 --- a/drivers/usb/host/whci/init.c +++ b/drivers/usb/host/whci/init.c | |||
@@ -178,7 +178,7 @@ void whc_clean_up(struct whc *whc) | |||
178 | if (whc->qset_pool) | 178 | if (whc->qset_pool) |
179 | dma_pool_destroy(whc->qset_pool); | 179 | dma_pool_destroy(whc->qset_pool); |
180 | 180 | ||
181 | len = whc->umc->resource.end - whc->umc->resource.start + 1; | 181 | len = resource_size(&whc->umc->resource); |
182 | if (whc->base) | 182 | if (whc->base) |
183 | iounmap(whc->base); | 183 | iounmap(whc->base); |
184 | if (whc->base_phys) | 184 | if (whc->base_phys) |
diff --git a/drivers/uwb/whc-rc.c b/drivers/uwb/whc-rc.c index 70a004aa19db..3ae3c702500d 100644 --- a/drivers/uwb/whc-rc.c +++ b/drivers/uwb/whc-rc.c | |||
@@ -222,7 +222,7 @@ int whcrc_setup_rc_umc(struct whcrc *whcrc) | |||
222 | struct umc_dev *umc_dev = whcrc->umc_dev; | 222 | struct umc_dev *umc_dev = whcrc->umc_dev; |
223 | 223 | ||
224 | whcrc->area = umc_dev->resource.start; | 224 | whcrc->area = umc_dev->resource.start; |
225 | whcrc->rc_len = umc_dev->resource.end - umc_dev->resource.start + 1; | 225 | whcrc->rc_len = resource_size(&umc_dev->resource); |
226 | result = -EBUSY; | 226 | result = -EBUSY; |
227 | if (request_mem_region(whcrc->area, whcrc->rc_len, KBUILD_MODNAME) == NULL) { | 227 | if (request_mem_region(whcrc->area, whcrc->rc_len, KBUILD_MODNAME) == NULL) { |
228 | dev_err(dev, "can't request URC region (%zu bytes @ 0x%lx): %d\n", | 228 | dev_err(dev, "can't request URC region (%zu bytes @ 0x%lx): %d\n", |
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c index 4484c721f0f9..817ab60f7537 100644 --- a/drivers/video/atmel_lcdfb.c +++ b/drivers/video/atmel_lcdfb.c | |||
@@ -906,7 +906,7 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev) | |||
906 | if (map) { | 906 | if (map) { |
907 | /* use a pre-allocated memory buffer */ | 907 | /* use a pre-allocated memory buffer */ |
908 | info->fix.smem_start = map->start; | 908 | info->fix.smem_start = map->start; |
909 | info->fix.smem_len = map->end - map->start + 1; | 909 | info->fix.smem_len = resource_size(map); |
910 | if (!request_mem_region(info->fix.smem_start, | 910 | if (!request_mem_region(info->fix.smem_start, |
911 | info->fix.smem_len, pdev->name)) { | 911 | info->fix.smem_len, pdev->name)) { |
912 | ret = -EBUSY; | 912 | ret = -EBUSY; |
@@ -932,7 +932,7 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev) | |||
932 | 932 | ||
933 | /* LCDC registers */ | 933 | /* LCDC registers */ |
934 | info->fix.mmio_start = regs->start; | 934 | info->fix.mmio_start = regs->start; |
935 | info->fix.mmio_len = regs->end - regs->start + 1; | 935 | info->fix.mmio_len = resource_size(regs); |
936 | 936 | ||
937 | if (!request_mem_region(info->fix.mmio_start, | 937 | if (!request_mem_region(info->fix.mmio_start, |
938 | info->fix.mmio_len, pdev->name)) { | 938 | info->fix.mmio_len, pdev->name)) { |
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c index ebb893c49e90..ad41f508b423 100644 --- a/drivers/video/aty/atyfb_base.c +++ b/drivers/video/aty/atyfb_base.c | |||
@@ -3460,9 +3460,10 @@ static int __devinit atyfb_setup_generic(struct pci_dev *pdev, | |||
3460 | 3460 | ||
3461 | raddr = addr + 0x7ff000UL; | 3461 | raddr = addr + 0x7ff000UL; |
3462 | rrp = &pdev->resource[2]; | 3462 | rrp = &pdev->resource[2]; |
3463 | if ((rrp->flags & IORESOURCE_MEM) && request_mem_region(rrp->start, rrp->end - rrp->start + 1, "atyfb")) { | 3463 | if ((rrp->flags & IORESOURCE_MEM) && |
3464 | request_mem_region(rrp->start, resource_size(rrp), "atyfb")) { | ||
3464 | par->aux_start = rrp->start; | 3465 | par->aux_start = rrp->start; |
3465 | par->aux_size = rrp->end - rrp->start + 1; | 3466 | par->aux_size = resource_size(rrp); |
3466 | raddr = rrp->start; | 3467 | raddr = rrp->start; |
3467 | PRINTKI("using auxiliary register aperture\n"); | 3468 | PRINTKI("using auxiliary register aperture\n"); |
3468 | } | 3469 | } |
@@ -3552,7 +3553,7 @@ static int __devinit atyfb_pci_probe(struct pci_dev *pdev, | |||
3552 | 3553 | ||
3553 | /* Reserve space */ | 3554 | /* Reserve space */ |
3554 | res_start = rp->start; | 3555 | res_start = rp->start; |
3555 | res_size = rp->end - rp->start + 1; | 3556 | res_size = resource_size(rp); |
3556 | if (!request_mem_region(res_start, res_size, "atyfb")) | 3557 | if (!request_mem_region(res_start, res_size, "atyfb")) |
3557 | return -EBUSY; | 3558 | return -EBUSY; |
3558 | 3559 | ||
diff --git a/drivers/video/au1100fb.c b/drivers/video/au1100fb.c index 34b2fc472fe8..01a8fde67f20 100644 --- a/drivers/video/au1100fb.c +++ b/drivers/video/au1100fb.c | |||
@@ -486,7 +486,7 @@ static int __devinit au1100fb_drv_probe(struct platform_device *dev) | |||
486 | } | 486 | } |
487 | 487 | ||
488 | au1100fb_fix.mmio_start = regs_res->start; | 488 | au1100fb_fix.mmio_start = regs_res->start; |
489 | au1100fb_fix.mmio_len = regs_res->end - regs_res->start + 1; | 489 | au1100fb_fix.mmio_len = resource_size(regs_res); |
490 | 490 | ||
491 | if (!request_mem_region(au1100fb_fix.mmio_start, au1100fb_fix.mmio_len, | 491 | if (!request_mem_region(au1100fb_fix.mmio_start, au1100fb_fix.mmio_len, |
492 | DRIVER_NAME)) { | 492 | DRIVER_NAME)) { |
diff --git a/drivers/video/cobalt_lcdfb.c b/drivers/video/cobalt_lcdfb.c index 42fe155aba0e..e02764319ff7 100644 --- a/drivers/video/cobalt_lcdfb.c +++ b/drivers/video/cobalt_lcdfb.c | |||
@@ -303,7 +303,7 @@ static int __devinit cobalt_lcdfb_probe(struct platform_device *dev) | |||
303 | return -EBUSY; | 303 | return -EBUSY; |
304 | } | 304 | } |
305 | 305 | ||
306 | info->screen_size = res->end - res->start + 1; | 306 | info->screen_size = resource_size(res); |
307 | info->screen_base = ioremap(res->start, info->screen_size); | 307 | info->screen_base = ioremap(res->start, info->screen_size); |
308 | info->fbops = &cobalt_lcd_fbops; | 308 | info->fbops = &cobalt_lcd_fbops; |
309 | info->fix = cobalt_lcdfb_fix; | 309 | info->fix = cobalt_lcdfb_fix; |
diff --git a/drivers/video/controlfb.c b/drivers/video/controlfb.c index c225dcce89e7..9075bea55879 100644 --- a/drivers/video/controlfb.c +++ b/drivers/video/controlfb.c | |||
@@ -709,11 +709,11 @@ static int __init control_of_init(struct device_node *dp) | |||
709 | 709 | ||
710 | /* Map in frame buffer and registers */ | 710 | /* Map in frame buffer and registers */ |
711 | p->fb_orig_base = fb_res.start; | 711 | p->fb_orig_base = fb_res.start; |
712 | p->fb_orig_size = fb_res.end - fb_res.start + 1; | 712 | p->fb_orig_size = resource_size(&fb_res); |
713 | /* use the big-endian aperture (??) */ | 713 | /* use the big-endian aperture (??) */ |
714 | p->frame_buffer_phys = fb_res.start + 0x800000; | 714 | p->frame_buffer_phys = fb_res.start + 0x800000; |
715 | p->control_regs_phys = reg_res.start; | 715 | p->control_regs_phys = reg_res.start; |
716 | p->control_regs_size = reg_res.end - reg_res.start + 1; | 716 | p->control_regs_size = resource_size(®_res); |
717 | 717 | ||
718 | if (!p->fb_orig_base || | 718 | if (!p->fb_orig_base || |
719 | !request_mem_region(p->fb_orig_base,p->fb_orig_size,"controlfb")) { | 719 | !request_mem_region(p->fb_orig_base,p->fb_orig_size,"controlfb")) { |
diff --git a/drivers/video/mb862xx/mb862xxfbdrv.c b/drivers/video/mb862xx/mb862xxfbdrv.c index f70bd63b0187..ee1de3e26dec 100644 --- a/drivers/video/mb862xx/mb862xxfbdrv.c +++ b/drivers/video/mb862xx/mb862xxfbdrv.c | |||
@@ -697,7 +697,7 @@ static int __devinit of_platform_mb862xx_probe(struct platform_device *ofdev) | |||
697 | goto fbrel; | 697 | goto fbrel; |
698 | } | 698 | } |
699 | 699 | ||
700 | res_size = 1 + res.end - res.start; | 700 | res_size = resource_size(&res); |
701 | par->res = request_mem_region(res.start, res_size, DRV_NAME); | 701 | par->res = request_mem_region(res.start, res_size, DRV_NAME); |
702 | if (par->res == NULL) { | 702 | if (par->res == NULL) { |
703 | dev_err(dev, "Cannot claim framebuffer/mmio\n"); | 703 | dev_err(dev, "Cannot claim framebuffer/mmio\n"); |
@@ -787,7 +787,7 @@ static int __devexit of_platform_mb862xx_remove(struct platform_device *ofdev) | |||
787 | { | 787 | { |
788 | struct fb_info *fbi = dev_get_drvdata(&ofdev->dev); | 788 | struct fb_info *fbi = dev_get_drvdata(&ofdev->dev); |
789 | struct mb862xxfb_par *par = fbi->par; | 789 | struct mb862xxfb_par *par = fbi->par; |
790 | resource_size_t res_size = 1 + par->res->end - par->res->start; | 790 | resource_size_t res_size = resource_size(par->res); |
791 | unsigned long reg; | 791 | unsigned long reg; |
792 | 792 | ||
793 | dev_dbg(fbi->dev, "%s release\n", fbi->fix.id); | 793 | dev_dbg(fbi->dev, "%s release\n", fbi->fix.id); |
diff --git a/drivers/video/msm/mdp.c b/drivers/video/msm/mdp.c index c3636d55a3c5..243d16f09b8a 100644 --- a/drivers/video/msm/mdp.c +++ b/drivers/video/msm/mdp.c | |||
@@ -406,8 +406,7 @@ int mdp_probe(struct platform_device *pdev) | |||
406 | goto error_get_irq; | 406 | goto error_get_irq; |
407 | } | 407 | } |
408 | 408 | ||
409 | mdp->base = ioremap(resource->start, | 409 | mdp->base = ioremap(resource->start, resource_size(resource)); |
410 | resource->end - resource->start); | ||
411 | if (mdp->base == 0) { | 410 | if (mdp->base == 0) { |
412 | printk(KERN_ERR "msmfb: cannot allocate mdp regs!\n"); | 411 | printk(KERN_ERR "msmfb: cannot allocate mdp regs!\n"); |
413 | ret = -ENOMEM; | 412 | ret = -ENOMEM; |
diff --git a/drivers/video/msm/msm_fb.c b/drivers/video/msm/msm_fb.c index ec351309e607..c6e3b4fcdd68 100644 --- a/drivers/video/msm/msm_fb.c +++ b/drivers/video/msm/msm_fb.c | |||
@@ -525,10 +525,9 @@ static int setup_fbmem(struct msmfb_info *msmfb, struct platform_device *pdev) | |||
525 | return -ENOMEM; | 525 | return -ENOMEM; |
526 | } | 526 | } |
527 | fb->fix.smem_start = resource->start; | 527 | fb->fix.smem_start = resource->start; |
528 | fb->fix.smem_len = resource->end - resource->start; | 528 | fb->fix.smem_len = resource_size(resource); |
529 | fbram = ioremap(resource->start, | 529 | fbram = ioremap(resource->start, resource_size(resource)); |
530 | resource->end - resource->start); | 530 | if (fbram == NULL) { |
531 | if (fbram == 0) { | ||
532 | printk(KERN_ERR "msmfb: cannot allocate fbram!\n"); | 531 | printk(KERN_ERR "msmfb: cannot allocate fbram!\n"); |
533 | return -ENOMEM; | 532 | return -ENOMEM; |
534 | } | 533 | } |
diff --git a/drivers/video/nuc900fb.c b/drivers/video/nuc900fb.c index f838d9e277f0..0fff59782e45 100644 --- a/drivers/video/nuc900fb.c +++ b/drivers/video/nuc900fb.c | |||
@@ -551,7 +551,7 @@ static int __devinit nuc900fb_probe(struct platform_device *pdev) | |||
551 | 551 | ||
552 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 552 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
553 | 553 | ||
554 | size = (res->end - res->start) + 1; | 554 | size = resource_size(res); |
555 | fbi->mem = request_mem_region(res->start, size, pdev->name); | 555 | fbi->mem = request_mem_region(res->start, size, pdev->name); |
556 | if (fbi->mem == NULL) { | 556 | if (fbi->mem == NULL) { |
557 | dev_err(&pdev->dev, "failed to alloc memory region\n"); | 557 | dev_err(&pdev->dev, "failed to alloc memory region\n"); |
diff --git a/drivers/video/platinumfb.c b/drivers/video/platinumfb.c index ef532d9d3c99..f27ae16ead2e 100644 --- a/drivers/video/platinumfb.c +++ b/drivers/video/platinumfb.c | |||
@@ -567,7 +567,7 @@ static int __devinit platinumfb_probe(struct platform_device* odev) | |||
567 | * northbridge and that can fail. Only request framebuffer | 567 | * northbridge and that can fail. Only request framebuffer |
568 | */ | 568 | */ |
569 | if (!request_mem_region(pinfo->rsrc_fb.start, | 569 | if (!request_mem_region(pinfo->rsrc_fb.start, |
570 | pinfo->rsrc_fb.end - pinfo->rsrc_fb.start + 1, | 570 | resource_size(&pinfo->rsrc_fb), |
571 | "platinumfb framebuffer")) { | 571 | "platinumfb framebuffer")) { |
572 | printk(KERN_ERR "platinumfb: Can't request framebuffer !\n"); | 572 | printk(KERN_ERR "platinumfb: Can't request framebuffer !\n"); |
573 | framebuffer_release(info); | 573 | framebuffer_release(info); |
@@ -658,8 +658,7 @@ static int __devexit platinumfb_remove(struct platform_device* odev) | |||
658 | iounmap(pinfo->cmap_regs); | 658 | iounmap(pinfo->cmap_regs); |
659 | 659 | ||
660 | release_mem_region(pinfo->rsrc_fb.start, | 660 | release_mem_region(pinfo->rsrc_fb.start, |
661 | pinfo->rsrc_fb.end - | 661 | resource_size(&pinfo->rsrc_fb)); |
662 | pinfo->rsrc_fb.start + 1); | ||
663 | 662 | ||
664 | release_mem_region(pinfo->cmap_regs_phys, 0x1000); | 663 | release_mem_region(pinfo->cmap_regs_phys, 0x1000); |
665 | 664 | ||
diff --git a/drivers/video/pxa168fb.c b/drivers/video/pxa168fb.c index bb95ec56d25d..18ead6f0184d 100644 --- a/drivers/video/pxa168fb.c +++ b/drivers/video/pxa168fb.c | |||
@@ -662,7 +662,7 @@ static int __devinit pxa168fb_probe(struct platform_device *pdev) | |||
662 | info->fix.ypanstep = 0; | 662 | info->fix.ypanstep = 0; |
663 | info->fix.ywrapstep = 0; | 663 | info->fix.ywrapstep = 0; |
664 | info->fix.mmio_start = res->start; | 664 | info->fix.mmio_start = res->start; |
665 | info->fix.mmio_len = res->end - res->start + 1; | 665 | info->fix.mmio_len = resource_size(res); |
666 | info->fix.accel = FB_ACCEL_NONE; | 666 | info->fix.accel = FB_ACCEL_NONE; |
667 | info->fbops = &pxa168fb_ops; | 667 | info->fbops = &pxa168fb_ops; |
668 | info->pseudo_palette = fbi->pseudo_palette; | 668 | info->pseudo_palette = fbi->pseudo_palette; |