aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2008-05-06 12:11:39 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2008-05-16 14:50:49 -0400
commitccd3474569a101914444dc37cc108eec22578999 (patch)
tree38174fcec4c5f8fb728061ee5adf66ae308ad70e
parent3e582db0783872a645f5236ef142be6579b300ad (diff)
Input: libps2 - remove delayed command execution
Delayed command execution is not used by anyone so let's remove it. Reported-by: Adrian Bunk <bunk@kernel.org> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
-rw-r--r--drivers/input/serio/libps2.c52
-rw-r--r--include/linux/libps2.h1
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>");
26MODULE_DESCRIPTION("PS/2 driver library"); 26MODULE_DESCRIPTION("PS/2 driver library");
27MODULE_LICENSE("GPL"); 27MODULE_LICENSE("GPL");
28 28
29/* Work structure to schedule execution of a command */
30struct 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)
246EXPORT_SYMBOL(ps2_command); 237EXPORT_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
253static 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
267int 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}
289EXPORT_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);
43int ps2_sendbyte(struct ps2dev *ps2dev, unsigned char byte, int timeout); 43int ps2_sendbyte(struct ps2dev *ps2dev, unsigned char byte, int timeout);
44void ps2_drain(struct ps2dev *ps2dev, int maxbytes, int timeout); 44void ps2_drain(struct ps2dev *ps2dev, int maxbytes, int timeout);
45int ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command); 45int ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command);
46int ps2_schedule_command(struct ps2dev *ps2dev, unsigned char *param, int command);
47int ps2_handle_ack(struct ps2dev *ps2dev, unsigned char data); 46int ps2_handle_ack(struct ps2dev *ps2dev, unsigned char data);
48int ps2_handle_response(struct ps2dev *ps2dev, unsigned char data); 47int ps2_handle_response(struct ps2dev *ps2dev, unsigned char data);
49void ps2_cmd_aborted(struct ps2dev *ps2dev); 48void ps2_cmd_aborted(struct ps2dev *ps2dev);