diff options
author | Jingoo Han <jg1.han@samsung.com> | 2013-05-23 06:39:36 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-06-03 13:21:33 -0400 |
commit | 696faedd616e202f5c510cd03dcc8853c11ca6db (patch) | |
tree | 45ebab791238ff927788d9ae31bde7f59b506060 | |
parent | 9d141cb97703439255e21bbc95903eda32324a3d (diff) |
serial: use platform_{get,set}_drvdata()
Use the wrapper functions for getting and setting the driver data using
platform_device instead of using dev_{get,set}_drvdata() with &pdev->dev,
so we can directly pass a struct platform_device.
Also, unnecessary dev_set_drvdata() is removed, because the driver core
clears the driver data to NULL after device_release or on probe failure.
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/tty/serial/cpm_uart/cpm_uart_core.c | 4 | ||||
-rw-r--r-- | drivers/tty/serial/mpc52xx_uart.c | 9 | ||||
-rw-r--r-- | drivers/tty/serial/of_serial.c | 4 | ||||
-rw-r--r-- | drivers/tty/serial/sc26xx.c | 5 | ||||
-rw-r--r-- | drivers/tty/serial/sunhv.c | 6 | ||||
-rw-r--r-- | drivers/tty/serial/sunsab.c | 6 | ||||
-rw-r--r-- | drivers/tty/serial/sunsu.c | 8 | ||||
-rw-r--r-- | drivers/tty/serial/sunzilog.c | 6 | ||||
-rw-r--r-- | drivers/tty/serial/ucc_uart.c | 5 | ||||
-rw-r--r-- | drivers/tty/serial/xilinx_uartps.c | 6 |
10 files changed, 23 insertions, 36 deletions
diff --git a/drivers/tty/serial/cpm_uart/cpm_uart_core.c b/drivers/tty/serial/cpm_uart/cpm_uart_core.c index 97f4e1858649..f7672cae5321 100644 --- a/drivers/tty/serial/cpm_uart/cpm_uart_core.c +++ b/drivers/tty/serial/cpm_uart/cpm_uart_core.c | |||
@@ -1384,7 +1384,7 @@ static int cpm_uart_probe(struct platform_device *ofdev) | |||
1384 | if (index >= UART_NR) | 1384 | if (index >= UART_NR) |
1385 | return -ENODEV; | 1385 | return -ENODEV; |
1386 | 1386 | ||
1387 | dev_set_drvdata(&ofdev->dev, pinfo); | 1387 | platform_set_drvdata(ofdev, pinfo); |
1388 | 1388 | ||
1389 | /* initialize the device pointer for the port */ | 1389 | /* initialize the device pointer for the port */ |
1390 | pinfo->port.dev = &ofdev->dev; | 1390 | pinfo->port.dev = &ofdev->dev; |
@@ -1398,7 +1398,7 @@ static int cpm_uart_probe(struct platform_device *ofdev) | |||
1398 | 1398 | ||
1399 | static int cpm_uart_remove(struct platform_device *ofdev) | 1399 | static int cpm_uart_remove(struct platform_device *ofdev) |
1400 | { | 1400 | { |
1401 | struct uart_cpm_port *pinfo = dev_get_drvdata(&ofdev->dev); | 1401 | struct uart_cpm_port *pinfo = platform_get_drvdata(ofdev); |
1402 | return uart_remove_one_port(&cpm_reg, &pinfo->port); | 1402 | return uart_remove_one_port(&cpm_reg, &pinfo->port); |
1403 | } | 1403 | } |
1404 | 1404 | ||
diff --git a/drivers/tty/serial/mpc52xx_uart.c b/drivers/tty/serial/mpc52xx_uart.c index 510fa986cf9e..2c03904359b9 100644 --- a/drivers/tty/serial/mpc52xx_uart.c +++ b/drivers/tty/serial/mpc52xx_uart.c | |||
@@ -1362,15 +1362,14 @@ static int mpc52xx_uart_of_probe(struct platform_device *op) | |||
1362 | if (ret) | 1362 | if (ret) |
1363 | return ret; | 1363 | return ret; |
1364 | 1364 | ||
1365 | dev_set_drvdata(&op->dev, (void *)port); | 1365 | platform_set_drvdata(op, (void *)port); |
1366 | return 0; | 1366 | return 0; |
1367 | } | 1367 | } |
1368 | 1368 | ||
1369 | static int | 1369 | static int |
1370 | mpc52xx_uart_of_remove(struct platform_device *op) | 1370 | mpc52xx_uart_of_remove(struct platform_device *op) |
1371 | { | 1371 | { |
1372 | struct uart_port *port = dev_get_drvdata(&op->dev); | 1372 | struct uart_port *port = platform_get_drvdata(op); |
1373 | dev_set_drvdata(&op->dev, NULL); | ||
1374 | 1373 | ||
1375 | if (port) | 1374 | if (port) |
1376 | uart_remove_one_port(&mpc52xx_uart_driver, port); | 1375 | uart_remove_one_port(&mpc52xx_uart_driver, port); |
@@ -1382,7 +1381,7 @@ mpc52xx_uart_of_remove(struct platform_device *op) | |||
1382 | static int | 1381 | static int |
1383 | mpc52xx_uart_of_suspend(struct platform_device *op, pm_message_t state) | 1382 | mpc52xx_uart_of_suspend(struct platform_device *op, pm_message_t state) |
1384 | { | 1383 | { |
1385 | struct uart_port *port = (struct uart_port *) dev_get_drvdata(&op->dev); | 1384 | struct uart_port *port = (struct uart_port *) platform_get_drvdata(op); |
1386 | 1385 | ||
1387 | if (port) | 1386 | if (port) |
1388 | uart_suspend_port(&mpc52xx_uart_driver, port); | 1387 | uart_suspend_port(&mpc52xx_uart_driver, port); |
@@ -1393,7 +1392,7 @@ mpc52xx_uart_of_suspend(struct platform_device *op, pm_message_t state) | |||
1393 | static int | 1392 | static int |
1394 | mpc52xx_uart_of_resume(struct platform_device *op) | 1393 | mpc52xx_uart_of_resume(struct platform_device *op) |
1395 | { | 1394 | { |
1396 | struct uart_port *port = (struct uart_port *) dev_get_drvdata(&op->dev); | 1395 | struct uart_port *port = (struct uart_port *) platform_get_drvdata(op); |
1397 | 1396 | ||
1398 | if (port) | 1397 | if (port) |
1399 | uart_resume_port(&mpc52xx_uart_driver, port); | 1398 | uart_resume_port(&mpc52xx_uart_driver, port); |
diff --git a/drivers/tty/serial/of_serial.c b/drivers/tty/serial/of_serial.c index 39c7ea4cb14f..2caf9c6f6149 100644 --- a/drivers/tty/serial/of_serial.c +++ b/drivers/tty/serial/of_serial.c | |||
@@ -204,7 +204,7 @@ static int of_platform_serial_probe(struct platform_device *ofdev) | |||
204 | 204 | ||
205 | info->type = port_type; | 205 | info->type = port_type; |
206 | info->line = ret; | 206 | info->line = ret; |
207 | dev_set_drvdata(&ofdev->dev, info); | 207 | platform_set_drvdata(ofdev, info); |
208 | return 0; | 208 | return 0; |
209 | out: | 209 | out: |
210 | kfree(info); | 210 | kfree(info); |
@@ -217,7 +217,7 @@ out: | |||
217 | */ | 217 | */ |
218 | static int of_platform_serial_remove(struct platform_device *ofdev) | 218 | static int of_platform_serial_remove(struct platform_device *ofdev) |
219 | { | 219 | { |
220 | struct of_serial_info *info = dev_get_drvdata(&ofdev->dev); | 220 | struct of_serial_info *info = platform_get_drvdata(ofdev); |
221 | switch (info->type) { | 221 | switch (info->type) { |
222 | #ifdef CONFIG_SERIAL_8250 | 222 | #ifdef CONFIG_SERIAL_8250 |
223 | case PORT_8250 ... PORT_MAX_8250: | 223 | case PORT_8250 ... PORT_MAX_8250: |
diff --git a/drivers/tty/serial/sc26xx.c b/drivers/tty/serial/sc26xx.c index c9735680762d..4b1434d53e9d 100644 --- a/drivers/tty/serial/sc26xx.c +++ b/drivers/tty/serial/sc26xx.c | |||
@@ -696,7 +696,7 @@ static int sc26xx_probe(struct platform_device *dev) | |||
696 | if (err) | 696 | if (err) |
697 | goto out_remove_ports; | 697 | goto out_remove_ports; |
698 | 698 | ||
699 | dev_set_drvdata(&dev->dev, up); | 699 | platform_set_drvdata(dev, up); |
700 | return 0; | 700 | return 0; |
701 | 701 | ||
702 | out_remove_ports: | 702 | out_remove_ports: |
@@ -716,7 +716,7 @@ out_free_port: | |||
716 | 716 | ||
717 | static int __exit sc26xx_driver_remove(struct platform_device *dev) | 717 | static int __exit sc26xx_driver_remove(struct platform_device *dev) |
718 | { | 718 | { |
719 | struct uart_sc26xx_port *up = dev_get_drvdata(&dev->dev); | 719 | struct uart_sc26xx_port *up = platform_get_drvdata(dev); |
720 | 720 | ||
721 | free_irq(up->port[0].irq, up); | 721 | free_irq(up->port[0].irq, up); |
722 | 722 | ||
@@ -728,7 +728,6 @@ static int __exit sc26xx_driver_remove(struct platform_device *dev) | |||
728 | kfree(up); | 728 | kfree(up); |
729 | sc26xx_port = NULL; | 729 | sc26xx_port = NULL; |
730 | 730 | ||
731 | dev_set_drvdata(&dev->dev, NULL); | ||
732 | return 0; | 731 | return 0; |
733 | } | 732 | } |
734 | 733 | ||
diff --git a/drivers/tty/serial/sunhv.c b/drivers/tty/serial/sunhv.c index ba60708053e0..cf86e729532b 100644 --- a/drivers/tty/serial/sunhv.c +++ b/drivers/tty/serial/sunhv.c | |||
@@ -577,7 +577,7 @@ static int hv_probe(struct platform_device *op) | |||
577 | if (err) | 577 | if (err) |
578 | goto out_remove_port; | 578 | goto out_remove_port; |
579 | 579 | ||
580 | dev_set_drvdata(&op->dev, port); | 580 | platform_set_drvdata(op, port); |
581 | 581 | ||
582 | return 0; | 582 | return 0; |
583 | 583 | ||
@@ -601,7 +601,7 @@ out_free_port: | |||
601 | 601 | ||
602 | static int hv_remove(struct platform_device *dev) | 602 | static int hv_remove(struct platform_device *dev) |
603 | { | 603 | { |
604 | struct uart_port *port = dev_get_drvdata(&dev->dev); | 604 | struct uart_port *port = platform_get_drvdata(dev); |
605 | 605 | ||
606 | free_irq(port->irq, port); | 606 | free_irq(port->irq, port); |
607 | 607 | ||
@@ -612,8 +612,6 @@ static int hv_remove(struct platform_device *dev) | |||
612 | kfree(port); | 612 | kfree(port); |
613 | sunhv_port = NULL; | 613 | sunhv_port = NULL; |
614 | 614 | ||
615 | dev_set_drvdata(&dev->dev, NULL); | ||
616 | |||
617 | return 0; | 615 | return 0; |
618 | } | 616 | } |
619 | 617 | ||
diff --git a/drivers/tty/serial/sunsab.c b/drivers/tty/serial/sunsab.c index a422c8b55a47..5d6136b2a04a 100644 --- a/drivers/tty/serial/sunsab.c +++ b/drivers/tty/serial/sunsab.c | |||
@@ -1037,7 +1037,7 @@ static int sab_probe(struct platform_device *op) | |||
1037 | if (err) | 1037 | if (err) |
1038 | goto out3; | 1038 | goto out3; |
1039 | 1039 | ||
1040 | dev_set_drvdata(&op->dev, &up[0]); | 1040 | platform_set_drvdata(op, &up[0]); |
1041 | 1041 | ||
1042 | inst++; | 1042 | inst++; |
1043 | 1043 | ||
@@ -1059,7 +1059,7 @@ out: | |||
1059 | 1059 | ||
1060 | static int sab_remove(struct platform_device *op) | 1060 | static int sab_remove(struct platform_device *op) |
1061 | { | 1061 | { |
1062 | struct uart_sunsab_port *up = dev_get_drvdata(&op->dev); | 1062 | struct uart_sunsab_port *up = platform_get_drvdata(op); |
1063 | 1063 | ||
1064 | uart_remove_one_port(&sunsab_reg, &up[1].port); | 1064 | uart_remove_one_port(&sunsab_reg, &up[1].port); |
1065 | uart_remove_one_port(&sunsab_reg, &up[0].port); | 1065 | uart_remove_one_port(&sunsab_reg, &up[0].port); |
@@ -1070,8 +1070,6 @@ static int sab_remove(struct platform_device *op) | |||
1070 | up[0].port.membase, | 1070 | up[0].port.membase, |
1071 | sizeof(union sab82532_async_regs)); | 1071 | sizeof(union sab82532_async_regs)); |
1072 | 1072 | ||
1073 | dev_set_drvdata(&op->dev, NULL); | ||
1074 | |||
1075 | return 0; | 1073 | return 0; |
1076 | } | 1074 | } |
1077 | 1075 | ||
diff --git a/drivers/tty/serial/sunsu.c b/drivers/tty/serial/sunsu.c index 0d8465728473..699cc1b5f6aa 100644 --- a/drivers/tty/serial/sunsu.c +++ b/drivers/tty/serial/sunsu.c | |||
@@ -1454,7 +1454,7 @@ static int su_probe(struct platform_device *op) | |||
1454 | kfree(up); | 1454 | kfree(up); |
1455 | return err; | 1455 | return err; |
1456 | } | 1456 | } |
1457 | dev_set_drvdata(&op->dev, up); | 1457 | platform_set_drvdata(op, up); |
1458 | 1458 | ||
1459 | nr_inst++; | 1459 | nr_inst++; |
1460 | 1460 | ||
@@ -1483,7 +1483,7 @@ static int su_probe(struct platform_device *op) | |||
1483 | if (err) | 1483 | if (err) |
1484 | goto out_unmap; | 1484 | goto out_unmap; |
1485 | 1485 | ||
1486 | dev_set_drvdata(&op->dev, up); | 1486 | platform_set_drvdata(op, up); |
1487 | 1487 | ||
1488 | nr_inst++; | 1488 | nr_inst++; |
1489 | 1489 | ||
@@ -1496,7 +1496,7 @@ out_unmap: | |||
1496 | 1496 | ||
1497 | static int su_remove(struct platform_device *op) | 1497 | static int su_remove(struct platform_device *op) |
1498 | { | 1498 | { |
1499 | struct uart_sunsu_port *up = dev_get_drvdata(&op->dev); | 1499 | struct uart_sunsu_port *up = platform_get_drvdata(op); |
1500 | bool kbdms = false; | 1500 | bool kbdms = false; |
1501 | 1501 | ||
1502 | if (up->su_type == SU_PORT_MS || | 1502 | if (up->su_type == SU_PORT_MS || |
@@ -1516,8 +1516,6 @@ static int su_remove(struct platform_device *op) | |||
1516 | if (kbdms) | 1516 | if (kbdms) |
1517 | kfree(up); | 1517 | kfree(up); |
1518 | 1518 | ||
1519 | dev_set_drvdata(&op->dev, NULL); | ||
1520 | |||
1521 | return 0; | 1519 | return 0; |
1522 | } | 1520 | } |
1523 | 1521 | ||
diff --git a/drivers/tty/serial/sunzilog.c b/drivers/tty/serial/sunzilog.c index 813ef8eb8eff..135a15203532 100644 --- a/drivers/tty/serial/sunzilog.c +++ b/drivers/tty/serial/sunzilog.c | |||
@@ -1495,7 +1495,7 @@ static int zs_probe(struct platform_device *op) | |||
1495 | kbm_inst++; | 1495 | kbm_inst++; |
1496 | } | 1496 | } |
1497 | 1497 | ||
1498 | dev_set_drvdata(&op->dev, &up[0]); | 1498 | platform_set_drvdata(op, &up[0]); |
1499 | 1499 | ||
1500 | return 0; | 1500 | return 0; |
1501 | } | 1501 | } |
@@ -1512,7 +1512,7 @@ static void zs_remove_one(struct uart_sunzilog_port *up) | |||
1512 | 1512 | ||
1513 | static int zs_remove(struct platform_device *op) | 1513 | static int zs_remove(struct platform_device *op) |
1514 | { | 1514 | { |
1515 | struct uart_sunzilog_port *up = dev_get_drvdata(&op->dev); | 1515 | struct uart_sunzilog_port *up = platform_get_drvdata(op); |
1516 | struct zilog_layout __iomem *regs; | 1516 | struct zilog_layout __iomem *regs; |
1517 | 1517 | ||
1518 | zs_remove_one(&up[0]); | 1518 | zs_remove_one(&up[0]); |
@@ -1521,8 +1521,6 @@ static int zs_remove(struct platform_device *op) | |||
1521 | regs = sunzilog_chip_regs[up[0].port.line / 2]; | 1521 | regs = sunzilog_chip_regs[up[0].port.line / 2]; |
1522 | of_iounmap(&op->resource[0], regs, sizeof(struct zilog_layout)); | 1522 | of_iounmap(&op->resource[0], regs, sizeof(struct zilog_layout)); |
1523 | 1523 | ||
1524 | dev_set_drvdata(&op->dev, NULL); | ||
1525 | |||
1526 | return 0; | 1524 | return 0; |
1527 | } | 1525 | } |
1528 | 1526 | ||
diff --git a/drivers/tty/serial/ucc_uart.c b/drivers/tty/serial/ucc_uart.c index 7355303dad99..c8ab8e45e1b9 100644 --- a/drivers/tty/serial/ucc_uart.c +++ b/drivers/tty/serial/ucc_uart.c | |||
@@ -1451,7 +1451,7 @@ static int ucc_uart_probe(struct platform_device *ofdev) | |||
1451 | goto out_np; | 1451 | goto out_np; |
1452 | } | 1452 | } |
1453 | 1453 | ||
1454 | dev_set_drvdata(&ofdev->dev, qe_port); | 1454 | platform_set_drvdata(ofdev, qe_port); |
1455 | 1455 | ||
1456 | dev_info(&ofdev->dev, "UCC%u assigned to /dev/ttyQE%u\n", | 1456 | dev_info(&ofdev->dev, "UCC%u assigned to /dev/ttyQE%u\n", |
1457 | qe_port->ucc_num + 1, qe_port->port.line); | 1457 | qe_port->ucc_num + 1, qe_port->port.line); |
@@ -1471,13 +1471,12 @@ out_free: | |||
1471 | 1471 | ||
1472 | static int ucc_uart_remove(struct platform_device *ofdev) | 1472 | static int ucc_uart_remove(struct platform_device *ofdev) |
1473 | { | 1473 | { |
1474 | struct uart_qe_port *qe_port = dev_get_drvdata(&ofdev->dev); | 1474 | struct uart_qe_port *qe_port = platform_get_drvdata(ofdev); |
1475 | 1475 | ||
1476 | dev_info(&ofdev->dev, "removing /dev/ttyQE%u\n", qe_port->port.line); | 1476 | dev_info(&ofdev->dev, "removing /dev/ttyQE%u\n", qe_port->port.line); |
1477 | 1477 | ||
1478 | uart_remove_one_port(&ucc_uart_driver, &qe_port->port); | 1478 | uart_remove_one_port(&ucc_uart_driver, &qe_port->port); |
1479 | 1479 | ||
1480 | dev_set_drvdata(&ofdev->dev, NULL); | ||
1481 | kfree(qe_port); | 1480 | kfree(qe_port); |
1482 | 1481 | ||
1483 | return 0; | 1482 | return 0; |
diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index b5f655d10098..6c9174530422 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c | |||
@@ -974,12 +974,11 @@ static int xuartps_probe(struct platform_device *pdev) | |||
974 | port->dev = &pdev->dev; | 974 | port->dev = &pdev->dev; |
975 | port->uartclk = clk_get_rate(clk); | 975 | port->uartclk = clk_get_rate(clk); |
976 | port->private_data = clk; | 976 | port->private_data = clk; |
977 | dev_set_drvdata(&pdev->dev, port); | 977 | platform_set_drvdata(pdev, port); |
978 | rc = uart_add_one_port(&xuartps_uart_driver, port); | 978 | rc = uart_add_one_port(&xuartps_uart_driver, port); |
979 | if (rc) { | 979 | if (rc) { |
980 | dev_err(&pdev->dev, | 980 | dev_err(&pdev->dev, |
981 | "uart_add_one_port() failed; err=%i\n", rc); | 981 | "uart_add_one_port() failed; err=%i\n", rc); |
982 | dev_set_drvdata(&pdev->dev, NULL); | ||
983 | return rc; | 982 | return rc; |
984 | } | 983 | } |
985 | return 0; | 984 | return 0; |
@@ -994,13 +993,12 @@ static int xuartps_probe(struct platform_device *pdev) | |||
994 | **/ | 993 | **/ |
995 | static int xuartps_remove(struct platform_device *pdev) | 994 | static int xuartps_remove(struct platform_device *pdev) |
996 | { | 995 | { |
997 | struct uart_port *port = dev_get_drvdata(&pdev->dev); | 996 | struct uart_port *port = platform_get_drvdata(pdev); |
998 | struct clk *clk = port->private_data; | 997 | struct clk *clk = port->private_data; |
999 | int rc; | 998 | int rc; |
1000 | 999 | ||
1001 | /* Remove the xuartps port from the serial core */ | 1000 | /* Remove the xuartps port from the serial core */ |
1002 | rc = uart_remove_one_port(&xuartps_uart_driver, port); | 1001 | rc = uart_remove_one_port(&xuartps_uart_driver, port); |
1003 | dev_set_drvdata(&pdev->dev, NULL); | ||
1004 | port->mapbase = 0; | 1002 | port->mapbase = 0; |
1005 | clk_disable_unprepare(clk); | 1003 | clk_disable_unprepare(clk); |
1006 | return rc; | 1004 | return rc; |