* [PATCH] usb: gadget: mass_storage: Make use of the helper macro kthread_run()
@ 2021-10-21 8:43 Cai Huoqing
2021-10-21 15:13 ` Alan Stern
0 siblings, 1 reply; 2+ messages in thread
From: Cai Huoqing @ 2021-10-21 8:43 UTC (permalink / raw)
To: caihuoqing; +Cc: Felipe Balbi, Greg Kroah-Hartman, linux-usb, linux-kernel
Repalce kthread_create/wake_up_process() with kthread_run()
to simplify the code.
Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
drivers/usb/gadget/function/f_mass_storage.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/usb/gadget/function/f_mass_storage.c b/drivers/usb/gadget/function/f_mass_storage.c
index 3cabf7692ee1..1e3cab5d635c 100644
--- a/drivers/usb/gadget/function/f_mass_storage.c
+++ b/drivers/usb/gadget/function/f_mass_storage.c
@@ -2962,7 +2962,7 @@ static int fsg_bind(struct usb_configuration *c, struct usb_function *f)
if (!common->thread_task) {
common->state = FSG_STATE_NORMAL;
common->thread_task =
- kthread_create(fsg_main_thread, common, "file-storage");
+ kthread_run(fsg_main_thread, common, "file-storage");
if (IS_ERR(common->thread_task)) {
ret = PTR_ERR(common->thread_task);
common->thread_task = NULL;
@@ -2971,7 +2971,6 @@ static int fsg_bind(struct usb_configuration *c, struct usb_function *f)
}
DBG(common, "I/O thread pid: %d\n",
task_pid_nr(common->thread_task));
- wake_up_process(common->thread_task);
}
fsg->gadget = gadget;
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] usb: gadget: mass_storage: Make use of the helper macro kthread_run()
2021-10-21 8:43 [PATCH] usb: gadget: mass_storage: Make use of the helper macro kthread_run() Cai Huoqing
@ 2021-10-21 15:13 ` Alan Stern
0 siblings, 0 replies; 2+ messages in thread
From: Alan Stern @ 2021-10-21 15:13 UTC (permalink / raw)
To: Cai Huoqing; +Cc: Felipe Balbi, Greg Kroah-Hartman, linux-usb, linux-kernel
On Thu, Oct 21, 2021 at 04:43:58PM +0800, Cai Huoqing wrote:
> Repalce kthread_create/wake_up_process() with kthread_run()
> to simplify the code.
>
> Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
> ---
> drivers/usb/gadget/function/f_mass_storage.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/usb/gadget/function/f_mass_storage.c b/drivers/usb/gadget/function/f_mass_storage.c
> index 3cabf7692ee1..1e3cab5d635c 100644
> --- a/drivers/usb/gadget/function/f_mass_storage.c
> +++ b/drivers/usb/gadget/function/f_mass_storage.c
> @@ -2962,7 +2962,7 @@ static int fsg_bind(struct usb_configuration *c, struct usb_function *f)
> if (!common->thread_task) {
> common->state = FSG_STATE_NORMAL;
> common->thread_task =
> - kthread_create(fsg_main_thread, common, "file-storage");
> + kthread_run(fsg_main_thread, common, "file-storage");
> if (IS_ERR(common->thread_task)) {
> ret = PTR_ERR(common->thread_task);
> common->thread_task = NULL;
> @@ -2971,7 +2971,6 @@ static int fsg_bind(struct usb_configuration *c, struct usb_function *f)
> }
> DBG(common, "I/O thread pid: %d\n",
> task_pid_nr(common->thread_task));
> - wake_up_process(common->thread_task);
> }
We better not apply this patch for the same reason as the other one:
It's probably not a good idea for the fsg_main_thread task to start
running before common->thread_task has been assigned.
Alan Stern
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-10-21 15:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-21 8:43 [PATCH] usb: gadget: mass_storage: Make use of the helper macro kthread_run() Cai Huoqing
2021-10-21 15:13 ` Alan Stern
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).