input: keyreset: Allow reset function to be overriden
authorColin Cross <ccross@android.com>
Fri, 7 Jan 2011 22:52:56 +0000 (14:52 -0800)
committerColin Cross <ccross@android.com>
Tue, 14 Jun 2011 16:09:44 +0000 (09:09 -0700)
Change-Id: Ibb3dda05772b2e89d7b2646689944d309cb1f74e
Signed-off-by: Colin Cross <ccross@android.com>
drivers/input/keyreset.c
include/linux/keyreset.h

index b51350602fc3f96d0bf57fe6e3c18bbf18838703..a5091ac19bbe60c1277605d74030ee16b74ec691 100644 (file)
@@ -33,6 +33,7 @@ struct keyreset_state {
        int key_down;
        int key_up;
        int restart_disabled;
+       int (*reset_fn)(void);
 };
 
 int restart_requested;
@@ -88,8 +89,12 @@ static void keyreset_event(struct input_handle *handle, unsigned int type,
                if (restart_requested)
                        panic("keyboard reset failed, %d", restart_requested);
                pr_info("keyboard reset\n");
-               schedule_work(&restart_work);
-               restart_requested = 1;
+               if (state->reset_fn) {
+                       restart_requested = state->reset_fn();
+               } else {
+                       schedule_work(&restart_work);
+                       restart_requested = 1;
+               }
        }
 done:
        spin_unlock_irqrestore(&state->lock, flags);
@@ -187,6 +192,10 @@ static int keyreset_probe(struct platform_device *pdev)
                        __set_bit(key, state->upbit);
                }
        }
+
+       if (pdata->reset_fn)
+               state->reset_fn = pdata->reset_fn;
+
        state->input_handler.event = keyreset_event;
        state->input_handler.connect = keyreset_connect;
        state->input_handler.disconnect = keyreset_disconnect;
index 50c4b952b8f70ca50b09a17be42151085affcb78..a2ac49e5b684c773d119ab178e3d498043ee602d 100644 (file)
@@ -20,6 +20,7 @@
 #define KEYRESET_NAME "keyreset"
 
 struct keyreset_platform_data {
+       int (*reset_fn)(void);
        int *keys_up;
        int keys_down[]; /* 0 terminated */
 };