diff options
| author | Padmanabhan Komanduru <pkomandu@codeaurora.org> | 2017-02-23 18:35:50 +0530 |
|---|---|---|
| committer | Padmanabhan Komanduru <pkomandu@codeaurora.org> | 2017-02-23 18:43:42 +0530 |
| commit | f5c6660db6cbffbbebdd8fd94b3b2dd8f951c488 (patch) | |
| tree | 5280bf6edcc9af5024b8177bba8ce1df3cfb67dc | |
| parent | d72462d943ee499ac17a485bdacca60c0db31c04 (diff) | |
msm: mdss: initialize the DP thread structures before kthread_run
The DP event thread has workqueue and spinlock resources which are
initialized as part of the kthread event. This can cause a race
condition where the spinlock is accessed during EV_USBPD_DISCOVER_MODES
event at the end of DP probe sequence before it is initialized. This is
because kthread_run API doesn't guarantee the execution of DP event
thread to the point where spinlock is initialized before the function
call returns. Hence, initialize the DP thread resources before the
kthread_run.
Change-Id: I05711c33a896d409d4417d09973c6dfec61e818f
Signed-off-by: Padmanabhan Komanduru <pkomandu@codeaurora.org>
| -rw-r--r-- | drivers/video/fbdev/msm/mdss_dp.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/video/fbdev/msm/mdss_dp.c b/drivers/video/fbdev/msm/mdss_dp.c index bd8e710870f7..f613f115ba18 100644 --- a/drivers/video/fbdev/msm/mdss_dp.c +++ b/drivers/video/fbdev/msm/mdss_dp.c @@ -2889,8 +2889,6 @@ static int mdss_dp_event_thread(void *data) return -EINVAL; ev_data = (struct mdss_dp_event_data *)data; - init_waitqueue_head(&ev_data->event_q); - spin_lock_init(&ev_data->event_lock); while (!kthread_should_stop()) { wait_event(ev_data->event_q, @@ -3049,6 +3047,9 @@ static void mdss_dp_event_cleanup(struct mdss_dp_drv_pdata *dp) static int mdss_dp_event_setup(struct mdss_dp_drv_pdata *dp) { + init_waitqueue_head(&dp->dp_event.event_q); + spin_lock_init(&dp->dp_event.event_lock); + dp->ev_thread = kthread_run(mdss_dp_event_thread, (void *)&dp->dp_event, "mdss_dp_event"); if (IS_ERR(dp->ev_thread)) { |
