As the configuration is not complete at the time of thread creation, defering the thread wakeup till the end. Signed-off-by: Sanjay Singh Rawat <snjsrwt@xxxxxxxxx> --- drivers/usb/gadget/function/f_mass_storage.c | 5 +++-- drivers/usb/gadget/legacy/acm_ms.c | 3 +++ drivers/usb/gadget/legacy/mass_storage.c | 3 +++ drivers/usb/gadget/legacy/multi.c | 2 ++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/usb/gadget/function/f_mass_storage.c b/drivers/usb/gadget/function/f_mass_storage.c index 0e90e38..a996f3f 100644 --- a/drivers/usb/gadget/function/f_mass_storage.c +++ b/drivers/usb/gadget/function/f_mass_storage.c @@ -3013,8 +3013,6 @@ int fsg_common_run_thread(struct fsg_common *common) DBG(common, "I/O thread pid: %d\n", task_pid_nr(common->thread_task)); - wake_up_process(common->thread_task); - return 0; } EXPORT_SYMBOL_GPL(fsg_common_run_thread); @@ -3121,6 +3119,9 @@ static int fsg_bind(struct usb_configuration *c, struct usb_function *f) if (ret) goto autoconf_fail; + /* wakeup the thread */ + wake_up_process(fsg->common->thread_task); + return 0; autoconf_fail: diff --git a/drivers/usb/gadget/legacy/acm_ms.c b/drivers/usb/gadget/legacy/acm_ms.c index 1194b09..ec79c74 100644 --- a/drivers/usb/gadget/legacy/acm_ms.c +++ b/drivers/usb/gadget/legacy/acm_ms.c @@ -155,6 +155,9 @@ static int acm_ms_do_config(struct usb_configuration *c) if (status) goto remove_acm; + /* wakeup the thread */ + wake_up_process(opts->common->thread_task); + return 0; remove_acm: usb_remove_function(c, f_acm); diff --git a/drivers/usb/gadget/legacy/mass_storage.c b/drivers/usb/gadget/legacy/mass_storage.c index e7bfb08..a8746b9 100644 --- a/drivers/usb/gadget/legacy/mass_storage.c +++ b/drivers/usb/gadget/legacy/mass_storage.c @@ -154,6 +154,9 @@ static int msg_do_config(struct usb_configuration *c) if (ret) goto put_func; + /* wakeup the thread */ + wake_up_process(opts->common->thread_task); + return 0; put_func: diff --git a/drivers/usb/gadget/legacy/multi.c b/drivers/usb/gadget/legacy/multi.c index b21b51f..00af0da 100644 --- a/drivers/usb/gadget/legacy/multi.c +++ b/drivers/usb/gadget/legacy/multi.c @@ -192,6 +192,8 @@ static int rndis_do_config(struct usb_configuration *c) if (ret) goto err_run; + /* wakeup the thread */ + wake_up_process(fsg_opts->common->thread_task); return 0; err_run: usb_put_function(f_msg_rndis); -- 1.8.3.2 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html