diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2009-09-09 22:08:17 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2009-09-11 01:11:37 -0400 |
commit | f81134163fc785622f58af27363079ba1de7c7aa (patch) | |
tree | c67cc607689b5abd739536f65f85cbc8539f02f3 /drivers/input | |
parent | 386b384900a200d5fcabdd4a9c27eb21db606cd4 (diff) |
Input: i8042 - use platform_driver_probe
i8042 is not hot-pluggable and we create the device when we register
the driver, so let's save some memory by using platform_device_probe
and using __init instead of __devinit.
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/serio/i8042.c | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c index 61ed7a966c6..eb3ff94af58 100644 --- a/drivers/input/serio/i8042.c +++ b/drivers/input/serio/i8042.c | |||
@@ -541,7 +541,7 @@ static int i8042_set_mux_mode(bool multiplex, unsigned char *mux_version) | |||
541 | * LCS/Telegraphics. | 541 | * LCS/Telegraphics. |
542 | */ | 542 | */ |
543 | 543 | ||
544 | static int __devinit i8042_check_mux(void) | 544 | static int __init i8042_check_mux(void) |
545 | { | 545 | { |
546 | unsigned char mux_version; | 546 | unsigned char mux_version; |
547 | 547 | ||
@@ -570,10 +570,10 @@ static int __devinit i8042_check_mux(void) | |||
570 | /* | 570 | /* |
571 | * The following is used to test AUX IRQ delivery. | 571 | * The following is used to test AUX IRQ delivery. |
572 | */ | 572 | */ |
573 | static struct completion i8042_aux_irq_delivered __devinitdata; | 573 | static struct completion i8042_aux_irq_delivered __initdata; |
574 | static bool i8042_irq_being_tested __devinitdata; | 574 | static bool i8042_irq_being_tested __initdata; |
575 | 575 | ||
576 | static irqreturn_t __devinit i8042_aux_test_irq(int irq, void *dev_id) | 576 | static irqreturn_t __init i8042_aux_test_irq(int irq, void *dev_id) |
577 | { | 577 | { |
578 | unsigned long flags; | 578 | unsigned long flags; |
579 | unsigned char str, data; | 579 | unsigned char str, data; |
@@ -598,7 +598,7 @@ static irqreturn_t __devinit i8042_aux_test_irq(int irq, void *dev_id) | |||
598 | * verifies success by readinng CTR. Used when testing for presence of AUX | 598 | * verifies success by readinng CTR. Used when testing for presence of AUX |
599 | * port. | 599 | * port. |
600 | */ | 600 | */ |
601 | static int __devinit i8042_toggle_aux(bool on) | 601 | static int __init i8042_toggle_aux(bool on) |
602 | { | 602 | { |
603 | unsigned char param; | 603 | unsigned char param; |
604 | int i; | 604 | int i; |
@@ -626,7 +626,7 @@ static int __devinit i8042_toggle_aux(bool on) | |||
626 | * the presence of an AUX interface. | 626 | * the presence of an AUX interface. |
627 | */ | 627 | */ |
628 | 628 | ||
629 | static int __devinit i8042_check_aux(void) | 629 | static int __init i8042_check_aux(void) |
630 | { | 630 | { |
631 | int retval = -1; | 631 | int retval = -1; |
632 | bool irq_registered = false; | 632 | bool irq_registered = false; |
@@ -1060,7 +1060,7 @@ static void i8042_shutdown(struct platform_device *dev) | |||
1060 | i8042_controller_reset(); | 1060 | i8042_controller_reset(); |
1061 | } | 1061 | } |
1062 | 1062 | ||
1063 | static int __devinit i8042_create_kbd_port(void) | 1063 | static int __init i8042_create_kbd_port(void) |
1064 | { | 1064 | { |
1065 | struct serio *serio; | 1065 | struct serio *serio; |
1066 | struct i8042_port *port = &i8042_ports[I8042_KBD_PORT_NO]; | 1066 | struct i8042_port *port = &i8042_ports[I8042_KBD_PORT_NO]; |
@@ -1085,7 +1085,7 @@ static int __devinit i8042_create_kbd_port(void) | |||
1085 | return 0; | 1085 | return 0; |
1086 | } | 1086 | } |
1087 | 1087 | ||
1088 | static int __devinit i8042_create_aux_port(int idx) | 1088 | static int __init i8042_create_aux_port(int idx) |
1089 | { | 1089 | { |
1090 | struct serio *serio; | 1090 | struct serio *serio; |
1091 | int port_no = idx < 0 ? I8042_AUX_PORT_NO : I8042_MUX_PORT_NO + idx; | 1091 | int port_no = idx < 0 ? I8042_AUX_PORT_NO : I8042_MUX_PORT_NO + idx; |
@@ -1117,13 +1117,13 @@ static int __devinit i8042_create_aux_port(int idx) | |||
1117 | return 0; | 1117 | return 0; |
1118 | } | 1118 | } |
1119 | 1119 | ||
1120 | static void __devinit i8042_free_kbd_port(void) | 1120 | static void __init i8042_free_kbd_port(void) |
1121 | { | 1121 | { |
1122 | kfree(i8042_ports[I8042_KBD_PORT_NO].serio); | 1122 | kfree(i8042_ports[I8042_KBD_PORT_NO].serio); |
1123 | i8042_ports[I8042_KBD_PORT_NO].serio = NULL; | 1123 | i8042_ports[I8042_KBD_PORT_NO].serio = NULL; |
1124 | } | 1124 | } |
1125 | 1125 | ||
1126 | static void __devinit i8042_free_aux_ports(void) | 1126 | static void __init i8042_free_aux_ports(void) |
1127 | { | 1127 | { |
1128 | int i; | 1128 | int i; |
1129 | 1129 | ||
@@ -1133,7 +1133,7 @@ static void __devinit i8042_free_aux_ports(void) | |||
1133 | } | 1133 | } |
1134 | } | 1134 | } |
1135 | 1135 | ||
1136 | static void __devinit i8042_register_ports(void) | 1136 | static void __init i8042_register_ports(void) |
1137 | { | 1137 | { |
1138 | int i; | 1138 | int i; |
1139 | 1139 | ||
@@ -1171,7 +1171,7 @@ static void i8042_free_irqs(void) | |||
1171 | i8042_aux_irq_registered = i8042_kbd_irq_registered = false; | 1171 | i8042_aux_irq_registered = i8042_kbd_irq_registered = false; |
1172 | } | 1172 | } |
1173 | 1173 | ||
1174 | static int __devinit i8042_setup_aux(void) | 1174 | static int __init i8042_setup_aux(void) |
1175 | { | 1175 | { |
1176 | int (*aux_enable)(void); | 1176 | int (*aux_enable)(void); |
1177 | int error; | 1177 | int error; |
@@ -1212,7 +1212,7 @@ static int __devinit i8042_setup_aux(void) | |||
1212 | return error; | 1212 | return error; |
1213 | } | 1213 | } |
1214 | 1214 | ||
1215 | static int __devinit i8042_setup_kbd(void) | 1215 | static int __init i8042_setup_kbd(void) |
1216 | { | 1216 | { |
1217 | int error; | 1217 | int error; |
1218 | 1218 | ||
@@ -1239,7 +1239,7 @@ static int __devinit i8042_setup_kbd(void) | |||
1239 | return error; | 1239 | return error; |
1240 | } | 1240 | } |
1241 | 1241 | ||
1242 | static int __devinit i8042_probe(struct platform_device *dev) | 1242 | static int __init i8042_probe(struct platform_device *dev) |
1243 | { | 1243 | { |
1244 | int error; | 1244 | int error; |
1245 | 1245 | ||
@@ -1299,7 +1299,6 @@ static struct platform_driver i8042_driver = { | |||
1299 | .pm = &i8042_pm_ops, | 1299 | .pm = &i8042_pm_ops, |
1300 | #endif | 1300 | #endif |
1301 | }, | 1301 | }, |
1302 | .probe = i8042_probe, | ||
1303 | .remove = __devexit_p(i8042_remove), | 1302 | .remove = __devexit_p(i8042_remove), |
1304 | .shutdown = i8042_shutdown, | 1303 | .shutdown = i8042_shutdown, |
1305 | }; | 1304 | }; |
@@ -1318,28 +1317,28 @@ static int __init i8042_init(void) | |||
1318 | if (err) | 1317 | if (err) |
1319 | goto err_platform_exit; | 1318 | goto err_platform_exit; |
1320 | 1319 | ||
1321 | err = platform_driver_register(&i8042_driver); | ||
1322 | if (err) | ||
1323 | goto err_platform_exit; | ||
1324 | |||
1325 | i8042_platform_device = platform_device_alloc("i8042", -1); | 1320 | i8042_platform_device = platform_device_alloc("i8042", -1); |
1326 | if (!i8042_platform_device) { | 1321 | if (!i8042_platform_device) { |
1327 | err = -ENOMEM; | 1322 | err = -ENOMEM; |
1328 | goto err_unregister_driver; | 1323 | goto err_platform_exit; |
1329 | } | 1324 | } |
1330 | 1325 | ||
1331 | err = platform_device_add(i8042_platform_device); | 1326 | err = platform_device_add(i8042_platform_device); |
1332 | if (err) | 1327 | if (err) |
1333 | goto err_free_device; | 1328 | goto err_free_device; |
1334 | 1329 | ||
1330 | err = platform_driver_probe(&i8042_driver, i8042_probe); | ||
1331 | if (err) | ||
1332 | goto err_del_device; | ||
1333 | |||
1335 | panic_blink = i8042_panic_blink; | 1334 | panic_blink = i8042_panic_blink; |
1336 | 1335 | ||
1337 | return 0; | 1336 | return 0; |
1338 | 1337 | ||
1338 | err_del_device: | ||
1339 | platform_device_del(i8042_platform_device); | ||
1339 | err_free_device: | 1340 | err_free_device: |
1340 | platform_device_put(i8042_platform_device); | 1341 | platform_device_put(i8042_platform_device); |
1341 | err_unregister_driver: | ||
1342 | platform_driver_unregister(&i8042_driver); | ||
1343 | err_platform_exit: | 1342 | err_platform_exit: |
1344 | i8042_platform_exit(); | 1343 | i8042_platform_exit(); |
1345 | 1344 | ||
@@ -1348,8 +1347,8 @@ static int __init i8042_init(void) | |||
1348 | 1347 | ||
1349 | static void __exit i8042_exit(void) | 1348 | static void __exit i8042_exit(void) |
1350 | { | 1349 | { |
1351 | platform_device_unregister(i8042_platform_device); | ||
1352 | platform_driver_unregister(&i8042_driver); | 1350 | platform_driver_unregister(&i8042_driver); |
1351 | platform_device_unregister(i8042_platform_device); | ||
1353 | i8042_platform_exit(); | 1352 | i8042_platform_exit(); |
1354 | 1353 | ||
1355 | panic_blink = NULL; | 1354 | panic_blink = NULL; |