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