aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2011-06-09 12:13:32 -0400
committerJiri Kosina <jkosina@suse.cz>2011-06-10 08:55:36 -0400
commit28f65c11f2ffb3957259dece647a24f8ad2e241b (patch)
tree6b7621d09d10df89eedd908d4506fb9f457a909f
parent140a1ef2f91a00e1d25f0878c193abdc25bf6ebe (diff)
treewide: Convert uses of struct resource to resource_size(ptr)
Several fixes as well where the +1 was missing. Done via coccinelle scripts like: @@ struct resource *ptr; @@ - ptr->end - ptr->start + 1 + resource_size(ptr) and some grep and typing. Mostly uncompiled, no cross-compilers. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r--arch/arm/common/scoop.c2
-rw-r--r--arch/arm/mach-at91/at91sam9261_devices.c2
-rw-r--r--arch/arm/mach-mv78xx0/pcie.c8
-rw-r--r--arch/arm/mach-u300/core.c2
-rw-r--r--arch/arm/plat-mxc/pwm.c8
-rw-r--r--arch/arm/plat-s5p/sysmmu.c6
-rw-r--r--arch/arm/plat-samsung/pm-check.c2
-rw-r--r--arch/avr32/kernel/setup.c10
-rw-r--r--arch/avr32/mach-at32ap/extint.c2
-rw-r--r--arch/avr32/mach-at32ap/hsmc.c2
-rw-r--r--arch/avr32/mach-at32ap/intc.c2
-rw-r--r--arch/avr32/mach-at32ap/pio.c2
-rw-r--r--arch/microblaze/pci/pci-common.c2
-rw-r--r--arch/mips/pci/pci-rc32434.c2
-rw-r--r--arch/mips/pci/pci-vr41xx.c2
-rw-r--r--arch/mips/powertv/asic/asic_devices.c10
-rw-r--r--arch/powerpc/include/asm/macio.h2
-rw-r--r--arch/powerpc/kernel/machine_kexec.c4
-rw-r--r--arch/powerpc/kernel/pci-common.c2
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_pci.c8
-rw-r--r--arch/powerpc/platforms/83xx/km83xx.c2
-rw-r--r--arch/powerpc/platforms/83xx/mpc832x_mds.c2
-rw-r--r--arch/powerpc/platforms/83xx/mpc834x_mds.c2
-rw-r--r--arch/powerpc/platforms/83xx/mpc836x_mds.c2
-rw-r--r--arch/powerpc/platforms/83xx/usb.c2
-rw-r--r--arch/powerpc/platforms/85xx/sbc8560.c2
-rw-r--r--arch/powerpc/platforms/85xx/xes_mpc85xx.c2
-rw-r--r--arch/powerpc/platforms/cell/celleb_scc_epci.c8
-rw-r--r--arch/powerpc/platforms/cell/celleb_scc_pciex.c2
-rw-r--r--arch/powerpc/platforms/cell/spu_manage.c2
-rw-r--r--arch/powerpc/platforms/chrp/pci.c2
-rw-r--r--arch/powerpc/platforms/pasemi/dma_lib.c2
-rw-r--r--arch/powerpc/platforms/powermac/nvram.c4
-rw-r--r--arch/powerpc/platforms/powermac/pci.c6
-rw-r--r--arch/powerpc/platforms/powermac/time.c2
-rw-r--r--arch/powerpc/sysdev/axonram.c2
-rw-r--r--arch/powerpc/sysdev/cpm1.c2
-rw-r--r--arch/powerpc/sysdev/cpm_common.c2
-rw-r--r--arch/powerpc/sysdev/dart_iommu.c2
-rw-r--r--arch/powerpc/sysdev/fsl_msi.c2
-rw-r--r--arch/powerpc/sysdev/fsl_pci.c12
-rw-r--r--arch/powerpc/sysdev/fsl_rio.c2
-rw-r--r--arch/powerpc/sysdev/ipic.c2
-rw-r--r--arch/powerpc/sysdev/mmio_nvram.c2
-rw-r--r--arch/powerpc/sysdev/mpc8xx_pic.c2
-rw-r--r--arch/powerpc/sysdev/mv64x60_udbg.c4
-rw-r--r--arch/powerpc/sysdev/ppc4xx_pci.c16
-rw-r--r--arch/powerpc/sysdev/qe_lib/qe_ic.c2
-rw-r--r--arch/powerpc/sysdev/qe_lib/qe_io.c2
-rw-r--r--arch/powerpc/sysdev/xics/icp-native.c2
-rw-r--r--arch/sh/kernel/io_trapped.c8
-rw-r--r--arch/sh/kernel/machine_kexec.c2
-rw-r--r--arch/sparc/kernel/ioport.c12
-rw-r--r--arch/sparc/kernel/pci.c6
-rw-r--r--arch/tile/kernel/setup.c3
-rw-r--r--arch/x86/kernel/pci-calgary_64.c2
-rw-r--r--arch/x86/kernel/probe_roms.c2
-rw-r--r--drivers/char/bsr.c2
-rw-r--r--drivers/char/xilinx_hwicap/xilinx_hwicap.c2
-rw-r--r--drivers/dma/mv_xor.c5
-rw-r--r--drivers/edac/cell_edac.c2
-rw-r--r--drivers/edac/mpc85xx_edac.c12
-rw-r--r--drivers/gpio/gpio-u300.c8
-rw-r--r--drivers/ide/palm_bk3710.c2
-rw-r--r--drivers/ide/tx4939ide.c4
-rw-r--r--drivers/input/serio/sa1111ps2.c6
-rw-r--r--drivers/media/video/davinci/vpif.c2
-rw-r--r--drivers/media/video/omap24xxcam.c5
-rw-r--r--drivers/message/i2o/iop.c8
-rw-r--r--drivers/mfd/tc6387xb.c2
-rw-r--r--drivers/misc/atmel-ssc.c2
-rw-r--r--drivers/misc/atmel_pwm.c2
-rw-r--r--drivers/mmc/host/dw_mmc.c2
-rw-r--r--drivers/mtd/maps/bfin-async-flash.c2
-rw-r--r--drivers/mtd/maps/ixp2000.c11
-rw-r--r--drivers/mtd/maps/pxa2xx-flash.c2
-rw-r--r--drivers/mtd/nand/atmel_nand.c4
-rw-r--r--drivers/mtd/nand/bcm_umi_nand.c2
-rw-r--r--drivers/mtd/nand/mpc5121_nfc.c2
-rw-r--r--drivers/net/bcm63xx_enet.c8
-rw-r--r--drivers/net/can/softing/softing_main.c2
-rw-r--r--drivers/net/davinci_emac.c6
-rw-r--r--drivers/net/ethoc.c2
-rw-r--r--drivers/net/fec_mpc52xx.c7
-rw-r--r--drivers/net/fs_enet/mii-bitbang.c4
-rw-r--r--drivers/net/fs_enet/mii-fec.c2
-rw-r--r--drivers/net/gianfar_ptp.c2
-rw-r--r--drivers/net/ibm_newemac/core.c2
-rw-r--r--drivers/net/macb.c2
-rw-r--r--drivers/net/mv643xx_eth.c2
-rw-r--r--drivers/net/pxa168_eth.c2
-rw-r--r--drivers/net/sb1250-mac.c2
-rw-r--r--drivers/parport/parport_ax88796.c2
-rw-r--r--drivers/pci/hotplug/shpchp_sysfs.c21
-rw-r--r--drivers/pcmcia/at91_cf.c7
-rw-r--r--drivers/pcmcia/electra_cf.c4
-rw-r--r--drivers/pcmcia/rsrc_iodyn.c6
-rw-r--r--drivers/pcmcia/rsrc_nonstatic.c6
-rw-r--r--drivers/pnp/pnpacpi/rsparser.c10
-rw-r--r--drivers/pnp/pnpbios/rsparser.c12
-rw-r--r--drivers/rtc/rtc-at32ap700x.c2
-rw-r--r--drivers/rtc/rtc-cmos.c6
-rw-r--r--drivers/rtc/rtc-ds1286.c2
-rw-r--r--drivers/rtc/rtc-ds1511.c2
-rw-r--r--drivers/rtc/rtc-ds1742.c2
-rw-r--r--drivers/rtc/rtc-m48t35.c2
-rw-r--r--drivers/rtc/rtc-m48t59.c2
-rw-r--r--drivers/rtc/rtc-mrst.c5
-rw-r--r--drivers/rtc/rtc-puv3.c5
-rw-r--r--drivers/rtc/rtc-s3c.c5
-rw-r--r--drivers/staging/generic_serial/ser_a2232.c3
-rw-r--r--drivers/staging/gma500/psb_gtt.c8
-rw-r--r--drivers/tty/serial/bfin_5xx.c5
-rw-r--r--drivers/tty/serial/imx.c5
-rw-r--r--drivers/tty/serial/m32r_sio.c2
-rw-r--r--drivers/tty/serial/omap-serial.c6
-rw-r--r--drivers/tty/serial/pxa.c2
-rw-r--r--drivers/tty/serial/sunsu.c2
-rw-r--r--drivers/tty/serial/vt8500_serial.c3
-rw-r--r--drivers/uio/uio_pdrv.c2
-rw-r--r--drivers/uio/uio_pdrv_genirq.c2
-rw-r--r--drivers/usb/gadget/atmel_usba_udc.c2
-rw-r--r--drivers/usb/gadget/fsl_udc_core.c6
-rw-r--r--drivers/usb/host/ehci-ath79.c2
-rw-r--r--drivers/usb/host/ehci-cns3xxx.c2
-rw-r--r--drivers/usb/host/ehci-fsl.c2
-rw-r--r--drivers/usb/host/ehci-grlib.c2
-rw-r--r--drivers/usb/host/ehci-ixp4xx.c2
-rw-r--r--drivers/usb/host/ehci-octeon.c2
-rw-r--r--drivers/usb/host/ehci-pmcmsp.c10
-rw-r--r--drivers/usb/host/ehci-ppc-of.c2
-rw-r--r--drivers/usb/host/ehci-w90x900.c2
-rw-r--r--drivers/usb/host/ehci-xilinx-of.c2
-rw-r--r--drivers/usb/host/fhci-hcd.c2
-rw-r--r--drivers/usb/host/ohci-ath79.c4
-rw-r--r--drivers/usb/host/ohci-cns3xxx.c2
-rw-r--r--drivers/usb/host/ohci-da8xx.c2
-rw-r--r--drivers/usb/host/ohci-octeon.c2
-rw-r--r--drivers/usb/host/ohci-ppc-of.c2
-rw-r--r--drivers/usb/host/ohci-ppc-soc.c2
-rw-r--r--drivers/usb/host/ohci-sa1111.c2
-rw-r--r--drivers/usb/host/ohci-sm501.c11
-rw-r--r--drivers/usb/host/ohci-tmio.c6
-rw-r--r--drivers/usb/host/oxu210hp-hcd.c2
-rw-r--r--drivers/usb/host/uhci-grlib.c2
-rw-r--r--drivers/usb/host/whci/init.c2
-rw-r--r--drivers/uwb/whc-rc.c2
-rw-r--r--drivers/video/atmel_lcdfb.c4
-rw-r--r--drivers/video/aty/atyfb_base.c7
-rw-r--r--drivers/video/au1100fb.c2
-rw-r--r--drivers/video/cobalt_lcdfb.c2
-rw-r--r--drivers/video/controlfb.c4
-rw-r--r--drivers/video/mb862xx/mb862xxfbdrv.c4
-rw-r--r--drivers/video/msm/mdp.c3
-rw-r--r--drivers/video/msm/msm_fb.c7
-rw-r--r--drivers/video/nuc900fb.c2
-rw-r--r--drivers/video/platinumfb.c5
-rw-r--r--drivers/video/pxa168fb.c2
-rw-r--r--include/linux/dio.h2
-rw-r--r--include/linux/pnp.h2
-rw-r--r--include/linux/zorro.h2
-rw-r--r--kernel/kexec.c2
-rw-r--r--sound/aoa/soundbus/i2sbus/core.c9
-rw-r--r--sound/atmel/abdac.c2
-rw-r--r--sound/atmel/ac97c.c2
-rw-r--r--sound/ppc/pmac.c9
-rw-r--r--sound/soc/fsl/fsl_ssi.c2
-rw-r--r--sound/soc/fsl/mpc5200_dma.c2
168 files changed, 308 insertions, 333 deletions
diff --git a/arch/arm/common/scoop.c b/arch/arm/common/scoop.c
index c11af1e4bad3..a07b0e763a80 100644
--- a/arch/arm/common/scoop.c
+++ b/arch/arm/common/scoop.c
@@ -193,7 +193,7 @@ static int __devinit scoop_probe(struct platform_device *pdev)
193 spin_lock_init(&devptr->scoop_lock); 193 spin_lock_init(&devptr->scoop_lock);
194 194
195 inf = pdev->dev.platform_data; 195 inf = pdev->dev.platform_data;
196 devptr->base = ioremap(mem->start, mem->end - mem->start + 1); 196 devptr->base = ioremap(mem->start, resource_size(mem));
197 197
198 if (!devptr->base) { 198 if (!devptr->base) {
199 ret = -ENOMEM; 199 ret = -ENOMEM;
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c
index 3eb4538fceeb..14dd666850b0 100644
--- a/arch/arm/mach-at91/at91sam9261_devices.c
+++ b/arch/arm/mach-at91/at91sam9261_devices.c
@@ -525,7 +525,7 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data)
525 if (ARRAY_SIZE(lcdc_resources) > 2) { 525 if (ARRAY_SIZE(lcdc_resources) > 2) {
526 void __iomem *fb; 526 void __iomem *fb;
527 struct resource *fb_res = &lcdc_resources[2]; 527 struct resource *fb_res = &lcdc_resources[2];
528 size_t fb_len = fb_res->end - fb_res->start + 1; 528 size_t fb_len = resource_size(fb_res);
529 529
530 fb = ioremap(fb_res->start, fb_len); 530 fb = ioremap(fb_res->start, fb_len);
531 if (fb) { 531 if (fb) {
diff --git a/arch/arm/mach-mv78xx0/pcie.c b/arch/arm/mach-mv78xx0/pcie.c
index a560439dcc3c..f27c7d2fa9f7 100644
--- a/arch/arm/mach-mv78xx0/pcie.c
+++ b/arch/arm/mach-mv78xx0/pcie.c
@@ -129,12 +129,12 @@ static void __init mv78xx0_pcie_preinit(void)
129 struct pcie_port *pp = pcie_port + i; 129 struct pcie_port *pp = pcie_port + i;
130 130
131 mv78xx0_setup_pcie_io_win(win++, pp->res[0].start, 131 mv78xx0_setup_pcie_io_win(win++, pp->res[0].start,
132 pp->res[0].end - pp->res[0].start + 1, 132 resource_size(&pp->res[0]),
133 pp->maj, pp->min); 133 pp->maj, pp->min);
134 134
135 mv78xx0_setup_pcie_mem_win(win++, pp->res[1].start, 135 mv78xx0_setup_pcie_mem_win(win++, pp->res[1].start,
136 pp->res[1].end - pp->res[1].start + 1, 136 resource_size(&pp->res[1]),
137 pp->maj, pp->min); 137 pp->maj, pp->min);
138 } 138 }
139} 139}
140 140
diff --git a/arch/arm/mach-u300/core.c b/arch/arm/mach-u300/core.c
index 513d6abec1f5..399c89f14dfb 100644
--- a/arch/arm/mach-u300/core.c
+++ b/arch/arm/mach-u300/core.c
@@ -1791,7 +1791,7 @@ static void __init u300_assign_physmem(void)
1791 0 == res->start) { 1791 0 == res->start) {
1792 res->start = curr_start; 1792 res->start = curr_start;
1793 res->end += curr_start; 1793 res->end += curr_start;
1794 curr_start += (res->end - res->start + 1); 1794 curr_start += resource_size(res);
1795 1795
1796 printk(KERN_INFO "core.c: Mapping RAM " \ 1796 printk(KERN_INFO "core.c: Mapping RAM " \
1797 "%#x-%#x to device %s:%s\n", 1797 "%#x-%#x to device %s:%s\n",
diff --git a/arch/arm/plat-mxc/pwm.c b/arch/arm/plat-mxc/pwm.c
index 7a61ef8f471a..761c3c940a68 100644
--- a/arch/arm/plat-mxc/pwm.c
+++ b/arch/arm/plat-mxc/pwm.c
@@ -214,14 +214,14 @@ static int __devinit mxc_pwm_probe(struct platform_device *pdev)
214 goto err_free_clk; 214 goto err_free_clk;
215 } 215 }
216 216
217 r = request_mem_region(r->start, r->end - r->start + 1, pdev->name); 217 r = request_mem_region(r->start, resource_size(r), pdev->name);
218 if (r == NULL) { 218 if (r == NULL) {
219 dev_err(&pdev->dev, "failed to request memory resource\n"); 219 dev_err(&pdev->dev, "failed to request memory resource\n");
220 ret = -EBUSY; 220 ret = -EBUSY;
221 goto err_free_clk; 221 goto err_free_clk;
222 } 222 }
223 223
224 pwm->mmio_base = ioremap(r->start, r->end - r->start + 1); 224 pwm->mmio_base = ioremap(r->start, resource_size(r));
225 if (pwm->mmio_base == NULL) { 225 if (pwm->mmio_base == NULL) {
226 dev_err(&pdev->dev, "failed to ioremap() registers\n"); 226 dev_err(&pdev->dev, "failed to ioremap() registers\n");
227 ret = -ENODEV; 227 ret = -ENODEV;
@@ -236,7 +236,7 @@ static int __devinit mxc_pwm_probe(struct platform_device *pdev)
236 return 0; 236 return 0;
237 237
238err_free_mem: 238err_free_mem:
239 release_mem_region(r->start, r->end - r->start + 1); 239 release_mem_region(r->start, resource_size(r));
240err_free_clk: 240err_free_clk:
241 clk_put(pwm->clk); 241 clk_put(pwm->clk);
242err_free: 242err_free:
@@ -260,7 +260,7 @@ static int __devexit mxc_pwm_remove(struct platform_device *pdev)
260 iounmap(pwm->mmio_base); 260 iounmap(pwm->mmio_base);
261 261
262 r = platform_get_resource(pdev, IORESOURCE_MEM, 0); 262 r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
263 release_mem_region(r->start, r->end - r->start + 1); 263 release_mem_region(r->start, resource_size(r));
264 264
265 clk_put(pwm->clk); 265 clk_put(pwm->clk);
266 266
diff --git a/arch/arm/plat-s5p/sysmmu.c b/arch/arm/plat-s5p/sysmmu.c
index 54f5eddc921d..e1cbc728c775 100644
--- a/arch/arm/plat-s5p/sysmmu.c
+++ b/arch/arm/plat-s5p/sysmmu.c
@@ -232,8 +232,8 @@ static int s5p_sysmmu_probe(struct platform_device *pdev)
232 goto err_res; 232 goto err_res;
233 } 233 }
234 234
235 mem = request_mem_region(res->start, 235 mem = request_mem_region(res->start, resource_size(res),
236 ((res->end) - (res->start)) + 1, pdev->name); 236 pdev->name);
237 if (!mem) { 237 if (!mem) {
238 dev_err(dev, "Failed to request the memory region of %s.\n", 238 dev_err(dev, "Failed to request the memory region of %s.\n",
239 sysmmu_ips_name[i]); 239 sysmmu_ips_name[i]);
@@ -241,7 +241,7 @@ static int s5p_sysmmu_probe(struct platform_device *pdev)
241 goto err_res; 241 goto err_res;
242 } 242 }
243 243
244 sysmmusfrs[i] = ioremap(res->start, res->end - res->start + 1); 244 sysmmusfrs[i] = ioremap(res->start, resource_size(res));
245 if (!sysmmusfrs[i]) { 245 if (!sysmmusfrs[i]) {
246 dev_err(dev, "Failed to ioremap() for %s.\n", 246 dev_err(dev, "Failed to ioremap() for %s.\n",
247 sysmmu_ips_name[i]); 247 sysmmu_ips_name[i]);
diff --git a/arch/arm/plat-samsung/pm-check.c b/arch/arm/plat-samsung/pm-check.c
index 6b733fafe7cd..3cbd62666b1e 100644
--- a/arch/arm/plat-samsung/pm-check.c
+++ b/arch/arm/plat-samsung/pm-check.c
@@ -72,7 +72,7 @@ static void s3c_pm_run_sysram(run_fn_t fn, u32 *arg)
72 72
73static u32 *s3c_pm_countram(struct resource *res, u32 *val) 73static u32 *s3c_pm_countram(struct resource *res, u32 *val)
74{ 74{
75 u32 size = (u32)(res->end - res->start)+1; 75 u32 size = (u32)resource_size(res);
76 76
77 size += CHECK_CHUNKSIZE-1; 77 size += CHECK_CHUNKSIZE-1;
78 size /= CHECK_CHUNKSIZE; 78 size /= CHECK_CHUNKSIZE;
diff --git a/arch/avr32/kernel/setup.c b/arch/avr32/kernel/setup.c
index bb0974cce4ac..b4247f478065 100644
--- a/arch/avr32/kernel/setup.c
+++ b/arch/avr32/kernel/setup.c
@@ -444,7 +444,7 @@ static unsigned long __init
444find_bootmap_pfn(const struct resource *mem) 444find_bootmap_pfn(const struct resource *mem)
445{ 445{
446 unsigned long bootmap_pages, bootmap_len; 446 unsigned long bootmap_pages, bootmap_len;
447 unsigned long node_pages = PFN_UP(mem->end - mem->start + 1); 447 unsigned long node_pages = PFN_UP(resource_size(mem));
448 unsigned long bootmap_start; 448 unsigned long bootmap_start;
449 449
450 bootmap_pages = bootmem_bootmap_pages(node_pages); 450 bootmap_pages = bootmem_bootmap_pages(node_pages);
@@ -541,10 +541,10 @@ static void __init setup_bootmem(void)
541 */ 541 */
542 if (res->start >= PFN_PHYS(first_pfn) 542 if (res->start >= PFN_PHYS(first_pfn)
543 && res->end < PFN_PHYS(max_pfn)) 543 && res->end < PFN_PHYS(max_pfn))
544 reserve_bootmem_node( 544 reserve_bootmem_node(NODE_DATA(node),
545 NODE_DATA(node), res->start, 545 res->start,
546 res->end - res->start + 1, 546 resource_size(res),
547 BOOTMEM_DEFAULT); 547 BOOTMEM_DEFAULT);
548 } 548 }
549 549
550 node_set_online(node); 550 node_set_online(node);
diff --git a/arch/avr32/mach-at32ap/extint.c b/arch/avr32/mach-at32ap/extint.c
index fbc2aeaebddb..cfb298d66305 100644
--- a/arch/avr32/mach-at32ap/extint.c
+++ b/arch/avr32/mach-at32ap/extint.c
@@ -204,7 +204,7 @@ static int __init eic_probe(struct platform_device *pdev)
204 } 204 }
205 205
206 eic->first_irq = EIM_IRQ_BASE + 32 * pdev->id; 206 eic->first_irq = EIM_IRQ_BASE + 32 * pdev->id;
207 eic->regs = ioremap(regs->start, regs->end - regs->start + 1); 207 eic->regs = ioremap(regs->start, resource_size(regs));
208 if (!eic->regs) { 208 if (!eic->regs) {
209 dev_dbg(&pdev->dev, "failed to map regs\n"); 209 dev_dbg(&pdev->dev, "failed to map regs\n");
210 goto err_ioremap; 210 goto err_ioremap;
diff --git a/arch/avr32/mach-at32ap/hsmc.c b/arch/avr32/mach-at32ap/hsmc.c
index f7672d3e86b8..f66245e6e63e 100644
--- a/arch/avr32/mach-at32ap/hsmc.c
+++ b/arch/avr32/mach-at32ap/hsmc.c
@@ -245,7 +245,7 @@ static int hsmc_probe(struct platform_device *pdev)
245 245
246 hsmc->pclk = pclk; 246 hsmc->pclk = pclk;
247 hsmc->mck = mck; 247 hsmc->mck = mck;
248 hsmc->regs = ioremap(regs->start, regs->end - regs->start + 1); 248 hsmc->regs = ioremap(regs->start, resource_size(regs));
249 if (!hsmc->regs) 249 if (!hsmc->regs)
250 goto out_disable_clocks; 250 goto out_disable_clocks;
251 251
diff --git a/arch/avr32/mach-at32ap/intc.c b/arch/avr32/mach-at32ap/intc.c
index 3e3646186c9f..6c700431e34a 100644
--- a/arch/avr32/mach-at32ap/intc.c
+++ b/arch/avr32/mach-at32ap/intc.c
@@ -107,7 +107,7 @@ void __init init_IRQ(void)
107 107
108 clk_enable(pclk); 108 clk_enable(pclk);
109 109
110 intc0.regs = ioremap(regs->start, regs->end - regs->start + 1); 110 intc0.regs = ioremap(regs->start, resource_size(regs));
111 if (!intc0.regs) { 111 if (!intc0.regs) {
112 printk(KERN_EMERG "intc: failed to map registers (0x%08lx)\n", 112 printk(KERN_EMERG "intc: failed to map registers (0x%08lx)\n",
113 (unsigned long)regs->start); 113 (unsigned long)regs->start);
diff --git a/arch/avr32/mach-at32ap/pio.c b/arch/avr32/mach-at32ap/pio.c
index 2e0aa853a4bc..9b39dea6682f 100644
--- a/arch/avr32/mach-at32ap/pio.c
+++ b/arch/avr32/mach-at32ap/pio.c
@@ -461,7 +461,7 @@ void __init at32_init_pio(struct platform_device *pdev)
461 clk_enable(pio->clk); 461 clk_enable(pio->clk);
462 462
463 pio->pdev = pdev; 463 pio->pdev = pdev;
464 pio->regs = ioremap(regs->start, regs->end - regs->start + 1); 464 pio->regs = ioremap(regs->start, resource_size(regs));
465 465
466 /* start with irqs disabled and acked */ 466 /* start with irqs disabled and acked */
467 pio_writel(pio, IDR, ~0UL); 467 pio_writel(pio, IDR, ~0UL);
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c
index 53599067d2f9..dd3fae06ece4 100644
--- a/arch/microblaze/pci/pci-common.c
+++ b/arch/microblaze/pci/pci-common.c
@@ -89,7 +89,7 @@ void pcibios_free_controller(struct pci_controller *phb)
89 89
90static resource_size_t pcibios_io_size(const struct pci_controller *hose) 90static resource_size_t pcibios_io_size(const struct pci_controller *hose)
91{ 91{
92 return hose->io_resource.end - hose->io_resource.start + 1; 92 return resource_size(&hose->io_resource);
93} 93}
94 94
95int pcibios_vaddr_is_ioport(void __iomem *address) 95int pcibios_vaddr_is_ioport(void __iomem *address)
diff --git a/arch/mips/pci/pci-rc32434.c b/arch/mips/pci/pci-rc32434.c
index f31218e17d3c..764362ce5e40 100644
--- a/arch/mips/pci/pci-rc32434.c
+++ b/arch/mips/pci/pci-rc32434.c
@@ -215,7 +215,7 @@ static int __init rc32434_pci_init(void)
215 rc32434_pcibridge_init(); 215 rc32434_pcibridge_init();
216 216
217 io_map_base = ioremap(rc32434_res_pci_io1.start, 217 io_map_base = ioremap(rc32434_res_pci_io1.start,
218 rc32434_res_pci_io1.end - rc32434_res_pci_io1.start + 1); 218 resource_size(&rcrc32434_res_pci_io1));
219 219
220 if (!io_map_base) 220 if (!io_map_base)
221 return -ENOMEM; 221 return -ENOMEM;
diff --git a/arch/mips/pci/pci-vr41xx.c b/arch/mips/pci/pci-vr41xx.c
index 56525711f8b7..444b8d8004ad 100644
--- a/arch/mips/pci/pci-vr41xx.c
+++ b/arch/mips/pci/pci-vr41xx.c
@@ -305,7 +305,7 @@ static int __init vr41xx_pciu_init(void)
305 struct resource *res = vr41xx_pci_controller.io_resource; 305 struct resource *res = vr41xx_pci_controller.io_resource;
306 master = setup->master_io; 306 master = setup->master_io;
307 io_map_base = ioremap(master->bus_base_address, 307 io_map_base = ioremap(master->bus_base_address,
308 res->end - res->start + 1); 308 resource_size(res));
309 if (!io_map_base) 309 if (!io_map_base)
310 return -EBUSY; 310 return -EBUSY;
311 311
diff --git a/arch/mips/powertv/asic/asic_devices.c b/arch/mips/powertv/asic/asic_devices.c
index e56fa61b3991..bce1872249ba 100644
--- a/arch/mips/powertv/asic/asic_devices.c
+++ b/arch/mips/powertv/asic/asic_devices.c
@@ -394,23 +394,21 @@ void __init platform_alloc_bootmem(void)
394 394
395 /* Loop through looking for resources that want a particular address */ 395 /* Loop through looking for resources that want a particular address */
396 for (i = 0; gp_resources[i].flags != 0; i++) { 396 for (i = 0; gp_resources[i].flags != 0; i++) {
397 int size = gp_resources[i].end - gp_resources[i].start + 1; 397 int size = resource_size(&gp_resources[i]);
398 if ((gp_resources[i].start != 0) && 398 if ((gp_resources[i].start != 0) &&
399 ((gp_resources[i].flags & IORESOURCE_MEM) != 0)) { 399 ((gp_resources[i].flags & IORESOURCE_MEM) != 0)) {
400 reserve_bootmem(dma_to_phys(gp_resources[i].start), 400 reserve_bootmem(dma_to_phys(gp_resources[i].start),
401 size, 0); 401 size, 0);
402 total += gp_resources[i].end - 402 total += resource_size(&gp_resources[i]);
403 gp_resources[i].start + 1;
404 pr_info("reserve resource %s at %08x (%u bytes)\n", 403 pr_info("reserve resource %s at %08x (%u bytes)\n",
405 gp_resources[i].name, gp_resources[i].start, 404 gp_resources[i].name, gp_resources[i].start,
406 gp_resources[i].end - 405 resource_size(&gp_resources[i]));
407 gp_resources[i].start + 1);
408 } 406 }
409 } 407 }
410 408
411 /* Loop through assigning addresses for those that are left */ 409 /* Loop through assigning addresses for those that are left */
412 for (i = 0; gp_resources[i].flags != 0; i++) { 410 for (i = 0; gp_resources[i].flags != 0; i++) {
413 int size = gp_resources[i].end - gp_resources[i].start + 1; 411 int size = resource_size(&gp_resources[i]);
414 if ((gp_resources[i].start == 0) && 412 if ((gp_resources[i].start == 0) &&
415 ((gp_resources[i].flags & IORESOURCE_MEM) != 0)) { 413 ((gp_resources[i].flags & IORESOURCE_MEM) != 0)) {
416 void *mem = alloc_bootmem_pages(size); 414 void *mem = alloc_bootmem_pages(size);
diff --git a/arch/powerpc/include/asm/macio.h b/arch/powerpc/include/asm/macio.h
index 7ab82c825a03..27af7f8bbb8d 100644
--- a/arch/powerpc/include/asm/macio.h
+++ b/arch/powerpc/include/asm/macio.h
@@ -76,7 +76,7 @@ static inline unsigned long macio_resource_len(struct macio_dev *dev, int resour
76 struct resource *res = &dev->resource[resource_no]; 76 struct resource *res = &dev->resource[resource_no];
77 if (res->start == 0 || res->end == 0 || res->end < res->start) 77 if (res->start == 0 || res->end == 0 || res->end < res->start)
78 return 0; 78 return 0;
79 return res->end - res->start + 1; 79 return resource_size(res);
80} 80}
81 81
82extern int macio_enable_devres(struct macio_dev *dev); 82extern int macio_enable_devres(struct macio_dev *dev);
diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c
index 7ee50f0547cb..6658a1589955 100644
--- a/arch/powerpc/kernel/machine_kexec.c
+++ b/arch/powerpc/kernel/machine_kexec.c
@@ -126,7 +126,7 @@ void __init reserve_crashkernel(void)
126 /* We might have got these values via the command line or the 126 /* We might have got these values via the command line or the
127 * device tree, either way sanitise them now. */ 127 * device tree, either way sanitise them now. */
128 128
129 crash_size = crashk_res.end - crashk_res.start + 1; 129 crash_size = resource_size(&crashk_res);
130 130
131#ifndef CONFIG_RELOCATABLE 131#ifndef CONFIG_RELOCATABLE
132 if (crashk_res.start != KDUMP_KERNELBASE) 132 if (crashk_res.start != KDUMP_KERNELBASE)
@@ -222,7 +222,7 @@ static void __init export_crashk_values(struct device_node *node)
222 222
223 if (crashk_res.start != 0) { 223 if (crashk_res.start != 0) {
224 prom_add_property(node, &crashk_base_prop); 224 prom_add_property(node, &crashk_base_prop);
225 crashk_size = crashk_res.end - crashk_res.start + 1; 225 crashk_size = resource_size(&crashk_res);
226 prom_add_property(node, &crashk_size_prop); 226 prom_add_property(node, &crashk_size_prop);
227 } 227 }
228} 228}
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 893af2a9cd03..3764e37205fb 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -107,7 +107,7 @@ static resource_size_t pcibios_io_size(const struct pci_controller *hose)
107#ifdef CONFIG_PPC64 107#ifdef CONFIG_PPC64
108 return hose->pci_io_size; 108 return hose->pci_io_size;
109#else 109#else
110 return hose->io_resource.end - hose->io_resource.start + 1; 110 return resource_size(&hose->io_resource);
111#endif 111#endif
112} 112}
113 113
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_pci.c b/arch/powerpc/platforms/52xx/mpc52xx_pci.c
index da110bd88346..5f5e69309080 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_pci.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_pci.c
@@ -264,7 +264,7 @@ mpc52xx_pci_setup(struct pci_controller *hose,
264 (unsigned long long)res->flags); 264 (unsigned long long)res->flags);
265 out_be32(&pci_regs->iw0btar, 265 out_be32(&pci_regs->iw0btar,
266 MPC52xx_PCI_IWBTAR_TRANSLATION(res->start, res->start, 266 MPC52xx_PCI_IWBTAR_TRANSLATION(res->start, res->start,
267 res->end - res->start + 1)); 267 resource_size(res)));
268 iwcr0 = MPC52xx_PCI_IWCR_ENABLE | MPC52xx_PCI_IWCR_MEM; 268 iwcr0 = MPC52xx_PCI_IWCR_ENABLE | MPC52xx_PCI_IWCR_MEM;
269 if (res->flags & IORESOURCE_PREFETCH) 269 if (res->flags & IORESOURCE_PREFETCH)
270 iwcr0 |= MPC52xx_PCI_IWCR_READ_MULTI; 270 iwcr0 |= MPC52xx_PCI_IWCR_READ_MULTI;
@@ -278,7 +278,7 @@ mpc52xx_pci_setup(struct pci_controller *hose,
278 res->start, res->end, res->flags); 278 res->start, res->end, res->flags);
279 out_be32(&pci_regs->iw1btar, 279 out_be32(&pci_regs->iw1btar,
280 MPC52xx_PCI_IWBTAR_TRANSLATION(res->start, res->start, 280 MPC52xx_PCI_IWBTAR_TRANSLATION(res->start, res->start,
281 res->end - res->start + 1)); 281 resource_size(res)));
282 iwcr1 = MPC52xx_PCI_IWCR_ENABLE | MPC52xx_PCI_IWCR_MEM; 282 iwcr1 = MPC52xx_PCI_IWCR_ENABLE | MPC52xx_PCI_IWCR_MEM;
283 if (res->flags & IORESOURCE_PREFETCH) 283 if (res->flags & IORESOURCE_PREFETCH)
284 iwcr1 |= MPC52xx_PCI_IWCR_READ_MULTI; 284 iwcr1 |= MPC52xx_PCI_IWCR_READ_MULTI;
@@ -300,7 +300,7 @@ mpc52xx_pci_setup(struct pci_controller *hose,
300 out_be32(&pci_regs->iw2btar, 300 out_be32(&pci_regs->iw2btar,
301 MPC52xx_PCI_IWBTAR_TRANSLATION(hose->io_base_phys, 301 MPC52xx_PCI_IWBTAR_TRANSLATION(hose->io_base_phys,
302 res->start, 302 res->start,
303 res->end - res->start + 1)); 303 resource_size(res)));
304 iwcr2 = MPC52xx_PCI_IWCR_ENABLE | MPC52xx_PCI_IWCR_IO; 304 iwcr2 = MPC52xx_PCI_IWCR_ENABLE | MPC52xx_PCI_IWCR_IO;
305 305
306 /* Set all the IWCR fields at once; they're in the same reg */ 306 /* Set all the IWCR fields at once; they're in the same reg */
@@ -402,7 +402,7 @@ mpc52xx_add_bridge(struct device_node *node)
402 402
403 hose->ops = &mpc52xx_pci_ops; 403 hose->ops = &mpc52xx_pci_ops;
404 404
405 pci_regs = ioremap(rsrc.start, rsrc.end - rsrc.start + 1); 405 pci_regs = ioremap(rsrc.start, resource_size(&rsrc));
406 if (!pci_regs) 406 if (!pci_regs)
407 return -ENOMEM; 407 return -ENOMEM;
408 408
diff --git a/arch/powerpc/platforms/83xx/km83xx.c b/arch/powerpc/platforms/83xx/km83xx.c
index a2b9b9ef1240..f8fa2fc3129f 100644
--- a/arch/powerpc/platforms/83xx/km83xx.c
+++ b/arch/powerpc/platforms/83xx/km83xx.c
@@ -101,7 +101,7 @@ static void __init mpc83xx_km_setup_arch(void)
101 __func__); 101 __func__);
102 return; 102 return;
103 } 103 }
104 base = ioremap(res.start, res.end - res.start + 1); 104 base = ioremap(res.start, resource_size(&res));
105 105
106 /* 106 /*
107 * IMMR + 0x14A8[4:5] = 11 (clk delay for UCC 2) 107 * IMMR + 0x14A8[4:5] = 11 (clk delay for UCC 2)
diff --git a/arch/powerpc/platforms/83xx/mpc832x_mds.c b/arch/powerpc/platforms/83xx/mpc832x_mds.c
index ec0b401bc9cf..93e60f1f21a9 100644
--- a/arch/powerpc/platforms/83xx/mpc832x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc832x_mds.c
@@ -68,7 +68,7 @@ static void __init mpc832x_sys_setup_arch(void)
68 struct resource res; 68 struct resource res;
69 69
70 of_address_to_resource(np, 0, &res); 70 of_address_to_resource(np, 0, &res);
71 bcsr_regs = ioremap(res.start, res.end - res.start +1); 71 bcsr_regs = ioremap(res.start, resource_size(&res));
72 of_node_put(np); 72 of_node_put(np);
73 } 73 }
74 74
diff --git a/arch/powerpc/platforms/83xx/mpc834x_mds.c b/arch/powerpc/platforms/83xx/mpc834x_mds.c
index d0a634b056ca..c1b1dc50b32a 100644
--- a/arch/powerpc/platforms/83xx/mpc834x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc834x_mds.c
@@ -53,7 +53,7 @@ static int mpc834xemds_usb_cfg(void)
53 struct resource res; 53 struct resource res;
54 54
55 of_address_to_resource(np, 0, &res); 55 of_address_to_resource(np, 0, &res);
56 bcsr_regs = ioremap(res.start, res.end - res.start + 1); 56 bcsr_regs = ioremap(res.start, resource_size(&res));
57 of_node_put(np); 57 of_node_put(np);
58 } 58 }
59 if (!bcsr_regs) 59 if (!bcsr_regs)
diff --git a/arch/powerpc/platforms/83xx/mpc836x_mds.c b/arch/powerpc/platforms/83xx/mpc836x_mds.c
index 09e9d6fb7411..81c052b1353e 100644
--- a/arch/powerpc/platforms/83xx/mpc836x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc836x_mds.c
@@ -76,7 +76,7 @@ static void __init mpc836x_mds_setup_arch(void)
76 struct resource res; 76 struct resource res;
77 77
78 of_address_to_resource(np, 0, &res); 78 of_address_to_resource(np, 0, &res);
79 bcsr_regs = ioremap(res.start, res.end - res.start +1); 79 bcsr_regs = ioremap(res.start, resource_size(&res));
80 of_node_put(np); 80 of_node_put(np);
81 } 81 }
82 82
diff --git a/arch/powerpc/platforms/83xx/usb.c b/arch/powerpc/platforms/83xx/usb.c
index 2c64164722d0..1ad748bb39b4 100644
--- a/arch/powerpc/platforms/83xx/usb.c
+++ b/arch/powerpc/platforms/83xx/usb.c
@@ -171,7 +171,7 @@ int mpc831x_usb_cfg(void)
171 of_node_put(np); 171 of_node_put(np);
172 return ret; 172 return ret;
173 } 173 }
174 usb_regs = ioremap(res.start, res.end - res.start + 1); 174 usb_regs = ioremap(res.start, resource_size(&res));
175 175
176 /* Using on-chip PHY */ 176 /* Using on-chip PHY */
177 if (prop && (!strcmp(prop, "utmi_wide") || 177 if (prop && (!strcmp(prop, "utmi_wide") ||
diff --git a/arch/powerpc/platforms/85xx/sbc8560.c b/arch/powerpc/platforms/85xx/sbc8560.c
index d2dfd465fbf6..09ced7221750 100644
--- a/arch/powerpc/platforms/85xx/sbc8560.c
+++ b/arch/powerpc/platforms/85xx/sbc8560.c
@@ -285,7 +285,7 @@ static int __init sbc8560_bdrstcr_init(void)
285 285
286 printk(KERN_INFO "sbc8560: Found BRSTCR at i/o 0x%x\n", res.start); 286 printk(KERN_INFO "sbc8560: Found BRSTCR at i/o 0x%x\n", res.start);
287 287
288 brstcr = ioremap(res.start, res.end - res.start); 288 brstcr = ioremap(res.start, resource_size(&res));
289 if(!brstcr) 289 if(!brstcr)
290 printk(KERN_WARNING "sbc8560: ioremap of brstcr failed.\n"); 290 printk(KERN_WARNING "sbc8560: ioremap of brstcr failed.\n");
291 291
diff --git a/arch/powerpc/platforms/85xx/xes_mpc85xx.c b/arch/powerpc/platforms/85xx/xes_mpc85xx.c
index 0125604d096e..a9dc5e795123 100644
--- a/arch/powerpc/platforms/85xx/xes_mpc85xx.c
+++ b/arch/powerpc/platforms/85xx/xes_mpc85xx.c
@@ -123,7 +123,7 @@ static void xes_mpc85xx_fixups(void)
123 continue; 123 continue;
124 } 124 }
125 125
126 l2_base = ioremap(r[0].start, r[0].end - r[0].start + 1); 126 l2_base = ioremap(r[0].start, resource_size(&r[0]));
127 127
128 xes_mpc85xx_configure_l2(l2_base); 128 xes_mpc85xx_configure_l2(l2_base);
129 } 129 }
diff --git a/arch/powerpc/platforms/cell/celleb_scc_epci.c b/arch/powerpc/platforms/cell/celleb_scc_epci.c
index 05b0db3ef638..844c0facb4f7 100644
--- a/arch/powerpc/platforms/cell/celleb_scc_epci.c
+++ b/arch/powerpc/platforms/cell/celleb_scc_epci.c
@@ -393,19 +393,19 @@ static int __init celleb_setup_epci(struct device_node *node,
393 393
394 if (of_address_to_resource(node, 0, &r)) 394 if (of_address_to_resource(node, 0, &r))
395 goto error; 395 goto error;
396 hose->cfg_addr = ioremap(r.start, (r.end - r.start + 1)); 396 hose->cfg_addr = ioremap(r.start, resource_size(&r));
397 if (!hose->cfg_addr) 397 if (!hose->cfg_addr)
398 goto error; 398 goto error;
399 pr_debug("EPCI: cfg_addr map 0x%016llx->0x%016lx + 0x%016llx\n", 399 pr_debug("EPCI: cfg_addr map 0x%016llx->0x%016lx + 0x%016llx\n",
400 r.start, (unsigned long)hose->cfg_addr, (r.end - r.start + 1)); 400 r.start, (unsigned long)hose->cfg_addr, resource_size(&r));
401 401
402 if (of_address_to_resource(node, 2, &r)) 402 if (of_address_to_resource(node, 2, &r))
403 goto error; 403 goto error;
404 hose->cfg_data = ioremap(r.start, (r.end - r.start + 1)); 404 hose->cfg_data = ioremap(r.start, resource_size(&r));
405 if (!hose->cfg_data) 405 if (!hose->cfg_data)
406 goto error; 406 goto error;
407 pr_debug("EPCI: cfg_data map 0x%016llx->0x%016lx + 0x%016llx\n", 407 pr_debug("EPCI: cfg_data map 0x%016llx->0x%016lx + 0x%016llx\n",
408 r.start, (unsigned long)hose->cfg_data, (r.end - r.start + 1)); 408 r.start, (unsigned long)hose->cfg_data, resource_size(&r));
409 409
410 hose->ops = &celleb_epci_ops; 410 hose->ops = &celleb_epci_ops;
411 celleb_epci_init(hose); 411 celleb_epci_init(hose);
diff --git a/arch/powerpc/platforms/cell/celleb_scc_pciex.c b/arch/powerpc/platforms/cell/celleb_scc_pciex.c
index a881bbee8de0..ae790ac4a589 100644
--- a/arch/powerpc/platforms/cell/celleb_scc_pciex.c
+++ b/arch/powerpc/platforms/cell/celleb_scc_pciex.c
@@ -494,7 +494,7 @@ static __init int celleb_setup_pciex(struct device_node *node,
494 pr_err("PCIEXC:Failed to get config resource.\n"); 494 pr_err("PCIEXC:Failed to get config resource.\n");
495 return 1; 495 return 1;
496 } 496 }
497 phb->cfg_addr = ioremap(r.start, r.end - r.start + 1); 497 phb->cfg_addr = ioremap(r.start, resource_size(&r));
498 if (!phb->cfg_addr) { 498 if (!phb->cfg_addr) {
499 pr_err("PCIEXC:Failed to remap SMMIO region.\n"); 499 pr_err("PCIEXC:Failed to remap SMMIO region.\n");
500 return 1; 500 return 1;
diff --git a/arch/powerpc/platforms/cell/spu_manage.c b/arch/powerpc/platforms/cell/spu_manage.c
index f465d474ad9b..4e5c91489c02 100644
--- a/arch/powerpc/platforms/cell/spu_manage.c
+++ b/arch/powerpc/platforms/cell/spu_manage.c
@@ -222,7 +222,7 @@ static int spu_map_resource(struct spu *spu, int nr,
222 return ret; 222 return ret;
223 if (phys) 223 if (phys)
224 *phys = resource.start; 224 *phys = resource.start;
225 len = resource.end - resource.start + 1; 225 len = resource_size(&resource);
226 *virt = ioremap(resource.start, len); 226 *virt = ioremap(resource.start, len);
227 if (!*virt) 227 if (!*virt)
228 return -EINVAL; 228 return -EINVAL;
diff --git a/arch/powerpc/platforms/chrp/pci.c b/arch/powerpc/platforms/chrp/pci.c
index 8f67a394b2d0..3f65443f1714 100644
--- a/arch/powerpc/platforms/chrp/pci.c
+++ b/arch/powerpc/platforms/chrp/pci.c
@@ -142,7 +142,7 @@ hydra_init(void)
142 return 0; 142 return 0;
143 } 143 }
144 of_node_put(np); 144 of_node_put(np);
145 Hydra = ioremap(r.start, r.end-r.start); 145 Hydra = ioremap(r.start, resource_size(&r));
146 printk("Hydra Mac I/O at %llx\n", (unsigned long long)r.start); 146 printk("Hydra Mac I/O at %llx\n", (unsigned long long)r.start);
147 printk("Hydra Feature_Control was %x", 147 printk("Hydra Feature_Control was %x",
148 in_le32(&Hydra->Feature_Control)); 148 in_le32(&Hydra->Feature_Control));
diff --git a/arch/powerpc/platforms/pasemi/dma_lib.c b/arch/powerpc/platforms/pasemi/dma_lib.c
index 321a9b3a2d00..756123bf06ac 100644
--- a/arch/powerpc/platforms/pasemi/dma_lib.c
+++ b/arch/powerpc/platforms/pasemi/dma_lib.c
@@ -576,7 +576,7 @@ int pasemi_dma_init(void)
576 res.start = 0xfd800000; 576 res.start = 0xfd800000;
577 res.end = res.start + 0x1000; 577 res.end = res.start + 0x1000;
578 } 578 }
579 dma_status = __ioremap(res.start, res.end-res.start, 0); 579 dma_status = __ioremap(res.start, resource_size(&res), 0);
580 pci_dev_put(iob_pdev); 580 pci_dev_put(iob_pdev);
581 581
582 for (i = 0; i < MAX_TXCH; i++) 582 for (i = 0; i < MAX_TXCH; i++)
diff --git a/arch/powerpc/platforms/powermac/nvram.c b/arch/powerpc/platforms/powermac/nvram.c
index b1cdcf94aa8e..695443bfdb08 100644
--- a/arch/powerpc/platforms/powermac/nvram.c
+++ b/arch/powerpc/platforms/powermac/nvram.c
@@ -580,10 +580,10 @@ int __init pmac_nvram_init(void)
580 /* Try to obtain an address */ 580 /* Try to obtain an address */
581 if (of_address_to_resource(dp, 0, &r1) == 0) { 581 if (of_address_to_resource(dp, 0, &r1) == 0) {
582 nvram_naddrs = 1; 582 nvram_naddrs = 1;
583 s1 = (r1.end - r1.start) + 1; 583 s1 = resource_size(&r1);
584 if (of_address_to_resource(dp, 1, &r2) == 0) { 584 if (of_address_to_resource(dp, 1, &r2) == 0) {
585 nvram_naddrs = 2; 585 nvram_naddrs = 2;
586 s2 = (r2.end - r2.start) + 1; 586 s2 = resource_size(&r2);
587 } 587 }
588 } 588 }
589 589
diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c
index f33e08d573ce..4d4eba324837 100644
--- a/arch/powerpc/platforms/powermac/pci.c
+++ b/arch/powerpc/platforms/powermac/pci.c
@@ -838,8 +838,7 @@ static void __init setup_u3_ht(struct pci_controller* hose)
838 * into cfg_addr 838 * into cfg_addr
839 */ 839 */
840 hose->cfg_data = ioremap(cfg_res.start, 0x02000000); 840 hose->cfg_data = ioremap(cfg_res.start, 0x02000000);
841 hose->cfg_addr = ioremap(self_res.start, 841 hose->cfg_addr = ioremap(self_res.start, resource_size(&self_res));
842 self_res.end - self_res.start + 1);
843 842
844 /* 843 /*
845 * /ht node doesn't expose a "ranges" property, we read the register 844 * /ht node doesn't expose a "ranges" property, we read the register
@@ -1323,8 +1322,7 @@ static void fixup_u4_pcie(struct pci_dev* dev)
1323 */ 1322 */
1324 if (r->start >= 0xf0000000 && r->start < 0xf3000000) 1323 if (r->start >= 0xf0000000 && r->start < 0xf3000000)
1325 continue; 1324 continue;
1326 if (!region || (r->end - r->start) > 1325 if (!region || resource_size(r) > resource_size(region))
1327 (region->end - region->start))
1328 region = r; 1326 region = r;
1329 } 1327 }
1330 /* Nothing found, bail */ 1328 /* Nothing found, bail */
diff --git a/arch/powerpc/platforms/powermac/time.c b/arch/powerpc/platforms/powermac/time.c
index 48211ca134c3..11c9fce43b5b 100644
--- a/arch/powerpc/platforms/powermac/time.c
+++ b/arch/powerpc/platforms/powermac/time.c
@@ -274,7 +274,7 @@ int __init via_calibrate_decr(void)
274 return 0; 274 return 0;
275 } 275 }
276 of_node_put(vias); 276 of_node_put(vias);
277 via = ioremap(rsrc.start, rsrc.end - rsrc.start + 1); 277 via = ioremap(rsrc.start, resource_size(&rsrc));
278 if (via == NULL) { 278 if (via == NULL) {
279 printk(KERN_ERR "Failed to map VIA for timer calibration !\n"); 279 printk(KERN_ERR "Failed to map VIA for timer calibration !\n");
280 return 0; 280 return 0;
diff --git a/arch/powerpc/sysdev/axonram.c b/arch/powerpc/sysdev/axonram.c
index bd0d54060b94..265f0f09395a 100644
--- a/arch/powerpc/sysdev/axonram.c
+++ b/arch/powerpc/sysdev/axonram.c
@@ -203,7 +203,7 @@ static int axon_ram_probe(struct platform_device *device)
203 goto failed; 203 goto failed;
204 } 204 }
205 205
206 bank->size = resource.end - resource.start + 1; 206 bank->size = resource_size(&resource);
207 207
208 if (bank->size == 0) { 208 if (bank->size == 0) {
209 dev_err(&device->dev, "No DDR2 memory found for %s%d\n", 209 dev_err(&device->dev, "No DDR2 memory found for %s%d\n",
diff --git a/arch/powerpc/sysdev/cpm1.c b/arch/powerpc/sysdev/cpm1.c
index 350787c83e22..5d7d59a43c4c 100644
--- a/arch/powerpc/sysdev/cpm1.c
+++ b/arch/powerpc/sysdev/cpm1.c
@@ -148,7 +148,7 @@ unsigned int cpm_pic_init(void)
148 if (ret) 148 if (ret)
149 goto end; 149 goto end;
150 150
151 cpic_reg = ioremap(res.start, res.end - res.start + 1); 151 cpic_reg = ioremap(res.start, resource_size(&res));
152 if (cpic_reg == NULL) 152 if (cpic_reg == NULL)
153 goto end; 153 goto end;
154 154
diff --git a/arch/powerpc/sysdev/cpm_common.c b/arch/powerpc/sysdev/cpm_common.c
index 2b69aa0315b3..d55d0ad0deab 100644
--- a/arch/powerpc/sysdev/cpm_common.c
+++ b/arch/powerpc/sysdev/cpm_common.c
@@ -115,7 +115,7 @@ int cpm_muram_init(void)
115 max = r.end; 115 max = r.end;
116 116
117 rh_attach_region(&cpm_muram_info, r.start - muram_pbase, 117 rh_attach_region(&cpm_muram_info, r.start - muram_pbase,
118 r.end - r.start + 1); 118 resource_size(&r));
119 } 119 }
120 120
121 muram_vbase = ioremap(muram_pbase, max - muram_pbase + 1); 121 muram_vbase = ioremap(muram_pbase, max - muram_pbase + 1);
diff --git a/arch/powerpc/sysdev/dart_iommu.c b/arch/powerpc/sysdev/dart_iommu.c
index 8e9e06a7ca59..4f2680f431b5 100644
--- a/arch/powerpc/sysdev/dart_iommu.c
+++ b/arch/powerpc/sysdev/dart_iommu.c
@@ -239,7 +239,7 @@ static int __init dart_init(struct device_node *dart_node)
239 DARTMAP_RPNMASK); 239 DARTMAP_RPNMASK);
240 240
241 /* Map in DART registers */ 241 /* Map in DART registers */
242 dart = ioremap(r.start, r.end - r.start + 1); 242 dart = ioremap(r.start, resource_size(&r));
243 if (dart == NULL) 243 if (dart == NULL)
244 panic("DART: Cannot map registers!"); 244 panic("DART: Cannot map registers!");
245 245
diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c
index 92e78333c47c..419a77239bd7 100644
--- a/arch/powerpc/sysdev/fsl_msi.c
+++ b/arch/powerpc/sysdev/fsl_msi.c
@@ -349,7 +349,7 @@ static int __devinit fsl_of_msi_probe(struct platform_device *dev)
349 goto error_out; 349 goto error_out;
350 } 350 }
351 351
352 msi->msi_regs = ioremap(res.start, res.end - res.start + 1); 352 msi->msi_regs = ioremap(res.start, resource_size(&res));
353 if (!msi->msi_regs) { 353 if (!msi->msi_regs) {
354 dev_err(&dev->dev, "ioremap problem failed\n"); 354 dev_err(&dev->dev, "ioremap problem failed\n");
355 goto error_out; 355 goto error_out;
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
index 68ca9290df94..ba5cb3fa7074 100644
--- a/arch/powerpc/sysdev/fsl_pci.c
+++ b/arch/powerpc/sysdev/fsl_pci.c
@@ -64,7 +64,7 @@ static int __init setup_one_atmu(struct ccsr_pci __iomem *pci,
64{ 64{
65 resource_size_t pci_addr = res->start - offset; 65 resource_size_t pci_addr = res->start - offset;
66 resource_size_t phys_addr = res->start; 66 resource_size_t phys_addr = res->start;
67 resource_size_t size = res->end - res->start + 1; 67 resource_size_t size = resource_size(res);
68 u32 flags = 0x80044000; /* enable & mem R/W */ 68 u32 flags = 0x80044000; /* enable & mem R/W */
69 unsigned int i; 69 unsigned int i;
70 70
@@ -108,7 +108,7 @@ static void __init setup_pci_atmu(struct pci_controller *hose,
108 char *name = hose->dn->full_name; 108 char *name = hose->dn->full_name;
109 109
110 pr_debug("PCI memory map start 0x%016llx, size 0x%016llx\n", 110 pr_debug("PCI memory map start 0x%016llx, size 0x%016llx\n",
111 (u64)rsrc->start, (u64)rsrc->end - (u64)rsrc->start + 1); 111 (u64)rsrc->start, (u64)resource_size(rsrc));
112 112
113 if (of_device_is_compatible(hose->dn, "fsl,qoriq-pcie-v2.2")) { 113 if (of_device_is_compatible(hose->dn, "fsl,qoriq-pcie-v2.2")) {
114 win_idx = 2; 114 win_idx = 2;
@@ -116,7 +116,7 @@ static void __init setup_pci_atmu(struct pci_controller *hose,
116 end_idx = 3; 116 end_idx = 3;
117 } 117 }
118 118
119 pci = ioremap(rsrc->start, rsrc->end - rsrc->start + 1); 119 pci = ioremap(rsrc->start, resource_size(rsrc));
120 if (!pci) { 120 if (!pci) {
121 dev_err(hose->parent, "Unable to map ATMU registers\n"); 121 dev_err(hose->parent, "Unable to map ATMU registers\n");
122 return; 122 return;
@@ -153,9 +153,9 @@ static void __init setup_pci_atmu(struct pci_controller *hose,
153 } else { 153 } else {
154 pr_debug("PCI IO resource start 0x%016llx, size 0x%016llx, " 154 pr_debug("PCI IO resource start 0x%016llx, size 0x%016llx, "
155 "phy base 0x%016llx.\n", 155 "phy base 0x%016llx.\n",
156 (u64)hose->io_resource.start, 156 (u64)hose->io_resource.start,
157 (u64)hose->io_resource.end - (u64)hose->io_resource.start + 1, 157 (u64)resource_size(&hose->io_resource),
158 (u64)hose->io_base_phys); 158 (u64)hose->io_base_phys);
159 out_be32(&pci->pow[j].potar, (hose->io_resource.start >> 12)); 159 out_be32(&pci->pow[j].potar, (hose->io_resource.start >> 12));
160 out_be32(&pci->pow[j].potear, 0); 160 out_be32(&pci->pow[j].potear, 0);
161 out_be32(&pci->pow[j].powbar, (hose->io_base_phys >> 12)); 161 out_be32(&pci->pow[j].powbar, (hose->io_base_phys >> 12));
diff --git a/arch/powerpc/sysdev/fsl_rio.c b/arch/powerpc/sysdev/fsl_rio.c
index 5b206a2fe17c..95853386a664 100644
--- a/arch/powerpc/sysdev/fsl_rio.c
+++ b/arch/powerpc/sysdev/fsl_rio.c
@@ -1523,7 +1523,7 @@ int fsl_rio_setup(struct platform_device *dev)
1523 port->priv = priv; 1523 port->priv = priv;
1524 port->phys_efptr = 0x100; 1524 port->phys_efptr = 0x100;
1525 1525
1526 priv->regs_win = ioremap(regs.start, regs.end - regs.start + 1); 1526 priv->regs_win = ioremap(regs.start, resource_size(&regs));
1527 rio_regs_win = priv->regs_win; 1527 rio_regs_win = priv->regs_win;
1528 1528
1529 /* Probe the master port phy type */ 1529 /* Probe the master port phy type */
diff --git a/arch/powerpc/sysdev/ipic.c b/arch/powerpc/sysdev/ipic.c
index 7367d17364cb..95da897f05a7 100644
--- a/arch/powerpc/sysdev/ipic.c
+++ b/arch/powerpc/sysdev/ipic.c
@@ -736,7 +736,7 @@ struct ipic * __init ipic_init(struct device_node *node, unsigned int flags)
736 return NULL; 736 return NULL;
737 } 737 }
738 738
739 ipic->regs = ioremap(res.start, res.end - res.start + 1); 739 ipic->regs = ioremap(res.start, resource_size(&res));
740 740
741 ipic->irqhost->host_data = ipic; 741 ipic->irqhost->host_data = ipic;
742 742
diff --git a/arch/powerpc/sysdev/mmio_nvram.c b/arch/powerpc/sysdev/mmio_nvram.c
index ddc877a3a23a..69f5814ae6d4 100644
--- a/arch/powerpc/sysdev/mmio_nvram.c
+++ b/arch/powerpc/sysdev/mmio_nvram.c
@@ -129,7 +129,7 @@ int __init mmio_nvram_init(void)
129 goto out; 129 goto out;
130 } 130 }
131 nvram_addr = r.start; 131 nvram_addr = r.start;
132 mmio_nvram_len = r.end - r.start + 1; 132 mmio_nvram_len = resource_size(&r);
133 if ( (!mmio_nvram_len) || (!nvram_addr) ) { 133 if ( (!mmio_nvram_len) || (!nvram_addr) ) {
134 printk(KERN_WARNING "nvram: address or length is 0\n"); 134 printk(KERN_WARNING "nvram: address or length is 0\n");
135 ret = -EIO; 135 ret = -EIO;
diff --git a/arch/powerpc/sysdev/mpc8xx_pic.c b/arch/powerpc/sysdev/mpc8xx_pic.c
index 20924f2246f0..22e48e2d71f1 100644
--- a/arch/powerpc/sysdev/mpc8xx_pic.c
+++ b/arch/powerpc/sysdev/mpc8xx_pic.c
@@ -166,7 +166,7 @@ int mpc8xx_pic_init(void)
166 if (ret) 166 if (ret)
167 goto out; 167 goto out;
168 168
169 siu_reg = ioremap(res.start, res.end - res.start + 1); 169 siu_reg = ioremap(res.start, resource_size(&res));
170 if (siu_reg == NULL) { 170 if (siu_reg == NULL) {
171 ret = -EINVAL; 171 ret = -EINVAL;
172 goto out; 172 goto out;
diff --git a/arch/powerpc/sysdev/mv64x60_udbg.c b/arch/powerpc/sysdev/mv64x60_udbg.c
index 2792dc8b038c..50a81387e9b1 100644
--- a/arch/powerpc/sysdev/mv64x60_udbg.c
+++ b/arch/powerpc/sysdev/mv64x60_udbg.c
@@ -125,11 +125,11 @@ static void mv64x60_udbg_init(void)
125 125
126 of_node_put(np); 126 of_node_put(np);
127 127
128 mpsc_base = ioremap(r[0].start, r[0].end - r[0].start + 1); 128 mpsc_base = ioremap(r[0].start, resource_size(&r[0]));
129 if (!mpsc_base) 129 if (!mpsc_base)
130 return; 130 return;
131 131
132 mpsc_intr_cause = ioremap(r[1].start, r[1].end - r[1].start + 1); 132 mpsc_intr_cause = ioremap(r[1].start, resource_size(&r[1]));
133 if (!mpsc_intr_cause) { 133 if (!mpsc_intr_cause) {
134 iounmap(mpsc_base); 134 iounmap(mpsc_base);
135 return; 135 return;
diff --git a/arch/powerpc/sysdev/ppc4xx_pci.c b/arch/powerpc/sysdev/ppc4xx_pci.c
index 156aa7d36258..deda60a7f996 100644
--- a/arch/powerpc/sysdev/ppc4xx_pci.c
+++ b/arch/powerpc/sysdev/ppc4xx_pci.c
@@ -265,7 +265,7 @@ static void __init ppc4xx_configure_pci_PMMs(struct pci_controller *hose,
265 if (ppc4xx_setup_one_pci_PMM(hose, reg, 265 if (ppc4xx_setup_one_pci_PMM(hose, reg,
266 res->start, 266 res->start,
267 res->start - hose->pci_mem_offset, 267 res->start - hose->pci_mem_offset,
268 res->end + 1 - res->start, 268 resource_size(res),
269 res->flags, 269 res->flags,
270 j) == 0) { 270 j) == 0) {
271 j++; 271 j++;
@@ -290,7 +290,7 @@ static void __init ppc4xx_configure_pci_PTMs(struct pci_controller *hose,
290 void __iomem *reg, 290 void __iomem *reg,
291 const struct resource *res) 291 const struct resource *res)
292{ 292{
293 resource_size_t size = res->end - res->start + 1; 293 resource_size_t size = resource_size(res);
294 u32 sa; 294 u32 sa;
295 295
296 /* Calculate window size */ 296 /* Calculate window size */
@@ -349,7 +349,7 @@ static void __init ppc4xx_probe_pci_bridge(struct device_node *np)
349 bus_range = of_get_property(np, "bus-range", NULL); 349 bus_range = of_get_property(np, "bus-range", NULL);
350 350
351 /* Map registers */ 351 /* Map registers */
352 reg = ioremap(rsrc_reg.start, rsrc_reg.end + 1 - rsrc_reg.start); 352 reg = ioremap(rsrc_reg.start, resource_size(&rsrc_reg));
353 if (reg == NULL) { 353 if (reg == NULL) {
354 printk(KERN_ERR "%s: Can't map registers !", np->full_name); 354 printk(KERN_ERR "%s: Can't map registers !", np->full_name);
355 goto fail; 355 goto fail;
@@ -465,7 +465,7 @@ static void __init ppc4xx_configure_pcix_POMs(struct pci_controller *hose,
465 if (ppc4xx_setup_one_pcix_POM(hose, reg, 465 if (ppc4xx_setup_one_pcix_POM(hose, reg,
466 res->start, 466 res->start,
467 res->start - hose->pci_mem_offset, 467 res->start - hose->pci_mem_offset,
468 res->end + 1 - res->start, 468 resource_size(res),
469 res->flags, 469 res->flags,
470 j) == 0) { 470 j) == 0) {
471 j++; 471 j++;
@@ -492,7 +492,7 @@ static void __init ppc4xx_configure_pcix_PIMs(struct pci_controller *hose,
492 int big_pim, 492 int big_pim,
493 int enable_msi_hole) 493 int enable_msi_hole)
494{ 494{
495 resource_size_t size = res->end - res->start + 1; 495 resource_size_t size = resource_size(res);
496 u32 sa; 496 u32 sa;
497 497
498 /* RAM is always at 0 */ 498 /* RAM is always at 0 */
@@ -555,7 +555,7 @@ static void __init ppc4xx_probe_pcix_bridge(struct device_node *np)
555 bus_range = of_get_property(np, "bus-range", NULL); 555 bus_range = of_get_property(np, "bus-range", NULL);
556 556
557 /* Map registers */ 557 /* Map registers */
558 reg = ioremap(rsrc_reg.start, rsrc_reg.end + 1 - rsrc_reg.start); 558 reg = ioremap(rsrc_reg.start, resource_size(&rsrc_reg));
559 if (reg == NULL) { 559 if (reg == NULL) {
560 printk(KERN_ERR "%s: Can't map registers !", np->full_name); 560 printk(KERN_ERR "%s: Can't map registers !", np->full_name);
561 goto fail; 561 goto fail;
@@ -1604,7 +1604,7 @@ static void __init ppc4xx_configure_pciex_POMs(struct ppc4xx_pciex_port *port,
1604 if (ppc4xx_setup_one_pciex_POM(port, hose, mbase, 1604 if (ppc4xx_setup_one_pciex_POM(port, hose, mbase,
1605 res->start, 1605 res->start,
1606 res->start - hose->pci_mem_offset, 1606 res->start - hose->pci_mem_offset,
1607 res->end + 1 - res->start, 1607 resource_size(res),
1608 res->flags, 1608 res->flags,
1609 j) == 0) { 1609 j) == 0) {
1610 j++; 1610 j++;
@@ -1639,7 +1639,7 @@ static void __init ppc4xx_configure_pciex_PIMs(struct ppc4xx_pciex_port *port,
1639 void __iomem *mbase, 1639 void __iomem *mbase,
1640 struct resource *res) 1640 struct resource *res)
1641{ 1641{
1642 resource_size_t size = res->end - res->start + 1; 1642 resource_size_t size = resource_size(res);
1643 u64 sa; 1643 u64 sa;
1644 1644
1645 if (port->endpoint) { 1645 if (port->endpoint) {
diff --git a/arch/powerpc/sysdev/qe_lib/qe_ic.c b/arch/powerpc/sysdev/qe_lib/qe_ic.c
index b2acda07220d..18e75ca19fe6 100644
--- a/arch/powerpc/sysdev/qe_lib/qe_ic.c
+++ b/arch/powerpc/sysdev/qe_lib/qe_ic.c
@@ -347,7 +347,7 @@ void __init qe_ic_init(struct device_node *node, unsigned int flags,
347 return; 347 return;
348 } 348 }
349 349
350 qe_ic->regs = ioremap(res.start, res.end - res.start + 1); 350 qe_ic->regs = ioremap(res.start, resource_size(&res));
351 351
352 qe_ic->irqhost->host_data = qe_ic; 352 qe_ic->irqhost->host_data = qe_ic;
353 qe_ic->hc_irq = qe_ic_irq_chip; 353 qe_ic->hc_irq = qe_ic_irq_chip;
diff --git a/arch/powerpc/sysdev/qe_lib/qe_io.c b/arch/powerpc/sysdev/qe_lib/qe_io.c
index 77e4934b88c5..fd1a6c3b1721 100644
--- a/arch/powerpc/sysdev/qe_lib/qe_io.c
+++ b/arch/powerpc/sysdev/qe_lib/qe_io.c
@@ -41,7 +41,7 @@ int par_io_init(struct device_node *np)
41 ret = of_address_to_resource(np, 0, &res); 41 ret = of_address_to_resource(np, 0, &res);
42 if (ret) 42 if (ret)
43 return ret; 43 return ret;
44 par_io = ioremap(res.start, res.end - res.start + 1); 44 par_io = ioremap(res.start, resource_size(&res));
45 45
46 num_ports = of_get_property(np, "num-ports", NULL); 46 num_ports = of_get_property(np, "num-ports", NULL);
47 if (num_ports) 47 if (num_ports)
diff --git a/arch/powerpc/sysdev/xics/icp-native.c b/arch/powerpc/sysdev/xics/icp-native.c
index 1f15ad436140..039a7820ba7f 100644
--- a/arch/powerpc/sysdev/xics/icp-native.c
+++ b/arch/powerpc/sysdev/xics/icp-native.c
@@ -247,7 +247,7 @@ static int __init icp_native_init_one_node(struct device_node *np,
247 return -1; 247 return -1;
248 } 248 }
249 249
250 if (icp_native_map_one_cpu(*indx, r.start, r.end - r.start)) 250 if (icp_native_map_one_cpu(*indx, r.start, resource_size(&r)))
251 return -1; 251 return -1;
252 252
253 (*indx)++; 253 (*indx)++;
diff --git a/arch/sh/kernel/io_trapped.c b/arch/sh/kernel/io_trapped.c
index 32c385ef1011..0f62f4672754 100644
--- a/arch/sh/kernel/io_trapped.c
+++ b/arch/sh/kernel/io_trapped.c
@@ -58,7 +58,7 @@ int register_trapped_io(struct trapped_io *tiop)
58 58
59 for (k = 0; k < tiop->num_resources; k++) { 59 for (k = 0; k < tiop->num_resources; k++) {
60 res = tiop->resource + k; 60 res = tiop->resource + k;
61 len += roundup((res->end - res->start) + 1, PAGE_SIZE); 61 len += roundup(resource_size(res), PAGE_SIZE);
62 flags |= res->flags; 62 flags |= res->flags;
63 } 63 }
64 64
@@ -85,7 +85,7 @@ int register_trapped_io(struct trapped_io *tiop)
85 (unsigned long)(tiop->virt_base + len), 85 (unsigned long)(tiop->virt_base + len),
86 res->flags & IORESOURCE_IO ? "io" : "mmio", 86 res->flags & IORESOURCE_IO ? "io" : "mmio",
87 (unsigned long)res->start); 87 (unsigned long)res->start);
88 len += roundup((res->end - res->start) + 1, PAGE_SIZE); 88 len += roundup(resource_size(res), PAGE_SIZE);
89 } 89 }
90 90
91 tiop->magic = IO_TRAPPED_MAGIC; 91 tiop->magic = IO_TRAPPED_MAGIC;
@@ -128,7 +128,7 @@ void __iomem *match_trapped_io_handler(struct list_head *list,
128 return tiop->virt_base + voffs; 128 return tiop->virt_base + voffs;
129 } 129 }
130 130
131 len = (res->end - res->start) + 1; 131 len = resource_size(res);
132 voffs += roundup(len, PAGE_SIZE); 132 voffs += roundup(len, PAGE_SIZE);
133 } 133 }
134 } 134 }
@@ -173,7 +173,7 @@ static unsigned long lookup_address(struct trapped_io *tiop,
173 173
174 for (k = 0; k < tiop->num_resources; k++) { 174 for (k = 0; k < tiop->num_resources; k++) {
175 res = tiop->resource + k; 175 res = tiop->resource + k;
176 len = roundup((res->end - res->start) + 1, PAGE_SIZE); 176 len = roundup(resource_size(res), PAGE_SIZE);
177 if (address < (vaddr + len)) 177 if (address < (vaddr + len))
178 return res->start + (address - vaddr); 178 return res->start + (address - vaddr);
179 vaddr += len; 179 vaddr += len;
diff --git a/arch/sh/kernel/machine_kexec.c b/arch/sh/kernel/machine_kexec.c
index e2a3af31ff99..c5a33f007f88 100644
--- a/arch/sh/kernel/machine_kexec.c
+++ b/arch/sh/kernel/machine_kexec.c
@@ -170,7 +170,7 @@ void __init reserve_crashkernel(void)
170 if (crashk_res.end == crashk_res.start) 170 if (crashk_res.end == crashk_res.start)
171 goto disable; 171 goto disable;
172 172
173 crash_size = PAGE_ALIGN(crashk_res.end - crashk_res.start + 1); 173 crash_size = PAGE_ALIGN(resource_size(&crashk_res));
174 if (!crashk_res.start) { 174 if (!crashk_res.start) {
175 unsigned long max = memblock_end_of_DRAM() - memory_limit; 175 unsigned long max = memblock_end_of_DRAM() - memory_limit;
176 crashk_res.start = __memblock_alloc_base(crash_size, PAGE_SIZE, max); 176 crashk_res.start = __memblock_alloc_base(crash_size, PAGE_SIZE, max);
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c
index 1c9c80a1a86a..6ffccd6e0156 100644
--- a/arch/sparc/kernel/ioport.c
+++ b/arch/sparc/kernel/ioport.c
@@ -228,7 +228,7 @@ _sparc_ioremap(struct resource *res, u32 bus, u32 pa, int sz)
228 } 228 }
229 229
230 pa &= PAGE_MASK; 230 pa &= PAGE_MASK;
231 sparc_mapiorange(bus, pa, res->start, res->end - res->start + 1); 231 sparc_mapiorange(bus, pa, res->start, resource_size(res));
232 232
233 return (void __iomem *)(unsigned long)(res->start + offset); 233 return (void __iomem *)(unsigned long)(res->start + offset);
234} 234}
@@ -240,7 +240,7 @@ static void _sparc_free_io(struct resource *res)
240{ 240{
241 unsigned long plen; 241 unsigned long plen;
242 242
243 plen = res->end - res->start + 1; 243 plen = resource_size(res);
244 BUG_ON((plen & (PAGE_SIZE-1)) != 0); 244 BUG_ON((plen & (PAGE_SIZE-1)) != 0);
245 sparc_unmapiorange(res->start, plen); 245 sparc_unmapiorange(res->start, plen);
246 release_resource(res); 246 release_resource(res);
@@ -331,9 +331,9 @@ static void sbus_free_coherent(struct device *dev, size_t n, void *p,
331 } 331 }
332 332
333 n = PAGE_ALIGN(n); 333 n = PAGE_ALIGN(n);
334 if ((res->end-res->start)+1 != n) { 334 if (resource_size(res) != n) {
335 printk("sbus_free_consistent: region 0x%lx asked 0x%zx\n", 335 printk("sbus_free_consistent: region 0x%lx asked 0x%zx\n",
336 (long)((res->end-res->start)+1), n); 336 (long)resource_size(res), n);
337 return; 337 return;
338 } 338 }
339 339
@@ -504,9 +504,9 @@ static void pci32_free_coherent(struct device *dev, size_t n, void *p,
504 } 504 }
505 505
506 n = PAGE_ALIGN(n); 506 n = PAGE_ALIGN(n);
507 if ((res->end-res->start)+1 != n) { 507 if (resource_size(res) != n) {
508 printk("pci_free_consistent: region 0x%lx asked 0x%lx\n", 508 printk("pci_free_consistent: region 0x%lx asked 0x%lx\n",
509 (long)((res->end-res->start)+1), (long)n); 509 (long)resource_size(res), (long)n);
510 return; 510 return;
511 } 511 }
512 512
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index 713dc91020a6..2d1453dd93d5 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -820,11 +820,9 @@ static int __pci_mmap_make_offset_bus(struct pci_dev *pdev, struct vm_area_struc
820 unsigned long space_size, user_offset, user_size; 820 unsigned long space_size, user_offset, user_size;
821 821
822 if (mmap_state == pci_mmap_io) { 822 if (mmap_state == pci_mmap_io) {
823 space_size = (pbm->io_space.end - 823 space_size = resource_size(&pbm->io_space);
824 pbm->io_space.start) + 1;
825 } else { 824 } else {
826 space_size = (pbm->mem_space.end - 825 space_size = resource_size(&pbm->mem_space);
827 pbm->mem_space.start) + 1;
828 } 826 }
829 827
830 /* Make sure the request is in range. */ 828 /* Make sure the request is in range. */
diff --git a/arch/tile/kernel/setup.c b/arch/tile/kernel/setup.c
index 6cdc9ba55fe0..5f85d8b34dbb 100644
--- a/arch/tile/kernel/setup.c
+++ b/arch/tile/kernel/setup.c
@@ -553,8 +553,7 @@ static void __init setup_bootmem_allocator(void)
553 553
554#ifdef CONFIG_KEXEC 554#ifdef CONFIG_KEXEC
555 if (crashk_res.start != crashk_res.end) 555 if (crashk_res.start != crashk_res.end)
556 reserve_bootmem(crashk_res.start, 556 reserve_bootmem(crashk_res.start, resource_size(&crashk_res), 0);
557 crashk_res.end - crashk_res.start + 1, 0);
558#endif 557#endif
559} 558}
560 559
diff --git a/arch/x86/kernel/pci-calgary_64.c b/arch/x86/kernel/pci-calgary_64.c
index e8c33a302006..726494b58345 100644
--- a/arch/x86/kernel/pci-calgary_64.c
+++ b/arch/x86/kernel/pci-calgary_64.c
@@ -1553,7 +1553,7 @@ static void __init calgary_fixup_one_tce_space(struct pci_dev *dev)
1553 continue; 1553 continue;
1554 1554
1555 /* cover the whole region */ 1555 /* cover the whole region */
1556 npages = (r->end - r->start) >> PAGE_SHIFT; 1556 npages = resource_size(r) >> PAGE_SHIFT;
1557 npages++; 1557 npages++;
1558 1558
1559 iommu_range_reserve(tbl, r->start, npages); 1559 iommu_range_reserve(tbl, r->start, npages);
diff --git a/arch/x86/kernel/probe_roms.c b/arch/x86/kernel/probe_roms.c
index ba0a4cce53be..63228035f9d7 100644
--- a/arch/x86/kernel/probe_roms.c
+++ b/arch/x86/kernel/probe_roms.c
@@ -234,7 +234,7 @@ void __init probe_roms(void)
234 /* check for extension rom (ignore length byte!) */ 234 /* check for extension rom (ignore length byte!) */
235 rom = isa_bus_to_virt(extension_rom_resource.start); 235 rom = isa_bus_to_virt(extension_rom_resource.start);
236 if (romsignature(rom)) { 236 if (romsignature(rom)) {
237 length = extension_rom_resource.end - extension_rom_resource.start + 1; 237 length = resource_size(&extension_rom_resource);
238 if (romchecksum(rom, length)) { 238 if (romchecksum(rom, length)) {
239 request_resource(&iomem_resource, &extension_rom_resource); 239 request_resource(&iomem_resource, &extension_rom_resource);
240 upper = extension_rom_resource.start; 240 upper = extension_rom_resource.start;
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);
1927no_dma: 1927no_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
1932probe_quit: 1932probe_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
310fail2: 309fail2:
311 release_mem_region(io->start, io->end + 1 - io->start); 310 release_mem_region(io->start, resource_size(io));
312fail1: 311fail1:
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);
752cleanup0: 752cleanup0:
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(&gt->resource) >> PAGE_SHIFT;
153 153
154 WARN_ON(gt->pages); 154 WARN_ON(gt->pages);
155 155
@@ -191,7 +191,7 @@ err:
191static void psb_gtt_detach_pages(struct gtt_range *gt) 191static 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(&gt->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);
1310do_release_region: 1310do_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);
2594err_release_mem_region: 2594err_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));
2597err_kfree: 2597err_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;
155err3: 155err3:
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);
159err2: 159err2:
160 iounmap(dev->mab_regs); 160 iounmap(dev->mab_regs);
161err1: 161err1:
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:
185err2: 184err2:
186 dma_release_declared_memory(dev); 185 dma_release_declared_memory(dev);
187err1: 186err1:
188 release_mem_region(mem->start, mem->end - mem->start + 1); 187 release_mem_region(mem->start, resource_size(mem));
189err0: 188err0:
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(&reg_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;
diff --git a/include/linux/dio.h b/include/linux/dio.h
index b2dd31ca1710..2cc0fd00463f 100644
--- a/include/linux/dio.h
+++ b/include/linux/dio.h
@@ -254,7 +254,7 @@ static inline struct dio_driver *dio_dev_driver(const struct dio_dev *d)
254 254
255#define dio_resource_start(d) ((d)->resource.start) 255#define dio_resource_start(d) ((d)->resource.start)
256#define dio_resource_end(d) ((d)->resource.end) 256#define dio_resource_end(d) ((d)->resource.end)
257#define dio_resource_len(d) ((d)->resource.end-(d)->resource.start+1) 257#define dio_resource_len(d) (resource_size(&(d)->resource))
258#define dio_resource_flags(d) ((d)->resource.flags) 258#define dio_resource_flags(d) ((d)->resource.flags)
259 259
260#define dio_request_device(d, name) \ 260#define dio_request_device(d, name) \
diff --git a/include/linux/pnp.h b/include/linux/pnp.h
index 1bc1338b817b..195aafc6cd07 100644
--- a/include/linux/pnp.h
+++ b/include/linux/pnp.h
@@ -50,7 +50,7 @@ static inline resource_size_t pnp_resource_len(struct resource *res)
50{ 50{
51 if (res->start == 0 && res->end == 0) 51 if (res->start == 0 && res->end == 0)
52 return 0; 52 return 0;
53 return res->end - res->start + 1; 53 return resource_size(res);
54} 54}
55 55
56 56
diff --git a/include/linux/zorro.h b/include/linux/zorro.h
index 7bf9db525e9e..dff42025649b 100644
--- a/include/linux/zorro.h
+++ b/include/linux/zorro.h
@@ -187,7 +187,7 @@ extern struct zorro_dev *zorro_find_device(zorro_id id,
187 187
188#define zorro_resource_start(z) ((z)->resource.start) 188#define zorro_resource_start(z) ((z)->resource.start)
189#define zorro_resource_end(z) ((z)->resource.end) 189#define zorro_resource_end(z) ((z)->resource.end)
190#define zorro_resource_len(z) ((z)->resource.end-(z)->resource.start+1) 190#define zorro_resource_len(z) (resource_size(&(z)->resource))
191#define zorro_resource_flags(z) ((z)->resource.flags) 191#define zorro_resource_flags(z) ((z)->resource.flags)
192 192
193#define zorro_request_device(z, name) \ 193#define zorro_request_device(z, name) \
diff --git a/kernel/kexec.c b/kernel/kexec.c
index 8d814cbc8109..296fbc84d659 100644
--- a/kernel/kexec.c
+++ b/kernel/kexec.c
@@ -1095,7 +1095,7 @@ size_t crash_get_memory_size(void)
1095 size_t size = 0; 1095 size_t size = 0;
1096 mutex_lock(&kexec_mutex); 1096 mutex_lock(&kexec_mutex);
1097 if (crashk_res.end != crashk_res.start) 1097 if (crashk_res.end != crashk_res.start)
1098 size = crashk_res.end - crashk_res.start + 1; 1098 size = resource_size(&crashk_res);
1099 mutex_unlock(&kexec_mutex); 1099 mutex_unlock(&kexec_mutex);
1100 return size; 1100 return size;
1101} 1101}
diff --git a/sound/aoa/soundbus/i2sbus/core.c b/sound/aoa/soundbus/i2sbus/core.c
index 3ff8cc5f487a..010658335881 100644
--- a/sound/aoa/soundbus/i2sbus/core.c
+++ b/sound/aoa/soundbus/i2sbus/core.c
@@ -262,8 +262,7 @@ static int i2sbus_add_dev(struct macio_dev *macio,
262 */ 262 */
263 dev->allocated_resource[i] = 263 dev->allocated_resource[i] =
264 request_mem_region(dev->resources[i].start, 264 request_mem_region(dev->resources[i].start,
265 dev->resources[i].end - 265 resource_size(&dev->resources[i]),
266 dev->resources[i].start + 1,
267 dev->rnames[i]); 266 dev->rnames[i]);
268 if (!dev->allocated_resource[i]) { 267 if (!dev->allocated_resource[i]) {
269 printk(KERN_ERR "i2sbus: failed to claim resource %d!\n", i); 268 printk(KERN_ERR "i2sbus: failed to claim resource %d!\n", i);
@@ -272,19 +271,19 @@ static int i2sbus_add_dev(struct macio_dev *macio,
272 } 271 }
273 272
274 r = &dev->resources[aoa_resource_i2smmio]; 273 r = &dev->resources[aoa_resource_i2smmio];
275 rlen = r->end - r->start + 1; 274 rlen = resource_size(r);
276 if (rlen < sizeof(struct i2s_interface_regs)) 275 if (rlen < sizeof(struct i2s_interface_regs))
277 goto err; 276 goto err;
278 dev->intfregs = ioremap(r->start, rlen); 277 dev->intfregs = ioremap(r->start, rlen);
279 278
280 r = &dev->resources[aoa_resource_txdbdma]; 279 r = &dev->resources[aoa_resource_txdbdma];
281 rlen = r->end - r->start + 1; 280 rlen = resource_size(r);
282 if (rlen < sizeof(struct dbdma_regs)) 281 if (rlen < sizeof(struct dbdma_regs))
283 goto err; 282 goto err;
284 dev->out.dbdma = ioremap(r->start, rlen); 283 dev->out.dbdma = ioremap(r->start, rlen);
285 284
286 r = &dev->resources[aoa_resource_rxdbdma]; 285 r = &dev->resources[aoa_resource_rxdbdma];
287 rlen = r->end - r->start + 1; 286 rlen = resource_size(r);
288 if (rlen < sizeof(struct dbdma_regs)) 287 if (rlen < sizeof(struct dbdma_regs))
289 goto err; 288 goto err;
290 dev->in.dbdma = ioremap(r->start, rlen); 289 dev->in.dbdma = ioremap(r->start, rlen);
diff --git a/sound/atmel/abdac.c b/sound/atmel/abdac.c
index 6e2409181895..30468b31cad8 100644
--- a/sound/atmel/abdac.c
+++ b/sound/atmel/abdac.c
@@ -448,7 +448,7 @@ static int __devinit atmel_abdac_probe(struct platform_device *pdev)
448 goto out_free_card; 448 goto out_free_card;
449 } 449 }
450 450
451 dac->regs = ioremap(regs->start, regs->end - regs->start + 1); 451 dac->regs = ioremap(regs->start, resource_size(regs));
452 if (!dac->regs) { 452 if (!dac->regs) {
453 dev_dbg(&pdev->dev, "could not remap register memory\n"); 453 dev_dbg(&pdev->dev, "could not remap register memory\n");
454 goto out_free_card; 454 goto out_free_card;
diff --git a/sound/atmel/ac97c.c b/sound/atmel/ac97c.c
index b310702c646e..41b901bde5c7 100644
--- a/sound/atmel/ac97c.c
+++ b/sound/atmel/ac97c.c
@@ -971,7 +971,7 @@ static int __devinit atmel_ac97c_probe(struct platform_device *pdev)
971 chip->card = card; 971 chip->card = card;
972 chip->pclk = pclk; 972 chip->pclk = pclk;
973 chip->pdev = pdev; 973 chip->pdev = pdev;
974 chip->regs = ioremap(regs->start, regs->end - regs->start + 1); 974 chip->regs = ioremap(regs->start, resource_size(regs));
975 975
976 if (!chip->regs) { 976 if (!chip->regs) {
977 dev_dbg(&pdev->dev, "could not remap register memory\n"); 977 dev_dbg(&pdev->dev, "could not remap register memory\n");
diff --git a/sound/ppc/pmac.c b/sound/ppc/pmac.c
index 3ecbd67f88c9..ab96cde7417b 100644
--- a/sound/ppc/pmac.c
+++ b/sound/ppc/pmac.c
@@ -881,8 +881,7 @@ static int snd_pmac_free(struct snd_pmac *chip)
881 for (i = 0; i < 3; i++) { 881 for (i = 0; i < 3; i++) {
882 if (chip->requested & (1 << i)) 882 if (chip->requested & (1 << i))
883 release_mem_region(chip->rsrc[i].start, 883 release_mem_region(chip->rsrc[i].start,
884 chip->rsrc[i].end - 884 resource_size(&chip->rsrc[i]));
885 chip->rsrc[i].start + 1);
886 } 885 }
887 } 886 }
888 887
@@ -1228,8 +1227,7 @@ int __devinit snd_pmac_new(struct snd_card *card, struct snd_pmac **chip_return)
1228 goto __error; 1227 goto __error;
1229 } 1228 }
1230 if (request_mem_region(chip->rsrc[i].start, 1229 if (request_mem_region(chip->rsrc[i].start,
1231 chip->rsrc[i].end - 1230 resource_size(&chip->rsrc[i]),
1232 chip->rsrc[i].start + 1,
1233 rnames[i]) == NULL) { 1231 rnames[i]) == NULL) {
1234 printk(KERN_ERR "snd: can't request rsrc " 1232 printk(KERN_ERR "snd: can't request rsrc "
1235 " %d (%s: %pR)\n", 1233 " %d (%s: %pR)\n",
@@ -1254,8 +1252,7 @@ int __devinit snd_pmac_new(struct snd_card *card, struct snd_pmac **chip_return)
1254 goto __error; 1252 goto __error;
1255 } 1253 }
1256 if (request_mem_region(chip->rsrc[i].start, 1254 if (request_mem_region(chip->rsrc[i].start,
1257 chip->rsrc[i].end - 1255 resource_size(&chip->rsrc[i]),
1258 chip->rsrc[i].start + 1,
1259 rnames[i]) == NULL) { 1256 rnames[i]) == NULL) {
1260 printk(KERN_ERR "snd: can't request rsrc " 1257 printk(KERN_ERR "snd: can't request rsrc "
1261 " %d (%s: %pR)\n", 1258 " %d (%s: %pR)\n",
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 313e0ccedd5b..6a882aa55530 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -678,7 +678,7 @@ static int __devinit fsl_ssi_probe(struct platform_device *pdev)
678 kfree(ssi_private); 678 kfree(ssi_private);
679 return ret; 679 return ret;
680 } 680 }
681 ssi_private->ssi = ioremap(res.start, 1 + res.end - res.start); 681 ssi_private->ssi = ioremap(res.start, resource_size(&res));
682 ssi_private->ssi_phys = res.start; 682 ssi_private->ssi_phys = res.start;
683 ssi_private->irq = irq_of_parse_and_map(np, 0); 683 ssi_private->irq = irq_of_parse_and_map(np, 0);
684 684
diff --git a/sound/soc/fsl/mpc5200_dma.c b/sound/soc/fsl/mpc5200_dma.c
index fff695ccdd3e..86023142a4cb 100644
--- a/sound/soc/fsl/mpc5200_dma.c
+++ b/sound/soc/fsl/mpc5200_dma.c
@@ -384,7 +384,7 @@ static int mpc5200_hpcd_probe(struct of_device *op)
384 dev_err(&op->dev, "Missing reg property\n"); 384 dev_err(&op->dev, "Missing reg property\n");
385 return -ENODEV; 385 return -ENODEV;
386 } 386 }
387 regs = ioremap(res.start, 1 + res.end - res.start); 387 regs = ioremap(res.start, resource_size(&res));
388 if (!regs) { 388 if (!regs) {
389 dev_err(&op->dev, "Could not map registers\n"); 389 dev_err(&op->dev, "Could not map registers\n");
390 return -ENODEV; 390 return -ENODEV;