diff options
-rw-r--r-- | drivers/input/serio/libps2.c | 52 | ||||
-rw-r--r-- | include/linux/libps2.h | 1 |
2 files changed, 0 insertions, 53 deletions
diff --git a/drivers/input/serio/libps2.c b/drivers/input/serio/libps2.c index b819239d74dc..2b304c22c200 100644 --- a/drivers/input/serio/libps2.c +++ b/drivers/input/serio/libps2.c | |||
@@ -26,15 +26,6 @@ MODULE_AUTHOR("Dmitry Torokhov <dtor@mail.ru>"); | |||
26 | MODULE_DESCRIPTION("PS/2 driver library"); | 26 | MODULE_DESCRIPTION("PS/2 driver library"); |
27 | MODULE_LICENSE("GPL"); | 27 | MODULE_LICENSE("GPL"); |
28 | 28 | ||
29 | /* Work structure to schedule execution of a command */ | ||
30 | struct ps2work { | ||
31 | struct work_struct work; | ||
32 | struct ps2dev *ps2dev; | ||
33 | int command; | ||
34 | unsigned char param[0]; | ||
35 | }; | ||
36 | |||
37 | |||
38 | /* | 29 | /* |
39 | * ps2_sendbyte() sends a byte to the device and waits for acknowledge. | 30 | * ps2_sendbyte() sends a byte to the device and waits for acknowledge. |
40 | * It doesn't handle retransmission, though it could - because if there | 31 | * It doesn't handle retransmission, though it could - because if there |
@@ -246,49 +237,6 @@ int ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command) | |||
246 | EXPORT_SYMBOL(ps2_command); | 237 | EXPORT_SYMBOL(ps2_command); |
247 | 238 | ||
248 | /* | 239 | /* |
249 | * ps2_execute_scheduled_command() sends a command, previously scheduled by | ||
250 | * ps2_schedule_command(), to a PS/2 device (keyboard, mouse, etc.) | ||
251 | */ | ||
252 | |||
253 | static void ps2_execute_scheduled_command(struct work_struct *work) | ||
254 | { | ||
255 | struct ps2work *ps2work = container_of(work, struct ps2work, work); | ||
256 | |||
257 | ps2_command(ps2work->ps2dev, ps2work->param, ps2work->command); | ||
258 | kfree(ps2work); | ||
259 | } | ||
260 | |||
261 | /* | ||
262 | * ps2_schedule_command() allows to schedule delayed execution of a PS/2 | ||
263 | * command and can be used to issue a command from an interrupt or softirq | ||
264 | * context. | ||
265 | */ | ||
266 | |||
267 | int ps2_schedule_command(struct ps2dev *ps2dev, unsigned char *param, int command) | ||
268 | { | ||
269 | struct ps2work *ps2work; | ||
270 | int send = (command >> 12) & 0xf; | ||
271 | int receive = (command >> 8) & 0xf; | ||
272 | |||
273 | if (!(ps2work = kmalloc(sizeof(struct ps2work) + max(send, receive), GFP_ATOMIC))) | ||
274 | return -1; | ||
275 | |||
276 | memset(ps2work, 0, sizeof(struct ps2work)); | ||
277 | ps2work->ps2dev = ps2dev; | ||
278 | ps2work->command = command; | ||
279 | memcpy(ps2work->param, param, send); | ||
280 | INIT_WORK(&ps2work->work, ps2_execute_scheduled_command); | ||
281 | |||
282 | if (!schedule_work(&ps2work->work)) { | ||
283 | kfree(ps2work); | ||
284 | return -1; | ||
285 | } | ||
286 | |||
287 | return 0; | ||
288 | } | ||
289 | EXPORT_SYMBOL(ps2_schedule_command); | ||
290 | |||
291 | /* | ||
292 | * ps2_init() initializes ps2dev structure | 240 | * ps2_init() initializes ps2dev structure |
293 | */ | 241 | */ |
294 | 242 | ||
diff --git a/include/linux/libps2.h b/include/linux/libps2.h index f6f301e2b0f5..afc413369101 100644 --- a/include/linux/libps2.h +++ b/include/linux/libps2.h | |||
@@ -43,7 +43,6 @@ void ps2_init(struct ps2dev *ps2dev, struct serio *serio); | |||
43 | int ps2_sendbyte(struct ps2dev *ps2dev, unsigned char byte, int timeout); | 43 | int ps2_sendbyte(struct ps2dev *ps2dev, unsigned char byte, int timeout); |
44 | void ps2_drain(struct ps2dev *ps2dev, int maxbytes, int timeout); | 44 | void ps2_drain(struct ps2dev *ps2dev, int maxbytes, int timeout); |
45 | int ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command); | 45 | int ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command); |
46 | int ps2_schedule_command(struct ps2dev *ps2dev, unsigned char *param, int command); | ||
47 | int ps2_handle_ack(struct ps2dev *ps2dev, unsigned char data); | 46 | int ps2_handle_ack(struct ps2dev *ps2dev, unsigned char data); |
48 | int ps2_handle_response(struct ps2dev *ps2dev, unsigned char data); | 47 | int ps2_handle_response(struct ps2dev *ps2dev, unsigned char data); |
49 | void ps2_cmd_aborted(struct ps2dev *ps2dev); | 48 | void ps2_cmd_aborted(struct ps2dev *ps2dev); |