aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia
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 /drivers/pcmcia
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>
Diffstat (limited to 'drivers/pcmcia')
-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
4 files changed, 11 insertions, 12 deletions
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;