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/sa1100.c | |
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/sa1100.c')
-rw-r--r-- | drivers/serial/sa1100.c | 32 |
1 files changed, 16 insertions, 16 deletions
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 | ||