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