linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [media] gscpa_m5602: use msecs_to_jiffies for conversions
@ 2015-06-07 14:34 Nicholas Mc Guire
  2015-06-23  9:54 ` Hans de Goede
  0 siblings, 1 reply; 2+ messages in thread
From: Nicholas Mc Guire @ 2015-06-07 14:34 UTC (permalink / raw)
  To: Erik Andren
  Cc: Hans de Goede, Mauro Carvalho Chehab, linux-media, linux-kernel,
	Nicholas Mc Guire

API compliance scanning with coccinelle flagged:
./drivers/media/usb/gspca/m5602/m5602_s5k83a.c:180:9-25:
	 WARNING: timeout (100) seems HZ dependent

Numeric constants passed to schedule_timeout() make the effective
timeout HZ dependent which makes little sense in a polling loop for
the cameras rotation state.
Fixed up by converting the constant to jiffies with msecs_to_jiffies()

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
---

Patch was compile tested with i386_defconfig + 

Patch is against 4.1-rc6 (localversion-next is -next-20150605)

 drivers/media/usb/gspca/m5602/m5602_s5k83a.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/usb/gspca/m5602/m5602_s5k83a.c b/drivers/media/usb/gspca/m5602/m5602_s5k83a.c
index 7cbc3a0..bf6b215 100644
--- a/drivers/media/usb/gspca/m5602/m5602_s5k83a.c
+++ b/drivers/media/usb/gspca/m5602/m5602_s5k83a.c
@@ -177,7 +177,7 @@ static int rotation_thread_function(void *data)
 	__s32 vflip, hflip;
 
 	set_current_state(TASK_INTERRUPTIBLE);
-	while (!schedule_timeout(100)) {
+	while (!schedule_timeout(msecs_to_jiffies(100))) {
 		if (mutex_lock_interruptible(&sd->gspca_dev.usb_lock))
 			break;
 
-- 
1.7.10.4


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

* Re: [PATCH] [media] gscpa_m5602: use msecs_to_jiffies for conversions
  2015-06-07 14:34 [PATCH] [media] gscpa_m5602: use msecs_to_jiffies for conversions Nicholas Mc Guire
@ 2015-06-23  9:54 ` Hans de Goede
  0 siblings, 0 replies; 2+ messages in thread
From: Hans de Goede @ 2015-06-23  9:54 UTC (permalink / raw)
  To: Nicholas Mc Guire, Erik Andren
  Cc: Mauro Carvalho Chehab, linux-media, linux-kernel

Hi,

On 07-06-15 16:34, Nicholas Mc Guire wrote:
> API compliance scanning with coccinelle flagged:
> ./drivers/media/usb/gspca/m5602/m5602_s5k83a.c:180:9-25:
> 	 WARNING: timeout (100) seems HZ dependent
>
> Numeric constants passed to schedule_timeout() make the effective
> timeout HZ dependent which makes little sense in a polling loop for
> the cameras rotation state.
> Fixed up by converting the constant to jiffies with msecs_to_jiffies()
>
> Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>

Thanks I've queued this up for merging into 4.3

Regards,

Hans


> ---
>
> Patch was compile tested with i386_defconfig +
>
> Patch is against 4.1-rc6 (localversion-next is -next-20150605)
>
>   drivers/media/usb/gspca/m5602/m5602_s5k83a.c |    2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/usb/gspca/m5602/m5602_s5k83a.c b/drivers/media/usb/gspca/m5602/m5602_s5k83a.c
> index 7cbc3a0..bf6b215 100644
> --- a/drivers/media/usb/gspca/m5602/m5602_s5k83a.c
> +++ b/drivers/media/usb/gspca/m5602/m5602_s5k83a.c
> @@ -177,7 +177,7 @@ static int rotation_thread_function(void *data)
>   	__s32 vflip, hflip;
>
>   	set_current_state(TASK_INTERRUPTIBLE);
> -	while (!schedule_timeout(100)) {
> +	while (!schedule_timeout(msecs_to_jiffies(100))) {
>   		if (mutex_lock_interruptible(&sd->gspca_dev.usb_lock))
>   			break;
>
>

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

end of thread, other threads:[~2015-06-23  9:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-07 14:34 [PATCH] [media] gscpa_m5602: use msecs_to_jiffies for conversions Nicholas Mc Guire
2015-06-23  9:54 ` Hans de Goede

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