diff mbox series

[-next] usb: f_mass_storage: Make use of the helper macro kthread_run()

Message ID 20240902133024.3089400-1-lihongbo22@huawei.com (mailing list archive)
State Superseded
Headers show
Series [-next] usb: f_mass_storage: Make use of the helper macro kthread_run() | expand

Commit Message

Hongbo Li Sept. 2, 2024, 1:30 p.m. UTC
Repalce kthread_create/wake_up_process() with kthread_run()
to simplify the code.

Signed-off-by: Hongbo Li <lihongbo22@huawei.com>
---
 drivers/usb/gadget/function/f_mass_storage.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Alan Stern Sept. 2, 2024, 2 p.m. UTC | #1
On Mon, Sep 02, 2024 at 09:30:24PM +0800, Hongbo Li wrote:
> Repalce kthread_create/wake_up_process() with kthread_run()
> to simplify the code.
> 
> Signed-off-by: Hongbo Li <lihongbo22@huawei.com>
> ---

Acked-by: Alan Stern <stern@rowland.harvard.edu>

>  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 cfd712fd7452..e11d8c0edf06 100644
> --- a/drivers/usb/gadget/function/f_mass_storage.c
> +++ b/drivers/usb/gadget/function/f_mass_storage.c
> @@ -3050,7 +3050,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;
> @@ -3059,7 +3059,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.34.1
> 
>
Sergey Shtylyov Sept. 2, 2024, 2:05 p.m. UTC | #2
On 9/2/24 4:30 PM, Hongbo Li wrote:

> Repalce kthread_create/wake_up_process() with kthread_run()

   Replace. :-)

> to simplify the code.
> 
> Signed-off-by: Hongbo Li <lihongbo22@huawei.com>

[...]

MBR, Sergey
diff mbox series

Patch

diff --git a/drivers/usb/gadget/function/f_mass_storage.c b/drivers/usb/gadget/function/f_mass_storage.c
index cfd712fd7452..e11d8c0edf06 100644
--- a/drivers/usb/gadget/function/f_mass_storage.c
+++ b/drivers/usb/gadget/function/f_mass_storage.c
@@ -3050,7 +3050,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;
@@ -3059,7 +3059,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;