aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty
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/tty
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/tty')
-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
7 files changed, 11 insertions, 14 deletions
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;