linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: gspca: Make use of the helper macro kthread_run()
@ 2021-10-21  8:41 Cai Huoqing
  2021-10-21  9:15 ` Kieran Bingham
  0 siblings, 1 reply; 2+ messages in thread
From: Cai Huoqing @ 2021-10-21  8:41 UTC (permalink / raw)
  To: caihuoqing
  Cc: Erik Andren, Hans Verkuil, Mauro Carvalho Chehab, linux-media,
	linux-kernel

Repalce kthread_create/wake_up_process() with kthread_run()
to simplify the code.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
 drivers/media/usb/gspca/m5602/m5602_s5k83a.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/media/usb/gspca/m5602/m5602_s5k83a.c b/drivers/media/usb/gspca/m5602/m5602_s5k83a.c
index bc4008d5d116..4504d615b1e4 100644
--- a/drivers/media/usb/gspca/m5602/m5602_s5k83a.c
+++ b/drivers/media/usb/gspca/m5602/m5602_s5k83a.c
@@ -339,14 +339,13 @@ int s5k83a_start(struct sd *sd)
 	/* Create another thread, polling the GPIO ports of the camera to check
 	   if it got rotated. This is how the windows driver does it so we have
 	   to assume that there is no better way of accomplishing this */
-	sd->rotation_thread = kthread_create(rotation_thread_function,
-					     sd, "rotation thread");
+	sd->rotation_thread = kthread_run(rotation_thread_function,
+					  sd, "rotation thread");
 	if (IS_ERR(sd->rotation_thread)) {
 		err = PTR_ERR(sd->rotation_thread);
 		sd->rotation_thread = NULL;
 		return err;
 	}
-	wake_up_process(sd->rotation_thread);
 
 	/* Preinit the sensor */
 	for (i = 0; i < ARRAY_SIZE(start_s5k83a) && !err; i++) {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] media: gspca: Make use of the helper macro kthread_run()
  2021-10-21  8:41 [PATCH] media: gspca: Make use of the helper macro kthread_run() Cai Huoqing
@ 2021-10-21  9:15 ` Kieran Bingham
  0 siblings, 0 replies; 2+ messages in thread
From: Kieran Bingham @ 2021-10-21  9:15 UTC (permalink / raw)
  To: caihuoqing
  Cc: Erik Andren, Hans Verkuil, Mauro Carvalho Chehab, linux-media,
	linux-kernel

Hi Cai,

Quoting Cai Huoqing (2021-10-21 09:41:42)
> Repalce kthread_create/wake_up_process() with kthread_run()
> to simplify the code.
> 
> Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>

kthread_run does look appropriate here, and is simpler.

Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>

> ---
>  drivers/media/usb/gspca/m5602/m5602_s5k83a.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/media/usb/gspca/m5602/m5602_s5k83a.c b/drivers/media/usb/gspca/m5602/m5602_s5k83a.c
> index bc4008d5d116..4504d615b1e4 100644
> --- a/drivers/media/usb/gspca/m5602/m5602_s5k83a.c
> +++ b/drivers/media/usb/gspca/m5602/m5602_s5k83a.c
> @@ -339,14 +339,13 @@ int s5k83a_start(struct sd *sd)
>         /* Create another thread, polling the GPIO ports of the camera to check
>            if it got rotated. This is how the windows driver does it so we have
>            to assume that there is no better way of accomplishing this */
> -       sd->rotation_thread = kthread_create(rotation_thread_function,
> -                                            sd, "rotation thread");
> +       sd->rotation_thread = kthread_run(rotation_thread_function,
> +                                         sd, "rotation thread");
>         if (IS_ERR(sd->rotation_thread)) {
>                 err = PTR_ERR(sd->rotation_thread);
>                 sd->rotation_thread = NULL;
>                 return err;
>         }
> -       wake_up_process(sd->rotation_thread);
>  
>         /* Preinit the sensor */
>         for (i = 0; i < ARRAY_SIZE(start_s5k83a) && !err; i++) {
> -- 
> 2.25.1
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-10-21  9:16 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:41 [PATCH] media: gspca: Make use of the helper macro kthread_run() Cai Huoqing
2021-10-21  9:15 ` Kieran Bingham

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).