diff options
author | Joe Perches <joe@perches.com> | 2011-06-09 12:13:32 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2011-06-10 08:55:36 -0400 |
commit | 28f65c11f2ffb3957259dece647a24f8ad2e241b (patch) | |
tree | 6b7621d09d10df89eedd908d4506fb9f457a909f /arch/powerpc/sysdev | |
parent | 140a1ef2f91a00e1d25f0878c193abdc25bf6ebe (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>
Diffstat (limited to 'arch/powerpc/sysdev')
-rw-r--r-- | arch/powerpc/sysdev/axonram.c | 2 | ||||
-rw-r--r-- | arch/powerpc/sysdev/cpm1.c | 2 | ||||
-rw-r--r-- | arch/powerpc/sysdev/cpm_common.c | 2 | ||||
-rw-r--r-- | arch/powerpc/sysdev/dart_iommu.c | 2 | ||||
-rw-r--r-- | arch/powerpc/sysdev/fsl_msi.c | 2 | ||||
-rw-r--r-- | arch/powerpc/sysdev/fsl_pci.c | 12 | ||||
-rw-r--r-- | arch/powerpc/sysdev/fsl_rio.c | 2 | ||||
-rw-r--r-- | arch/powerpc/sysdev/ipic.c | 2 | ||||
-rw-r--r-- | arch/powerpc/sysdev/mmio_nvram.c | 2 | ||||
-rw-r--r-- | arch/powerpc/sysdev/mpc8xx_pic.c | 2 | ||||
-rw-r--r-- | arch/powerpc/sysdev/mv64x60_udbg.c | 4 | ||||
-rw-r--r-- | arch/powerpc/sysdev/ppc4xx_pci.c | 16 | ||||
-rw-r--r-- | arch/powerpc/sysdev/qe_lib/qe_ic.c | 2 | ||||
-rw-r--r-- | arch/powerpc/sysdev/qe_lib/qe_io.c | 2 | ||||
-rw-r--r-- | arch/powerpc/sysdev/xics/icp-native.c | 2 |
15 files changed, 28 insertions, 28 deletions
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(®s)); |
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)++; |