input: touchscreen: Replace kernel thread with a workqueue

Replace the firmware update kernel thread with a workqueue.
Now the firmware upgrade procedure can be called later in
future time without blocking the registration of the
touchscreen driver. Using a kernel thread is an overhead in
the current driver as it is a one shot thread.

Change-Id: I0d4731148351652092fe7feede0b44828939d98b
Signed-off-by: Shantanu Jain <shjain@codeaurora.org>
This commit is contained in:
Shantanu Jain 2013-11-01 12:56:13 +05:30 committed by Abinaya P
parent db3a2341f0
commit 3f4d270af7
2 changed files with 11 additions and 9 deletions

View file

@ -78,7 +78,7 @@ struct goodix_ts_data {
struct hrtimer timer;
struct workqueue_struct *goodix_wq;
struct work_struct work;
char fw_name[GTP_FW_NAME_MAXSIZE];
struct delayed_work goodix_update_work;
s32 irq_is_disabled;
s32 use_irq;
u16 abs_x_max;

View file

@ -31,7 +31,6 @@
* 2. support firmware header array update.
* By Meta, 2013/03/11
*/
#include <linux/kthread.h>
#include "gt9xx.h"
#if GTP_HEADER_FW_UPDATE
@ -1723,17 +1722,20 @@ file_fail:
return FAIL;
}
static void gup_update_work(struct work_struct *work)
{
if (gup_update_proc(NULL) == FAIL)
pr_err("Goodix update work fail\n");
}
#if GTP_AUTO_UPDATE
u8 gup_init_update_proc(struct goodix_ts_data *ts)
{
struct task_struct *thread = NULL;
dev_dbg(&ts->client->dev, "Ready to run update work\n");
pr_info("Ready to run update thread.\n");
thread = kthread_run(gup_update_proc, (void *)NULL, "guitar_update");
if (IS_ERR(thread)) {
pr_err("Failed to create update thread.\n");
return -EINVAL;
}
INIT_DELAYED_WORK(&ts->goodix_update_work, gup_update_work);
schedule_delayed_work(&ts->goodix_update_work,
msecs_to_jiffies(3000));
return 0;
}