From 77fc4228f72d803cace13cfec6a4076b38601bd5 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Fri, 7 Jan 2011 14:52:56 -0800 Subject: input: keyreset: Allow reset function to be overriden Change-Id: Ibb3dda05772b2e89d7b2646689944d309cb1f74e Signed-off-by: Colin Cross --- drivers/input/keyreset.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/keyreset.c b/drivers/input/keyreset.c index b51350602fc3..a5091ac19bbe 100644 --- a/drivers/input/keyreset.c +++ b/drivers/input/keyreset.c @@ -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; -- cgit v1.2.3