Skip to contentSkip to conversation

radio/radio-sf16fmi: replace

PATCH In review Nishanth Aravamudan 2 participants 4 messages Jul 26, 2004 – Jul 27, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 radio/radio-sf16fmi: replace

I would appreciate any comments from the janitors list.

Thanks,
Nish

Applys-to: 2.6.7

Description: Replaced schedule_timeout() with msleep() to guarantee the task delays the desired time.

drivers/media/radio/radio-sf16fmi.c +2 -4
@@ -89,8 +89,7 @@ static inline int fmi_setfreq(struct fmi
 
 	outbits(16, RSF16_ENCODE(freq), myport);
 	outbits(8, 0xC0, myport);
-	current->state = TASK_UNINTERRUPTIBLE;
-	schedule_timeout(HZ/7);
+	msleep(143);		/* was schedule_timeout(HZ/7) */
 	up(&lock);
 	if (dev->curvol) fmi_unmute(myport);
 	return 0;
@@ -107,8 +106,7 @@ static inline int fmi_getsigstr(struct f
 	val = dev->curvol ? 0x08 : 0x00;	/* unmute/mute */
 	outb(val, myport);
 	outb(val | 0x10, myport);
-	set_current_state(TASK_UNINTERRUPTIBLE);
-	schedule_timeout(HZ/7);
+	msleep(143); 		/* was schedule_timeout(HZ/7) */
 	res = (int)inb(myport+1);
 	outb(val, myport);
 	

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#1 lore raw

PATCH 1/1 radio/radio-sf16fmr2: replace

I would appreciate any comments from the janitors list.

Thanks,
Nish

Applys-to: 2.6.7

Description: Replaced schedule_timeout() with msleep() to guarantee the task delays the desired time.

drivers/media/radio/radio-sf16fmr2.c +1 -4
@@ -62,10 +62,7 @@ static void sleep_delay(unsigned long n)
 	if (!d)
 		udelay(n);
 	else
-	{
-		set_current_state(TASK_UNINTERRUPTIBLE);
-		schedule_timeout(d);
-	}
+		msleep(jiffies_to_msecs(d));
 }
 
 static inline void wait(int n,int port)

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#2 lore raw

Re: [Kernel-janitors] [PATCH] radio/radio-sf16fmr2:

In reply to Nishanth Aravamudan

since sleep_delay is only called once (with the intent to sleep for 110 ms), wouldn't it be better to simply replace the call to sleep_delay with msleep (and remove sleep_delay)?

Quoted 25 lines · Nishanth Aravamudan

I would appreciate any comments from the janitors list.

Thanks,
Nish

Applys-to: 2.6.7

Description: Replaced schedule_timeout() with msleep() to guarantee the task delays the desired time.

drivers/media/radio/radio-sf16fmr2.c +1 -4
@@ -62,10 +62,7 @@ static void sleep_delay(unsigned long n)
 	if (!d)
 		udelay(n);
 	else
-	{
-		set_current_state(TASK_UNINTERRUPTIBLE);
-		schedule_timeout(d);
-	}
+		msleep(jiffies_to_msecs(d));
 }
Signature · 2 lines
--------------------------
Mark Hollomon

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#3 lore raw

Re: [Kernel-janitors] [PATCH] radio/radio-sf16fmr2:

In reply to Nishanth Aravamudan
Quoted 3 lines · Mark Hollomon

since sleep_delay is only called once (with the intent to sleep for 110 ms), wouldn't it be better to simply replace the call to sleep_delay with msleep (and remove sleep_delay)?

I wasn't sure if I should leave the function in, in case someone wanted to modify the driver later. But, if you think it's ok, find this fix below. Thanks again, Mark.

-Nish

Applys-to: 2.6.7

Description: Replace single invocation of sleep_delay() with msleep() and remove definition of sleep_delay().

drivers/media/radio/radio-sf16fmr2.c +1 -14
@@ -55,19 +55,6 @@ static int radio_nr = -1;
 #define RSF16_MINFREQ 87*16000
 #define RSF16_MAXFREQ 108*16000
 
-/* from radio-aimslab */
-static void sleep_delay(unsigned long n)
-{
-	unsigned d=n/(1000000U/HZ);
-	if (!d)
-		udelay(n);
-	else
-	{
-		set_current_state(TASK_UNINTERRUPTIBLE);
-		schedule_timeout(d);
-	}
-}
-
 static inline void wait(int n,int port)
 {
 	for (;n;--n) inb(port);
@@ -153,7 +140,7 @@ static int fmr2_setfreq(struct fmr2_devi
 	fmr2_unmute(port);
 
 	/* wait 0.11 sec */
-	sleep_delay(110000LU);
+	msleep(110);
 
 	/* NOTE if mute this stop radio
 	   you must set freq on unmute */

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors