diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2005-11-09 17:32:44 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2005-11-09 17:32:44 -0500 |
commit | 3ae5eaec1d2d9c0cf53745352e7d4b152810ba24 (patch) | |
tree | d8825be54cefb6ad6707478d719c8e30605bee7b /drivers/serial | |
parent | 00d3dcdd96646be6059cc21f2efa94c4edc1eda5 (diff) |
[DRIVER MODEL] Convert platform drivers to use struct platform_driver
This allows us to eliminate the casts in the drivers, and eventually
remove the use of the device_driver function pointer methods for
platform device drivers.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/serial')
-rw-r--r-- | drivers/serial/8250.c | 31 | ||||
-rw-r--r-- | drivers/serial/imx.c | 31 | ||||
-rw-r--r-- | drivers/serial/mpc52xx_uart.c | 32 | ||||
-rw-r--r-- | drivers/serial/mpsc.c | 65 | ||||
-rw-r--r-- | drivers/serial/pxa.c | 33 | ||||
-rw-r--r-- | drivers/serial/s3c2410.c | 62 | ||||
-rw-r--r-- | drivers/serial/sa1100.c | 32 | ||||
-rw-r--r-- | drivers/serial/vr41xx_siu.c | 27 |
8 files changed, 156 insertions, 157 deletions
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c index 98820603e75f..3742753241ee 100644 --- a/drivers/serial/8250.c +++ b/drivers/serial/8250.c | |||
@@ -2381,9 +2381,9 @@ void serial8250_resume_port(int line) | |||
2381 | * list is terminated with a zero flags entry, which means we expect | 2381 | * list is terminated with a zero flags entry, which means we expect |
2382 | * all entries to have at least UPF_BOOT_AUTOCONF set. | 2382 | * all entries to have at least UPF_BOOT_AUTOCONF set. |
2383 | */ | 2383 | */ |
2384 | static int __devinit serial8250_probe(struct device *dev) | 2384 | static int __devinit serial8250_probe(struct platform_device *dev) |
2385 | { | 2385 | { |
2386 | struct plat_serial8250_port *p = dev->platform_data; | 2386 | struct plat_serial8250_port *p = dev->dev.platform_data; |
2387 | struct uart_port port; | 2387 | struct uart_port port; |
2388 | int ret, i; | 2388 | int ret, i; |
2389 | 2389 | ||
@@ -2399,12 +2399,12 @@ static int __devinit serial8250_probe(struct device *dev) | |||
2399 | port.flags = p->flags; | 2399 | port.flags = p->flags; |
2400 | port.mapbase = p->mapbase; | 2400 | port.mapbase = p->mapbase; |
2401 | port.hub6 = p->hub6; | 2401 | port.hub6 = p->hub6; |
2402 | port.dev = dev; | 2402 | port.dev = &dev->dev; |
2403 | if (share_irqs) | 2403 | if (share_irqs) |
2404 | port.flags |= UPF_SHARE_IRQ; | 2404 | port.flags |= UPF_SHARE_IRQ; |
2405 | ret = serial8250_register_port(&port); | 2405 | ret = serial8250_register_port(&port); |
2406 | if (ret < 0) { | 2406 | if (ret < 0) { |
2407 | dev_err(dev, "unable to register port at index %d " | 2407 | dev_err(&dev->dev, "unable to register port at index %d " |
2408 | "(IO%lx MEM%lx IRQ%d): %d\n", i, | 2408 | "(IO%lx MEM%lx IRQ%d): %d\n", i, |
2409 | p->iobase, p->mapbase, p->irq, ret); | 2409 | p->iobase, p->mapbase, p->irq, ret); |
2410 | } | 2410 | } |
@@ -2415,54 +2415,55 @@ static int __devinit serial8250_probe(struct device *dev) | |||
2415 | /* | 2415 | /* |
2416 | * Remove serial ports registered against a platform device. | 2416 | * Remove serial ports registered against a platform device. |
2417 | */ | 2417 | */ |
2418 | static int __devexit serial8250_remove(struct device *dev) | 2418 | static int __devexit serial8250_remove(struct platform_device *dev) |
2419 | { | 2419 | { |
2420 | int i; | 2420 | int i; |
2421 | 2421 | ||
2422 | for (i = 0; i < UART_NR; i++) { | 2422 | for (i = 0; i < UART_NR; i++) { |
2423 | struct uart_8250_port *up = &serial8250_ports[i]; | 2423 | struct uart_8250_port *up = &serial8250_ports[i]; |
2424 | 2424 | ||
2425 | if (up->port.dev == dev) | 2425 | if (up->port.dev == &dev->dev) |
2426 | serial8250_unregister_port(i); | 2426 | serial8250_unregister_port(i); |
2427 | } | 2427 | } |
2428 | return 0; | 2428 | return 0; |
2429 | } | 2429 | } |
2430 | 2430 | ||
2431 | static int serial8250_suspend(struct device *dev, pm_message_t state) | 2431 | static int serial8250_suspend(struct platform_device *dev, pm_message_t state) |
2432 | { | 2432 | { |
2433 | int i; | 2433 | int i; |
2434 | 2434 | ||
2435 | for (i = 0; i < UART_NR; i++) { | 2435 | for (i = 0; i < UART_NR; i++) { |
2436 | struct uart_8250_port *up = &serial8250_ports[i]; | 2436 | struct uart_8250_port *up = &serial8250_ports[i]; |
2437 | 2437 | ||
2438 | if (up->port.type != PORT_UNKNOWN && up->port.dev == dev) | 2438 | if (up->port.type != PORT_UNKNOWN && up->port.dev == &dev->dev) |
2439 | uart_suspend_port(&serial8250_reg, &up->port); | 2439 | uart_suspend_port(&serial8250_reg, &up->port); |
2440 | } | 2440 | } |
2441 | 2441 | ||
2442 | return 0; | 2442 | return 0; |
2443 | } | 2443 | } |
2444 | 2444 | ||
2445 | static int serial8250_resume(struct device *dev) | 2445 | static int serial8250_resume(struct platform_device *dev) |
2446 | { | 2446 | { |
2447 | int i; | 2447 | int i; |
2448 | 2448 | ||
2449 | for (i = 0; i < UART_NR; i++) { | 2449 | for (i = 0; i < UART_NR; i++) { |
2450 | struct uart_8250_port *up = &serial8250_ports[i]; | 2450 | struct uart_8250_port *up = &serial8250_ports[i]; |
2451 | 2451 | ||
2452 | if (up->port.type != PORT_UNKNOWN && up->port.dev == dev) | 2452 | if (up->port.type != PORT_UNKNOWN && up->port.dev == &dev->dev) |
2453 | uart_resume_port(&serial8250_reg, &up->port); | 2453 | uart_resume_port(&serial8250_reg, &up->port); |
2454 | } | 2454 | } |
2455 | 2455 | ||
2456 | return 0; | 2456 | return 0; |
2457 | } | 2457 | } |
2458 | 2458 | ||
2459 | static struct device_driver serial8250_isa_driver = { | 2459 | static struct platform_driver serial8250_isa_driver = { |
2460 | .name = "serial8250", | ||
2461 | .bus = &platform_bus_type, | ||
2462 | .probe = serial8250_probe, | 2460 | .probe = serial8250_probe, |
2463 | .remove = __devexit_p(serial8250_remove), | 2461 | .remove = __devexit_p(serial8250_remove), |
2464 | .suspend = serial8250_suspend, | 2462 | .suspend = serial8250_suspend, |
2465 | .resume = serial8250_resume, | 2463 | .resume = serial8250_resume, |
2464 | .driver = { | ||
2465 | .name = "serial8250", | ||
2466 | }, | ||
2466 | }; | 2467 | }; |
2467 | 2468 | ||
2468 | /* | 2469 | /* |
@@ -2608,7 +2609,7 @@ static int __init serial8250_init(void) | |||
2608 | 2609 | ||
2609 | serial8250_register_ports(&serial8250_reg, &serial8250_isa_devs->dev); | 2610 | serial8250_register_ports(&serial8250_reg, &serial8250_isa_devs->dev); |
2610 | 2611 | ||
2611 | ret = driver_register(&serial8250_isa_driver); | 2612 | ret = platform_driver_register(&serial8250_isa_driver); |
2612 | if (ret == 0) | 2613 | if (ret == 0) |
2613 | goto out; | 2614 | goto out; |
2614 | 2615 | ||
@@ -2630,7 +2631,7 @@ static void __exit serial8250_exit(void) | |||
2630 | */ | 2631 | */ |
2631 | serial8250_isa_devs = NULL; | 2632 | serial8250_isa_devs = NULL; |
2632 | 2633 | ||
2633 | driver_unregister(&serial8250_isa_driver); | 2634 | platform_driver_unregister(&serial8250_isa_driver); |
2634 | platform_device_unregister(isa_dev); | 2635 | platform_device_unregister(isa_dev); |
2635 | 2636 | ||
2636 | uart_unregister_driver(&serial8250_reg); | 2637 | uart_unregister_driver(&serial8250_reg); |
diff --git a/drivers/serial/imx.c b/drivers/serial/imx.c index 4a54ff584700..355cd93a8a87 100644 --- a/drivers/serial/imx.c +++ b/drivers/serial/imx.c | |||
@@ -921,9 +921,9 @@ static struct uart_driver imx_reg = { | |||
921 | .cons = IMX_CONSOLE, | 921 | .cons = IMX_CONSOLE, |
922 | }; | 922 | }; |
923 | 923 | ||
924 | static int serial_imx_suspend(struct device *_dev, pm_message_t state) | 924 | static int serial_imx_suspend(struct platform_device *dev, pm_message_t state) |
925 | { | 925 | { |
926 | struct imx_port *sport = dev_get_drvdata(_dev); | 926 | struct imx_port *sport = platform_get_drvdata(dev); |
927 | 927 | ||
928 | if (sport) | 928 | if (sport) |
929 | uart_suspend_port(&imx_reg, &sport->port); | 929 | uart_suspend_port(&imx_reg, &sport->port); |
@@ -931,9 +931,9 @@ static int serial_imx_suspend(struct device *_dev, pm_message_t state) | |||
931 | return 0; | 931 | return 0; |
932 | } | 932 | } |
933 | 933 | ||
934 | static int serial_imx_resume(struct device *_dev) | 934 | static int serial_imx_resume(struct platform_device *dev) |
935 | { | 935 | { |
936 | struct imx_port *sport = dev_get_drvdata(_dev); | 936 | struct imx_port *sport = platform_get_drvdata(dev); |
937 | 937 | ||
938 | if (sport) | 938 | if (sport) |
939 | uart_resume_port(&imx_reg, &sport->port); | 939 | uart_resume_port(&imx_reg, &sport->port); |
@@ -941,21 +941,19 @@ static int serial_imx_resume(struct device *_dev) | |||
941 | return 0; | 941 | return 0; |
942 | } | 942 | } |
943 | 943 | ||
944 | static int serial_imx_probe(struct device *_dev) | 944 | static int serial_imx_probe(struct platform_device *dev) |
945 | { | 945 | { |
946 | struct platform_device *dev = to_platform_device(_dev); | 946 | imx_ports[dev->id].port.dev = &dev->dev; |
947 | |||
948 | imx_ports[dev->id].port.dev = _dev; | ||
949 | uart_add_one_port(&imx_reg, &imx_ports[dev->id].port); | 947 | uart_add_one_port(&imx_reg, &imx_ports[dev->id].port); |
950 | dev_set_drvdata(_dev, &imx_ports[dev->id]); | 948 | platform_set_drvdata(dev, &imx_ports[dev->id]); |
951 | return 0; | 949 | return 0; |
952 | } | 950 | } |
953 | 951 | ||
954 | static int serial_imx_remove(struct device *_dev) | 952 | static int serial_imx_remove(struct platform_device *dev) |
955 | { | 953 | { |
956 | struct imx_port *sport = dev_get_drvdata(_dev); | 954 | struct imx_port *sport = platform_get_drvdata(dev); |
957 | 955 | ||
958 | dev_set_drvdata(_dev, NULL); | 956 | platform_set_drvdata(dev, NULL); |
959 | 957 | ||
960 | if (sport) | 958 | if (sport) |
961 | uart_remove_one_port(&imx_reg, &sport->port); | 959 | uart_remove_one_port(&imx_reg, &sport->port); |
@@ -963,14 +961,15 @@ static int serial_imx_remove(struct device *_dev) | |||
963 | return 0; | 961 | return 0; |
964 | } | 962 | } |
965 | 963 | ||
966 | static struct device_driver serial_imx_driver = { | 964 | static struct platform_driver serial_imx_driver = { |
967 | .name = "imx-uart", | ||
968 | .bus = &platform_bus_type, | ||
969 | .probe = serial_imx_probe, | 965 | .probe = serial_imx_probe, |
970 | .remove = serial_imx_remove, | 966 | .remove = serial_imx_remove, |
971 | 967 | ||
972 | .suspend = serial_imx_suspend, | 968 | .suspend = serial_imx_suspend, |
973 | .resume = serial_imx_resume, | 969 | .resume = serial_imx_resume, |
970 | .driver = { | ||
971 | .name = "imx-uart", | ||
972 | }, | ||
974 | }; | 973 | }; |
975 | 974 | ||
976 | static int __init imx_serial_init(void) | 975 | static int __init imx_serial_init(void) |
@@ -985,7 +984,7 @@ static int __init imx_serial_init(void) | |||
985 | if (ret) | 984 | if (ret) |
986 | return ret; | 985 | return ret; |
987 | 986 | ||
988 | ret = driver_register(&serial_imx_driver); | 987 | ret = platform_driver_register(&serial_imx_driver); |
989 | if (ret != 0) | 988 | if (ret != 0) |
990 | uart_unregister_driver(&imx_reg); | 989 | uart_unregister_driver(&imx_reg); |
991 | 990 | ||
diff --git a/drivers/serial/mpc52xx_uart.c b/drivers/serial/mpc52xx_uart.c index 0dd08a09e7e6..5d3cb8486447 100644 --- a/drivers/serial/mpc52xx_uart.c +++ b/drivers/serial/mpc52xx_uart.c | |||
@@ -717,10 +717,9 @@ static struct uart_driver mpc52xx_uart_driver = { | |||
717 | /* ======================================================================== */ | 717 | /* ======================================================================== */ |
718 | 718 | ||
719 | static int __devinit | 719 | static int __devinit |
720 | mpc52xx_uart_probe(struct device *dev) | 720 | mpc52xx_uart_probe(struct platform_device *dev) |
721 | { | 721 | { |
722 | struct platform_device *pdev = to_platform_device(dev); | 722 | struct resource *res = dev->resource; |
723 | struct resource *res = pdev->resource; | ||
724 | 723 | ||
725 | struct uart_port *port = NULL; | 724 | struct uart_port *port = NULL; |
726 | int i, idx, ret; | 725 | int i, idx, ret; |
@@ -761,17 +760,17 @@ mpc52xx_uart_probe(struct device *dev) | |||
761 | /* Add the port to the uart sub-system */ | 760 | /* Add the port to the uart sub-system */ |
762 | ret = uart_add_one_port(&mpc52xx_uart_driver, port); | 761 | ret = uart_add_one_port(&mpc52xx_uart_driver, port); |
763 | if (!ret) | 762 | if (!ret) |
764 | dev_set_drvdata(dev, (void*)port); | 763 | platform_set_drvdata(dev, (void*)port); |
765 | 764 | ||
766 | return ret; | 765 | return ret; |
767 | } | 766 | } |
768 | 767 | ||
769 | static int | 768 | static int |
770 | mpc52xx_uart_remove(struct device *dev) | 769 | mpc52xx_uart_remove(struct platform_device *dev) |
771 | { | 770 | { |
772 | struct uart_port *port = (struct uart_port *) dev_get_drvdata(dev); | 771 | struct uart_port *port = (struct uart_port *) platform_get_drvdata(dev); |
773 | 772 | ||
774 | dev_set_drvdata(dev, NULL); | 773 | platform_set_drvdata(dev, NULL); |
775 | 774 | ||
776 | if (port) | 775 | if (port) |
777 | uart_remove_one_port(&mpc52xx_uart_driver, port); | 776 | uart_remove_one_port(&mpc52xx_uart_driver, port); |
@@ -781,9 +780,9 @@ mpc52xx_uart_remove(struct device *dev) | |||
781 | 780 | ||
782 | #ifdef CONFIG_PM | 781 | #ifdef CONFIG_PM |
783 | static int | 782 | static int |
784 | mpc52xx_uart_suspend(struct device *dev, pm_message_t state) | 783 | mpc52xx_uart_suspend(struct platform_device *dev, pm_message_t state) |
785 | { | 784 | { |
786 | struct uart_port *port = (struct uart_port *) dev_get_drvdata(dev); | 785 | struct uart_port *port = (struct uart_port *) platform_get_drvdata(dev); |
787 | 786 | ||
788 | if (sport) | 787 | if (sport) |
789 | uart_suspend_port(&mpc52xx_uart_driver, port); | 788 | uart_suspend_port(&mpc52xx_uart_driver, port); |
@@ -792,9 +791,9 @@ mpc52xx_uart_suspend(struct device *dev, pm_message_t state) | |||
792 | } | 791 | } |
793 | 792 | ||
794 | static int | 793 | static int |
795 | mpc52xx_uart_resume(struct device *dev) | 794 | mpc52xx_uart_resume(struct platform_device *dev) |
796 | { | 795 | { |
797 | struct uart_port *port = (struct uart_port *) dev_get_drvdata(dev); | 796 | struct uart_port *port = (struct uart_port *) platform_get_drvdata(dev); |
798 | 797 | ||
799 | if (port) | 798 | if (port) |
800 | uart_resume_port(&mpc52xx_uart_driver, port); | 799 | uart_resume_port(&mpc52xx_uart_driver, port); |
@@ -803,15 +802,16 @@ mpc52xx_uart_resume(struct device *dev) | |||
803 | } | 802 | } |
804 | #endif | 803 | #endif |
805 | 804 | ||
806 | static struct device_driver mpc52xx_uart_platform_driver = { | 805 | static struct platform_driver mpc52xx_uart_platform_driver = { |
807 | .name = "mpc52xx-psc", | ||
808 | .bus = &platform_bus_type, | ||
809 | .probe = mpc52xx_uart_probe, | 806 | .probe = mpc52xx_uart_probe, |
810 | .remove = mpc52xx_uart_remove, | 807 | .remove = mpc52xx_uart_remove, |
811 | #ifdef CONFIG_PM | 808 | #ifdef CONFIG_PM |
812 | .suspend = mpc52xx_uart_suspend, | 809 | .suspend = mpc52xx_uart_suspend, |
813 | .resume = mpc52xx_uart_resume, | 810 | .resume = mpc52xx_uart_resume, |
814 | #endif | 811 | #endif |
812 | .driver = { | ||
813 | .name = "mpc52xx-psc", | ||
814 | }, | ||
815 | }; | 815 | }; |
816 | 816 | ||
817 | 817 | ||
@@ -828,7 +828,7 @@ mpc52xx_uart_init(void) | |||
828 | 828 | ||
829 | ret = uart_register_driver(&mpc52xx_uart_driver); | 829 | ret = uart_register_driver(&mpc52xx_uart_driver); |
830 | if (ret == 0) { | 830 | if (ret == 0) { |
831 | ret = driver_register(&mpc52xx_uart_platform_driver); | 831 | ret = platform_driver_register(&mpc52xx_uart_platform_driver); |
832 | if (ret) | 832 | if (ret) |
833 | uart_unregister_driver(&mpc52xx_uart_driver); | 833 | uart_unregister_driver(&mpc52xx_uart_driver); |
834 | } | 834 | } |
@@ -839,7 +839,7 @@ mpc52xx_uart_init(void) | |||
839 | static void __exit | 839 | static void __exit |
840 | mpc52xx_uart_exit(void) | 840 | mpc52xx_uart_exit(void) |
841 | { | 841 | { |
842 | driver_unregister(&mpc52xx_uart_platform_driver); | 842 | platform_driver_unregister(&mpc52xx_uart_platform_driver); |
843 | uart_unregister_driver(&mpc52xx_uart_driver); | 843 | uart_unregister_driver(&mpc52xx_uart_driver); |
844 | } | 844 | } |
845 | 845 | ||
diff --git a/drivers/serial/mpsc.c b/drivers/serial/mpsc.c index ba8838b234da..8f83e4007ecd 100644 --- a/drivers/serial/mpsc.c +++ b/drivers/serial/mpsc.c | |||
@@ -1551,15 +1551,14 @@ mpsc_shared_unmap_regs(void) | |||
1551 | } | 1551 | } |
1552 | 1552 | ||
1553 | static int | 1553 | static int |
1554 | mpsc_shared_drv_probe(struct device *dev) | 1554 | mpsc_shared_drv_probe(struct platform_device *dev) |
1555 | { | 1555 | { |
1556 | struct platform_device *pd = to_platform_device(dev); | ||
1557 | struct mpsc_shared_pdata *pdata; | 1556 | struct mpsc_shared_pdata *pdata; |
1558 | int rc = -ENODEV; | 1557 | int rc = -ENODEV; |
1559 | 1558 | ||
1560 | if (pd->id == 0) { | 1559 | if (dev->id == 0) { |
1561 | if (!(rc = mpsc_shared_map_regs(pd))) { | 1560 | if (!(rc = mpsc_shared_map_regs(dev))) { |
1562 | pdata = (struct mpsc_shared_pdata *)dev->platform_data; | 1561 | pdata = (struct mpsc_shared_pdata *)dev->dev.platform_data; |
1563 | 1562 | ||
1564 | mpsc_shared_regs.MPSC_MRR_m = pdata->mrr_val; | 1563 | mpsc_shared_regs.MPSC_MRR_m = pdata->mrr_val; |
1565 | mpsc_shared_regs.MPSC_RCRR_m= pdata->rcrr_val; | 1564 | mpsc_shared_regs.MPSC_RCRR_m= pdata->rcrr_val; |
@@ -1577,12 +1576,11 @@ mpsc_shared_drv_probe(struct device *dev) | |||
1577 | } | 1576 | } |
1578 | 1577 | ||
1579 | static int | 1578 | static int |
1580 | mpsc_shared_drv_remove(struct device *dev) | 1579 | mpsc_shared_drv_remove(struct platform_device *dev) |
1581 | { | 1580 | { |
1582 | struct platform_device *pd = to_platform_device(dev); | ||
1583 | int rc = -ENODEV; | 1581 | int rc = -ENODEV; |
1584 | 1582 | ||
1585 | if (pd->id == 0) { | 1583 | if (dev->id == 0) { |
1586 | mpsc_shared_unmap_regs(); | 1584 | mpsc_shared_unmap_regs(); |
1587 | mpsc_shared_regs.MPSC_MRR_m = 0; | 1585 | mpsc_shared_regs.MPSC_MRR_m = 0; |
1588 | mpsc_shared_regs.MPSC_RCRR_m = 0; | 1586 | mpsc_shared_regs.MPSC_RCRR_m = 0; |
@@ -1595,11 +1593,12 @@ mpsc_shared_drv_remove(struct device *dev) | |||
1595 | return rc; | 1593 | return rc; |
1596 | } | 1594 | } |
1597 | 1595 | ||
1598 | static struct device_driver mpsc_shared_driver = { | 1596 | static struct platform_driver mpsc_shared_driver = { |
1599 | .name = MPSC_SHARED_NAME, | ||
1600 | .bus = &platform_bus_type, | ||
1601 | .probe = mpsc_shared_drv_probe, | 1597 | .probe = mpsc_shared_drv_probe, |
1602 | .remove = mpsc_shared_drv_remove, | 1598 | .remove = mpsc_shared_drv_remove, |
1599 | .driver = { | ||
1600 | .name = MPSC_SHARED_NAME, | ||
1601 | }, | ||
1603 | }; | 1602 | }; |
1604 | 1603 | ||
1605 | /* | 1604 | /* |
@@ -1732,19 +1731,18 @@ mpsc_drv_get_platform_data(struct mpsc_port_info *pi, | |||
1732 | } | 1731 | } |
1733 | 1732 | ||
1734 | static int | 1733 | static int |
1735 | mpsc_drv_probe(struct device *dev) | 1734 | mpsc_drv_probe(struct platform_device *dev) |
1736 | { | 1735 | { |
1737 | struct platform_device *pd = to_platform_device(dev); | ||
1738 | struct mpsc_port_info *pi; | 1736 | struct mpsc_port_info *pi; |
1739 | int rc = -ENODEV; | 1737 | int rc = -ENODEV; |
1740 | 1738 | ||
1741 | pr_debug("mpsc_drv_probe: Adding MPSC %d\n", pd->id); | 1739 | pr_debug("mpsc_drv_probe: Adding MPSC %d\n", dev->id); |
1742 | 1740 | ||
1743 | if (pd->id < MPSC_NUM_CTLRS) { | 1741 | if (dev->id < MPSC_NUM_CTLRS) { |
1744 | pi = &mpsc_ports[pd->id]; | 1742 | pi = &mpsc_ports[dev->id]; |
1745 | 1743 | ||
1746 | if (!(rc = mpsc_drv_map_regs(pi, pd))) { | 1744 | if (!(rc = mpsc_drv_map_regs(pi, dev))) { |
1747 | mpsc_drv_get_platform_data(pi, pd, pd->id); | 1745 | mpsc_drv_get_platform_data(pi, dev, dev->id); |
1748 | 1746 | ||
1749 | if (!(rc = mpsc_make_ready(pi))) | 1747 | if (!(rc = mpsc_make_ready(pi))) |
1750 | if (!(rc = uart_add_one_port(&mpsc_reg, | 1748 | if (!(rc = uart_add_one_port(&mpsc_reg, |
@@ -1764,27 +1762,26 @@ mpsc_drv_probe(struct device *dev) | |||
1764 | } | 1762 | } |
1765 | 1763 | ||
1766 | static int | 1764 | static int |
1767 | mpsc_drv_remove(struct device *dev) | 1765 | mpsc_drv_remove(struct platform_device *dev) |
1768 | { | 1766 | { |
1769 | struct platform_device *pd = to_platform_device(dev); | 1767 | pr_debug("mpsc_drv_exit: Removing MPSC %d\n", dev->id); |
1770 | 1768 | ||
1771 | pr_debug("mpsc_drv_exit: Removing MPSC %d\n", pd->id); | 1769 | if (dev->id < MPSC_NUM_CTLRS) { |
1772 | 1770 | uart_remove_one_port(&mpsc_reg, &mpsc_ports[dev->id].port); | |
1773 | if (pd->id < MPSC_NUM_CTLRS) { | 1771 | mpsc_release_port((struct uart_port *)&mpsc_ports[dev->id].port); |
1774 | uart_remove_one_port(&mpsc_reg, &mpsc_ports[pd->id].port); | 1772 | mpsc_drv_unmap_regs(&mpsc_ports[dev->id]); |
1775 | mpsc_release_port((struct uart_port *)&mpsc_ports[pd->id].port); | ||
1776 | mpsc_drv_unmap_regs(&mpsc_ports[pd->id]); | ||
1777 | return 0; | 1773 | return 0; |
1778 | } | 1774 | } |
1779 | else | 1775 | else |
1780 | return -ENODEV; | 1776 | return -ENODEV; |
1781 | } | 1777 | } |
1782 | 1778 | ||
1783 | static struct device_driver mpsc_driver = { | 1779 | static struct platform_driver mpsc_driver = { |
1784 | .name = MPSC_CTLR_NAME, | ||
1785 | .bus = &platform_bus_type, | ||
1786 | .probe = mpsc_drv_probe, | 1780 | .probe = mpsc_drv_probe, |
1787 | .remove = mpsc_drv_remove, | 1781 | .remove = mpsc_drv_remove, |
1782 | .driver = { | ||
1783 | .name = MPSC_CTLR_NAME, | ||
1784 | }, | ||
1788 | }; | 1785 | }; |
1789 | 1786 | ||
1790 | static int __init | 1787 | static int __init |
@@ -1798,9 +1795,9 @@ mpsc_drv_init(void) | |||
1798 | memset(&mpsc_shared_regs, 0, sizeof(mpsc_shared_regs)); | 1795 | memset(&mpsc_shared_regs, 0, sizeof(mpsc_shared_regs)); |
1799 | 1796 | ||
1800 | if (!(rc = uart_register_driver(&mpsc_reg))) { | 1797 | if (!(rc = uart_register_driver(&mpsc_reg))) { |
1801 | if (!(rc = driver_register(&mpsc_shared_driver))) { | 1798 | if (!(rc = platform_driver_register(&mpsc_shared_driver))) { |
1802 | if ((rc = driver_register(&mpsc_driver))) { | 1799 | if ((rc = platform_driver_register(&mpsc_driver))) { |
1803 | driver_unregister(&mpsc_shared_driver); | 1800 | platform_driver_unregister(&mpsc_shared_driver); |
1804 | uart_unregister_driver(&mpsc_reg); | 1801 | uart_unregister_driver(&mpsc_reg); |
1805 | } | 1802 | } |
1806 | } | 1803 | } |
@@ -1815,8 +1812,8 @@ mpsc_drv_init(void) | |||
1815 | static void __exit | 1812 | static void __exit |
1816 | mpsc_drv_exit(void) | 1813 | mpsc_drv_exit(void) |
1817 | { | 1814 | { |
1818 | driver_unregister(&mpsc_driver); | 1815 | platform_driver_unregister(&mpsc_driver); |
1819 | driver_unregister(&mpsc_shared_driver); | 1816 | platform_driver_unregister(&mpsc_shared_driver); |
1820 | uart_unregister_driver(&mpsc_reg); | 1817 | uart_unregister_driver(&mpsc_reg); |
1821 | memset(mpsc_ports, 0, sizeof(mpsc_ports)); | 1818 | memset(mpsc_ports, 0, sizeof(mpsc_ports)); |
1822 | memset(&mpsc_shared_regs, 0, sizeof(mpsc_shared_regs)); | 1819 | memset(&mpsc_shared_regs, 0, sizeof(mpsc_shared_regs)); |
diff --git a/drivers/serial/pxa.c b/drivers/serial/pxa.c index 16b2f9417af9..ff5e6309d682 100644 --- a/drivers/serial/pxa.c +++ b/drivers/serial/pxa.c | |||
@@ -805,9 +805,9 @@ static struct uart_driver serial_pxa_reg = { | |||
805 | .cons = PXA_CONSOLE, | 805 | .cons = PXA_CONSOLE, |
806 | }; | 806 | }; |
807 | 807 | ||
808 | static int serial_pxa_suspend(struct device *_dev, pm_message_t state) | 808 | static int serial_pxa_suspend(struct platform_device *dev, pm_message_t state) |
809 | { | 809 | { |
810 | struct uart_pxa_port *sport = dev_get_drvdata(_dev); | 810 | struct uart_pxa_port *sport = platform_get_drvdata(dev); |
811 | 811 | ||
812 | if (sport) | 812 | if (sport) |
813 | uart_suspend_port(&serial_pxa_reg, &sport->port); | 813 | uart_suspend_port(&serial_pxa_reg, &sport->port); |
@@ -815,9 +815,9 @@ static int serial_pxa_suspend(struct device *_dev, pm_message_t state) | |||
815 | return 0; | 815 | return 0; |
816 | } | 816 | } |
817 | 817 | ||
818 | static int serial_pxa_resume(struct device *_dev) | 818 | static int serial_pxa_resume(struct platform_device *dev) |
819 | { | 819 | { |
820 | struct uart_pxa_port *sport = dev_get_drvdata(_dev); | 820 | struct uart_pxa_port *sport = platform_get_drvdata(dev); |
821 | 821 | ||
822 | if (sport) | 822 | if (sport) |
823 | uart_resume_port(&serial_pxa_reg, &sport->port); | 823 | uart_resume_port(&serial_pxa_reg, &sport->port); |
@@ -825,21 +825,19 @@ static int serial_pxa_resume(struct device *_dev) | |||
825 | return 0; | 825 | return 0; |
826 | } | 826 | } |
827 | 827 | ||
828 | static int serial_pxa_probe(struct device *_dev) | 828 | static int serial_pxa_probe(struct platform_device *dev) |
829 | { | 829 | { |
830 | struct platform_device *dev = to_platform_device(_dev); | 830 | serial_pxa_ports[dev->id].port.dev = &dev->dev; |
831 | |||
832 | serial_pxa_ports[dev->id].port.dev = _dev; | ||
833 | uart_add_one_port(&serial_pxa_reg, &serial_pxa_ports[dev->id].port); | 831 | uart_add_one_port(&serial_pxa_reg, &serial_pxa_ports[dev->id].port); |
834 | dev_set_drvdata(_dev, &serial_pxa_ports[dev->id]); | 832 | platform_set_drvdata(dev, &serial_pxa_ports[dev->id]); |
835 | return 0; | 833 | return 0; |
836 | } | 834 | } |
837 | 835 | ||
838 | static int serial_pxa_remove(struct device *_dev) | 836 | static int serial_pxa_remove(struct platform_device *dev) |
839 | { | 837 | { |
840 | struct uart_pxa_port *sport = dev_get_drvdata(_dev); | 838 | struct uart_pxa_port *sport = platform_get_drvdata(dev); |
841 | 839 | ||
842 | dev_set_drvdata(_dev, NULL); | 840 | platform_set_drvdata(dev, NULL); |
843 | 841 | ||
844 | if (sport) | 842 | if (sport) |
845 | uart_remove_one_port(&serial_pxa_reg, &sport->port); | 843 | uart_remove_one_port(&serial_pxa_reg, &sport->port); |
@@ -847,14 +845,15 @@ static int serial_pxa_remove(struct device *_dev) | |||
847 | return 0; | 845 | return 0; |
848 | } | 846 | } |
849 | 847 | ||
850 | static struct device_driver serial_pxa_driver = { | 848 | static struct platform_driver serial_pxa_driver = { |
851 | .name = "pxa2xx-uart", | ||
852 | .bus = &platform_bus_type, | ||
853 | .probe = serial_pxa_probe, | 849 | .probe = serial_pxa_probe, |
854 | .remove = serial_pxa_remove, | 850 | .remove = serial_pxa_remove, |
855 | 851 | ||
856 | .suspend = serial_pxa_suspend, | 852 | .suspend = serial_pxa_suspend, |
857 | .resume = serial_pxa_resume, | 853 | .resume = serial_pxa_resume, |
854 | .driver = { | ||
855 | .name = "pxa2xx-uart", | ||
856 | }, | ||
858 | }; | 857 | }; |
859 | 858 | ||
860 | int __init serial_pxa_init(void) | 859 | int __init serial_pxa_init(void) |
@@ -865,7 +864,7 @@ int __init serial_pxa_init(void) | |||
865 | if (ret != 0) | 864 | if (ret != 0) |
866 | return ret; | 865 | return ret; |
867 | 866 | ||
868 | ret = driver_register(&serial_pxa_driver); | 867 | ret = platform_driver_register(&serial_pxa_driver); |
869 | if (ret != 0) | 868 | if (ret != 0) |
870 | uart_unregister_driver(&serial_pxa_reg); | 869 | uart_unregister_driver(&serial_pxa_reg); |
871 | 870 | ||
@@ -874,7 +873,7 @@ int __init serial_pxa_init(void) | |||
874 | 873 | ||
875 | void __exit serial_pxa_exit(void) | 874 | void __exit serial_pxa_exit(void) |
876 | { | 875 | { |
877 | driver_unregister(&serial_pxa_driver); | 876 | platform_driver_unregister(&serial_pxa_driver); |
878 | uart_unregister_driver(&serial_pxa_reg); | 877 | uart_unregister_driver(&serial_pxa_reg); |
879 | } | 878 | } |
880 | 879 | ||
diff --git a/drivers/serial/s3c2410.c b/drivers/serial/s3c2410.c index 036792328d49..47681c4654e4 100644 --- a/drivers/serial/s3c2410.c +++ b/drivers/serial/s3c2410.c | |||
@@ -1092,14 +1092,13 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport, | |||
1092 | 1092 | ||
1093 | static int probe_index = 0; | 1093 | static int probe_index = 0; |
1094 | 1094 | ||
1095 | static int s3c24xx_serial_probe(struct device *_dev, | 1095 | static int s3c24xx_serial_probe(struct platform_device *dev, |
1096 | struct s3c24xx_uart_info *info) | 1096 | struct s3c24xx_uart_info *info) |
1097 | { | 1097 | { |
1098 | struct s3c24xx_uart_port *ourport; | 1098 | struct s3c24xx_uart_port *ourport; |
1099 | struct platform_device *dev = to_platform_device(_dev); | ||
1100 | int ret; | 1099 | int ret; |
1101 | 1100 | ||
1102 | dbg("s3c24xx_serial_probe(%p, %p) %d\n", _dev, info, probe_index); | 1101 | dbg("s3c24xx_serial_probe(%p, %p) %d\n", dev, info, probe_index); |
1103 | 1102 | ||
1104 | ourport = &s3c24xx_serial_ports[probe_index]; | 1103 | ourport = &s3c24xx_serial_ports[probe_index]; |
1105 | probe_index++; | 1104 | probe_index++; |
@@ -1112,7 +1111,7 @@ static int s3c24xx_serial_probe(struct device *_dev, | |||
1112 | 1111 | ||
1113 | dbg("%s: adding port\n", __FUNCTION__); | 1112 | dbg("%s: adding port\n", __FUNCTION__); |
1114 | uart_add_one_port(&s3c24xx_uart_drv, &ourport->port); | 1113 | uart_add_one_port(&s3c24xx_uart_drv, &ourport->port); |
1115 | dev_set_drvdata(_dev, &ourport->port); | 1114 | platform_set_drvdata(dev, &ourport->port); |
1116 | 1115 | ||
1117 | return 0; | 1116 | return 0; |
1118 | 1117 | ||
@@ -1120,9 +1119,9 @@ static int s3c24xx_serial_probe(struct device *_dev, | |||
1120 | return ret; | 1119 | return ret; |
1121 | } | 1120 | } |
1122 | 1121 | ||
1123 | static int s3c24xx_serial_remove(struct device *_dev) | 1122 | static int s3c24xx_serial_remove(struct platform_device *dev) |
1124 | { | 1123 | { |
1125 | struct uart_port *port = s3c24xx_dev_to_port(_dev); | 1124 | struct uart_port *port = s3c24xx_dev_to_port(&dev->dev); |
1126 | 1125 | ||
1127 | if (port) | 1126 | if (port) |
1128 | uart_remove_one_port(&s3c24xx_uart_drv, port); | 1127 | uart_remove_one_port(&s3c24xx_uart_drv, port); |
@@ -1134,9 +1133,9 @@ static int s3c24xx_serial_remove(struct device *_dev) | |||
1134 | 1133 | ||
1135 | #ifdef CONFIG_PM | 1134 | #ifdef CONFIG_PM |
1136 | 1135 | ||
1137 | static int s3c24xx_serial_suspend(struct device *dev, pm_message_t state) | 1136 | static int s3c24xx_serial_suspend(struct platform_device *dev, pm_message_t state) |
1138 | { | 1137 | { |
1139 | struct uart_port *port = s3c24xx_dev_to_port(dev); | 1138 | struct uart_port *port = s3c24xx_dev_to_port(&dev->dev); |
1140 | 1139 | ||
1141 | if (port) | 1140 | if (port) |
1142 | uart_suspend_port(&s3c24xx_uart_drv, port); | 1141 | uart_suspend_port(&s3c24xx_uart_drv, port); |
@@ -1144,9 +1143,9 @@ static int s3c24xx_serial_suspend(struct device *dev, pm_message_t state) | |||
1144 | return 0; | 1143 | return 0; |
1145 | } | 1144 | } |
1146 | 1145 | ||
1147 | static int s3c24xx_serial_resume(struct device *dev) | 1146 | static int s3c24xx_serial_resume(struct platform_device *dev) |
1148 | { | 1147 | { |
1149 | struct uart_port *port = s3c24xx_dev_to_port(dev); | 1148 | struct uart_port *port = s3c24xx_dev_to_port(&dev->dev); |
1150 | struct s3c24xx_uart_port *ourport = to_ourport(port); | 1149 | struct s3c24xx_uart_port *ourport = to_ourport(port); |
1151 | 1150 | ||
1152 | if (port) { | 1151 | if (port) { |
@@ -1165,11 +1164,11 @@ static int s3c24xx_serial_resume(struct device *dev) | |||
1165 | #define s3c24xx_serial_resume NULL | 1164 | #define s3c24xx_serial_resume NULL |
1166 | #endif | 1165 | #endif |
1167 | 1166 | ||
1168 | static int s3c24xx_serial_init(struct device_driver *drv, | 1167 | static int s3c24xx_serial_init(struct platform_driver *drv, |
1169 | struct s3c24xx_uart_info *info) | 1168 | struct s3c24xx_uart_info *info) |
1170 | { | 1169 | { |
1171 | dbg("s3c24xx_serial_init(%p,%p)\n", drv, info); | 1170 | dbg("s3c24xx_serial_init(%p,%p)\n", drv, info); |
1172 | return driver_register(drv); | 1171 | return platform_driver_register(drv); |
1173 | } | 1172 | } |
1174 | 1173 | ||
1175 | 1174 | ||
@@ -1228,19 +1227,20 @@ static struct s3c24xx_uart_info s3c2400_uart_inf = { | |||
1228 | .reset_port = s3c2400_serial_resetport, | 1227 | .reset_port = s3c2400_serial_resetport, |
1229 | }; | 1228 | }; |
1230 | 1229 | ||
1231 | static int s3c2400_serial_probe(struct device *dev) | 1230 | static int s3c2400_serial_probe(struct platform_device *dev) |
1232 | { | 1231 | { |
1233 | return s3c24xx_serial_probe(dev, &s3c2400_uart_inf); | 1232 | return s3c24xx_serial_probe(dev, &s3c2400_uart_inf); |
1234 | } | 1233 | } |
1235 | 1234 | ||
1236 | static struct device_driver s3c2400_serial_drv = { | 1235 | static struct platform_driver s3c2400_serial_drv = { |
1237 | .name = "s3c2400-uart", | ||
1238 | .owner = THIS_MODULE, | ||
1239 | .bus = &platform_bus_type, | ||
1240 | .probe = s3c2400_serial_probe, | 1236 | .probe = s3c2400_serial_probe, |
1241 | .remove = s3c24xx_serial_remove, | 1237 | .remove = s3c24xx_serial_remove, |
1242 | .suspend = s3c24xx_serial_suspend, | 1238 | .suspend = s3c24xx_serial_suspend, |
1243 | .resume = s3c24xx_serial_resume, | 1239 | .resume = s3c24xx_serial_resume, |
1240 | .driver = { | ||
1241 | .name = "s3c2400-uart", | ||
1242 | .owner = THIS_MODULE, | ||
1243 | }, | ||
1244 | }; | 1244 | }; |
1245 | 1245 | ||
1246 | static inline int s3c2400_serial_init(void) | 1246 | static inline int s3c2400_serial_init(void) |
@@ -1250,7 +1250,7 @@ static inline int s3c2400_serial_init(void) | |||
1250 | 1250 | ||
1251 | static inline void s3c2400_serial_exit(void) | 1251 | static inline void s3c2400_serial_exit(void) |
1252 | { | 1252 | { |
1253 | driver_unregister(&s3c2400_serial_drv); | 1253 | platform_driver_unregister(&s3c2400_serial_drv); |
1254 | } | 1254 | } |
1255 | 1255 | ||
1256 | #define s3c2400_uart_inf_at &s3c2400_uart_inf | 1256 | #define s3c2400_uart_inf_at &s3c2400_uart_inf |
@@ -1332,19 +1332,20 @@ static struct s3c24xx_uart_info s3c2410_uart_inf = { | |||
1332 | 1332 | ||
1333 | /* device management */ | 1333 | /* device management */ |
1334 | 1334 | ||
1335 | static int s3c2410_serial_probe(struct device *dev) | 1335 | static int s3c2410_serial_probe(struct platform_device *dev) |
1336 | { | 1336 | { |
1337 | return s3c24xx_serial_probe(dev, &s3c2410_uart_inf); | 1337 | return s3c24xx_serial_probe(dev, &s3c2410_uart_inf); |
1338 | } | 1338 | } |
1339 | 1339 | ||
1340 | static struct device_driver s3c2410_serial_drv = { | 1340 | static struct platform_driver s3c2410_serial_drv = { |
1341 | .name = "s3c2410-uart", | ||
1342 | .owner = THIS_MODULE, | ||
1343 | .bus = &platform_bus_type, | ||
1344 | .probe = s3c2410_serial_probe, | 1341 | .probe = s3c2410_serial_probe, |
1345 | .remove = s3c24xx_serial_remove, | 1342 | .remove = s3c24xx_serial_remove, |
1346 | .suspend = s3c24xx_serial_suspend, | 1343 | .suspend = s3c24xx_serial_suspend, |
1347 | .resume = s3c24xx_serial_resume, | 1344 | .resume = s3c24xx_serial_resume, |
1345 | .driver = { | ||
1346 | .name = "s3c2410-uart", | ||
1347 | .owner = THIS_MODULE, | ||
1348 | }, | ||
1348 | }; | 1349 | }; |
1349 | 1350 | ||
1350 | static inline int s3c2410_serial_init(void) | 1351 | static inline int s3c2410_serial_init(void) |
@@ -1354,7 +1355,7 @@ static inline int s3c2410_serial_init(void) | |||
1354 | 1355 | ||
1355 | static inline void s3c2410_serial_exit(void) | 1356 | static inline void s3c2410_serial_exit(void) |
1356 | { | 1357 | { |
1357 | driver_unregister(&s3c2410_serial_drv); | 1358 | platform_driver_unregister(&s3c2410_serial_drv); |
1358 | } | 1359 | } |
1359 | 1360 | ||
1360 | #define s3c2410_uart_inf_at &s3c2410_uart_inf | 1361 | #define s3c2410_uart_inf_at &s3c2410_uart_inf |
@@ -1493,20 +1494,21 @@ static struct s3c24xx_uart_info s3c2440_uart_inf = { | |||
1493 | 1494 | ||
1494 | /* device management */ | 1495 | /* device management */ |
1495 | 1496 | ||
1496 | static int s3c2440_serial_probe(struct device *dev) | 1497 | static int s3c2440_serial_probe(struct platform_device *dev) |
1497 | { | 1498 | { |
1498 | dbg("s3c2440_serial_probe: dev=%p\n", dev); | 1499 | dbg("s3c2440_serial_probe: dev=%p\n", dev); |
1499 | return s3c24xx_serial_probe(dev, &s3c2440_uart_inf); | 1500 | return s3c24xx_serial_probe(dev, &s3c2440_uart_inf); |
1500 | } | 1501 | } |
1501 | 1502 | ||
1502 | static struct device_driver s3c2440_serial_drv = { | 1503 | static struct platform_driver s3c2440_serial_drv = { |
1503 | .name = "s3c2440-uart", | ||
1504 | .owner = THIS_MODULE, | ||
1505 | .bus = &platform_bus_type, | ||
1506 | .probe = s3c2440_serial_probe, | 1504 | .probe = s3c2440_serial_probe, |
1507 | .remove = s3c24xx_serial_remove, | 1505 | .remove = s3c24xx_serial_remove, |
1508 | .suspend = s3c24xx_serial_suspend, | 1506 | .suspend = s3c24xx_serial_suspend, |
1509 | .resume = s3c24xx_serial_resume, | 1507 | .resume = s3c24xx_serial_resume, |
1508 | .driver = { | ||
1509 | .name = "s3c2440-uart", | ||
1510 | .owner = THIS_MODULE, | ||
1511 | }, | ||
1510 | }; | 1512 | }; |
1511 | 1513 | ||
1512 | 1514 | ||
@@ -1517,7 +1519,7 @@ static inline int s3c2440_serial_init(void) | |||
1517 | 1519 | ||
1518 | static inline void s3c2440_serial_exit(void) | 1520 | static inline void s3c2440_serial_exit(void) |
1519 | { | 1521 | { |
1520 | driver_unregister(&s3c2440_serial_drv); | 1522 | platform_driver_unregister(&s3c2440_serial_drv); |
1521 | } | 1523 | } |
1522 | 1524 | ||
1523 | #define s3c2440_uart_inf_at &s3c2440_uart_inf | 1525 | #define s3c2440_uart_inf_at &s3c2440_uart_inf |
diff --git a/drivers/serial/sa1100.c b/drivers/serial/sa1100.c index ed618cc7ae96..fd9deee20e05 100644 --- a/drivers/serial/sa1100.c +++ b/drivers/serial/sa1100.c | |||
@@ -834,9 +834,9 @@ static struct uart_driver sa1100_reg = { | |||
834 | .cons = SA1100_CONSOLE, | 834 | .cons = SA1100_CONSOLE, |
835 | }; | 835 | }; |
836 | 836 | ||
837 | static int sa1100_serial_suspend(struct device *_dev, pm_message_t state) | 837 | static int sa1100_serial_suspend(struct platform_device *dev, pm_message_t state) |
838 | { | 838 | { |
839 | struct sa1100_port *sport = dev_get_drvdata(_dev); | 839 | struct sa1100_port *sport = platform_get_drvdata(dev); |
840 | 840 | ||
841 | if (sport) | 841 | if (sport) |
842 | uart_suspend_port(&sa1100_reg, &sport->port); | 842 | uart_suspend_port(&sa1100_reg, &sport->port); |
@@ -844,9 +844,9 @@ static int sa1100_serial_suspend(struct device *_dev, pm_message_t state) | |||
844 | return 0; | 844 | return 0; |
845 | } | 845 | } |
846 | 846 | ||
847 | static int sa1100_serial_resume(struct device *_dev) | 847 | static int sa1100_serial_resume(struct platform_device *dev) |
848 | { | 848 | { |
849 | struct sa1100_port *sport = dev_get_drvdata(_dev); | 849 | struct sa1100_port *sport = platform_get_drvdata(dev); |
850 | 850 | ||
851 | if (sport) | 851 | if (sport) |
852 | uart_resume_port(&sa1100_reg, &sport->port); | 852 | uart_resume_port(&sa1100_reg, &sport->port); |
@@ -854,9 +854,8 @@ static int sa1100_serial_resume(struct device *_dev) | |||
854 | return 0; | 854 | return 0; |
855 | } | 855 | } |
856 | 856 | ||
857 | static int sa1100_serial_probe(struct device *_dev) | 857 | static int sa1100_serial_probe(struct platform_device *dev) |
858 | { | 858 | { |
859 | struct platform_device *dev = to_platform_device(_dev); | ||
860 | struct resource *res = dev->resource; | 859 | struct resource *res = dev->resource; |
861 | int i; | 860 | int i; |
862 | 861 | ||
@@ -869,9 +868,9 @@ static int sa1100_serial_probe(struct device *_dev) | |||
869 | if (sa1100_ports[i].port.mapbase != res->start) | 868 | if (sa1100_ports[i].port.mapbase != res->start) |
870 | continue; | 869 | continue; |
871 | 870 | ||
872 | sa1100_ports[i].port.dev = _dev; | 871 | sa1100_ports[i].port.dev = &dev->dev; |
873 | uart_add_one_port(&sa1100_reg, &sa1100_ports[i].port); | 872 | uart_add_one_port(&sa1100_reg, &sa1100_ports[i].port); |
874 | dev_set_drvdata(_dev, &sa1100_ports[i]); | 873 | platform_set_drvdata(dev, &sa1100_ports[i]); |
875 | break; | 874 | break; |
876 | } | 875 | } |
877 | } | 876 | } |
@@ -879,11 +878,11 @@ static int sa1100_serial_probe(struct device *_dev) | |||
879 | return 0; | 878 | return 0; |
880 | } | 879 | } |
881 | 880 | ||
882 | static int sa1100_serial_remove(struct device *_dev) | 881 | static int sa1100_serial_remove(struct platform_device *pdev) |
883 | { | 882 | { |
884 | struct sa1100_port *sport = dev_get_drvdata(_dev); | 883 | struct sa1100_port *sport = platform_get_drvdata(pdev); |
885 | 884 | ||
886 | dev_set_drvdata(_dev, NULL); | 885 | platform_set_drvdata(pdev, NULL); |
887 | 886 | ||
888 | if (sport) | 887 | if (sport) |
889 | uart_remove_one_port(&sa1100_reg, &sport->port); | 888 | uart_remove_one_port(&sa1100_reg, &sport->port); |
@@ -891,13 +890,14 @@ static int sa1100_serial_remove(struct device *_dev) | |||
891 | return 0; | 890 | return 0; |
892 | } | 891 | } |
893 | 892 | ||
894 | static struct device_driver sa11x0_serial_driver = { | 893 | static struct platform_driver sa11x0_serial_driver = { |
895 | .name = "sa11x0-uart", | ||
896 | .bus = &platform_bus_type, | ||
897 | .probe = sa1100_serial_probe, | 894 | .probe = sa1100_serial_probe, |
898 | .remove = sa1100_serial_remove, | 895 | .remove = sa1100_serial_remove, |
899 | .suspend = sa1100_serial_suspend, | 896 | .suspend = sa1100_serial_suspend, |
900 | .resume = sa1100_serial_resume, | 897 | .resume = sa1100_serial_resume, |
898 | .driver = { | ||
899 | .name = "sa11x0-uart", | ||
900 | }, | ||
901 | }; | 901 | }; |
902 | 902 | ||
903 | static int __init sa1100_serial_init(void) | 903 | static int __init sa1100_serial_init(void) |
@@ -910,7 +910,7 @@ static int __init sa1100_serial_init(void) | |||
910 | 910 | ||
911 | ret = uart_register_driver(&sa1100_reg); | 911 | ret = uart_register_driver(&sa1100_reg); |
912 | if (ret == 0) { | 912 | if (ret == 0) { |
913 | ret = driver_register(&sa11x0_serial_driver); | 913 | ret = platform_driver_register(&sa11x0_serial_driver); |
914 | if (ret) | 914 | if (ret) |
915 | uart_unregister_driver(&sa1100_reg); | 915 | uart_unregister_driver(&sa1100_reg); |
916 | } | 916 | } |
@@ -919,7 +919,7 @@ static int __init sa1100_serial_init(void) | |||
919 | 919 | ||
920 | static void __exit sa1100_serial_exit(void) | 920 | static void __exit sa1100_serial_exit(void) |
921 | { | 921 | { |
922 | driver_unregister(&sa11x0_serial_driver); | 922 | platform_driver_unregister(&sa11x0_serial_driver); |
923 | uart_unregister_driver(&sa1100_reg); | 923 | uart_unregister_driver(&sa1100_reg); |
924 | } | 924 | } |
925 | 925 | ||
diff --git a/drivers/serial/vr41xx_siu.c b/drivers/serial/vr41xx_siu.c index 01696b3e3f61..865d4dea65df 100644 --- a/drivers/serial/vr41xx_siu.c +++ b/drivers/serial/vr41xx_siu.c | |||
@@ -924,7 +924,7 @@ static struct uart_driver siu_uart_driver = { | |||
924 | .cons = SERIAL_VR41XX_CONSOLE, | 924 | .cons = SERIAL_VR41XX_CONSOLE, |
925 | }; | 925 | }; |
926 | 926 | ||
927 | static int siu_probe(struct device *dev) | 927 | static int siu_probe(struct platform_device *dev) |
928 | { | 928 | { |
929 | struct uart_port *port; | 929 | struct uart_port *port; |
930 | int num, i, retval; | 930 | int num, i, retval; |
@@ -941,7 +941,7 @@ static int siu_probe(struct device *dev) | |||
941 | for (i = 0; i < num; i++) { | 941 | for (i = 0; i < num; i++) { |
942 | port = &siu_uart_ports[i]; | 942 | port = &siu_uart_ports[i]; |
943 | port->ops = &siu_uart_ops; | 943 | port->ops = &siu_uart_ops; |
944 | port->dev = dev; | 944 | port->dev = &dev->dev; |
945 | 945 | ||
946 | retval = uart_add_one_port(&siu_uart_driver, port); | 946 | retval = uart_add_one_port(&siu_uart_driver, port); |
947 | if (retval < 0) { | 947 | if (retval < 0) { |
@@ -958,14 +958,14 @@ static int siu_probe(struct device *dev) | |||
958 | return 0; | 958 | return 0; |
959 | } | 959 | } |
960 | 960 | ||
961 | static int siu_remove(struct device *dev) | 961 | static int siu_remove(struct platform_device *dev) |
962 | { | 962 | { |
963 | struct uart_port *port; | 963 | struct uart_port *port; |
964 | int i; | 964 | int i; |
965 | 965 | ||
966 | for (i = 0; i < siu_uart_driver.nr; i++) { | 966 | for (i = 0; i < siu_uart_driver.nr; i++) { |
967 | port = &siu_uart_ports[i]; | 967 | port = &siu_uart_ports[i]; |
968 | if (port->dev == dev) { | 968 | if (port->dev == &dev->dev) { |
969 | uart_remove_one_port(&siu_uart_driver, port); | 969 | uart_remove_one_port(&siu_uart_driver, port); |
970 | port->dev = NULL; | 970 | port->dev = NULL; |
971 | } | 971 | } |
@@ -976,7 +976,7 @@ static int siu_remove(struct device *dev) | |||
976 | return 0; | 976 | return 0; |
977 | } | 977 | } |
978 | 978 | ||
979 | static int siu_suspend(struct device *dev, pm_message_t state) | 979 | static int siu_suspend(struct platform_device *dev, pm_message_t state) |
980 | { | 980 | { |
981 | struct uart_port *port; | 981 | struct uart_port *port; |
982 | int i; | 982 | int i; |
@@ -984,7 +984,7 @@ static int siu_suspend(struct device *dev, pm_message_t state) | |||
984 | for (i = 0; i < siu_uart_driver.nr; i++) { | 984 | for (i = 0; i < siu_uart_driver.nr; i++) { |
985 | port = &siu_uart_ports[i]; | 985 | port = &siu_uart_ports[i]; |
986 | if ((port->type == PORT_VR41XX_SIU || | 986 | if ((port->type == PORT_VR41XX_SIU || |
987 | port->type == PORT_VR41XX_DSIU) && port->dev == dev) | 987 | port->type == PORT_VR41XX_DSIU) && port->dev == &dev->dev) |
988 | uart_suspend_port(&siu_uart_driver, port); | 988 | uart_suspend_port(&siu_uart_driver, port); |
989 | 989 | ||
990 | } | 990 | } |
@@ -992,7 +992,7 @@ static int siu_suspend(struct device *dev, pm_message_t state) | |||
992 | return 0; | 992 | return 0; |
993 | } | 993 | } |
994 | 994 | ||
995 | static int siu_resume(struct device *dev) | 995 | static int siu_resume(struct platform_device *dev) |
996 | { | 996 | { |
997 | struct uart_port *port; | 997 | struct uart_port *port; |
998 | int i; | 998 | int i; |
@@ -1000,7 +1000,7 @@ static int siu_resume(struct device *dev) | |||
1000 | for (i = 0; i < siu_uart_driver.nr; i++) { | 1000 | for (i = 0; i < siu_uart_driver.nr; i++) { |
1001 | port = &siu_uart_ports[i]; | 1001 | port = &siu_uart_ports[i]; |
1002 | if ((port->type == PORT_VR41XX_SIU || | 1002 | if ((port->type == PORT_VR41XX_SIU || |
1003 | port->type == PORT_VR41XX_DSIU) && port->dev == dev) | 1003 | port->type == PORT_VR41XX_DSIU) && port->dev == &dev->dev) |
1004 | uart_resume_port(&siu_uart_driver, port); | 1004 | uart_resume_port(&siu_uart_driver, port); |
1005 | } | 1005 | } |
1006 | 1006 | ||
@@ -1009,13 +1009,14 @@ static int siu_resume(struct device *dev) | |||
1009 | 1009 | ||
1010 | static struct platform_device *siu_platform_device; | 1010 | static struct platform_device *siu_platform_device; |
1011 | 1011 | ||
1012 | static struct device_driver siu_device_driver = { | 1012 | static struct platform_driver siu_device_driver = { |
1013 | .name = "SIU", | ||
1014 | .bus = &platform_bus_type, | ||
1015 | .probe = siu_probe, | 1013 | .probe = siu_probe, |
1016 | .remove = siu_remove, | 1014 | .remove = siu_remove, |
1017 | .suspend = siu_suspend, | 1015 | .suspend = siu_suspend, |
1018 | .resume = siu_resume, | 1016 | .resume = siu_resume, |
1017 | .driver = { | ||
1018 | .name = "SIU", | ||
1019 | }, | ||
1019 | }; | 1020 | }; |
1020 | 1021 | ||
1021 | static int __devinit vr41xx_siu_init(void) | 1022 | static int __devinit vr41xx_siu_init(void) |
@@ -1026,7 +1027,7 @@ static int __devinit vr41xx_siu_init(void) | |||
1026 | if (IS_ERR(siu_platform_device)) | 1027 | if (IS_ERR(siu_platform_device)) |
1027 | return PTR_ERR(siu_platform_device); | 1028 | return PTR_ERR(siu_platform_device); |
1028 | 1029 | ||
1029 | retval = driver_register(&siu_device_driver); | 1030 | retval = platform_driver_register(&siu_device_driver); |
1030 | if (retval < 0) | 1031 | if (retval < 0) |
1031 | platform_device_unregister(siu_platform_device); | 1032 | platform_device_unregister(siu_platform_device); |
1032 | 1033 | ||
@@ -1035,7 +1036,7 @@ static int __devinit vr41xx_siu_init(void) | |||
1035 | 1036 | ||
1036 | static void __devexit vr41xx_siu_exit(void) | 1037 | static void __devexit vr41xx_siu_exit(void) |
1037 | { | 1038 | { |
1038 | driver_unregister(&siu_device_driver); | 1039 | platform_driver_unregister(&siu_device_driver); |
1039 | 1040 | ||
1040 | platform_device_unregister(siu_platform_device); | 1041 | platform_device_unregister(siu_platform_device); |
1041 | } | 1042 | } |