Skip to contentSkip to conversation

scsi/a100u2w: Remove custom msecs_to_jiffies and

PATCH In review Tobias Klauser 4 participants 6 messages Apr 13, 2005

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

PATCH 1/1 scsi/a100u2w: Remove custom msecs_to_jiffies and

Replace the MS_TO_JIFFIES() macro with msecs_to_jiffies() from jiffies.h The current macro is incorrect because HZ can have different values on different architectures.
The patch also removes the JIFFIES_TO_MS() macro which is not used anymore in the code.

drivers/scsi/a100u2w.c +1 -5
diff -urpN linux-2.6.12-rc2-mm3/drivers/scsi/a100u2w.c linux-2.6.12-rc2-mm3-tk/drivers/scsi/a100u2w.c
@@ -100,10 +100,6 @@
 
 #include "a100u2w.h"
 
-
-#define JIFFIES_TO_MS(t) ((t) * 1000 / HZ)
-#define MS_TO_JIFFIES(j) ((j * HZ) / 1000)
-
 static ORC_SCB *orc_alloc_scb(ORC_HCS * hcsp);
 static void inia100SCBPost(BYTE * pHcb, BYTE * pScb);
 
@@ -160,7 +156,7 @@ static UCHAR dftNvRam[64] =
 /***************************************************************************/
 static void waitForPause(unsigned amount)
 {
-	ULONG the_time = jiffies + MS_TO_JIFFIES(amount);
+	ULONG the_time = jiffies + msecs_to_jiffies(amount);
 	while (time_before_eq(jiffies, the_time))
 		cpu_relax();
 }

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

#1 lore raw

drivers/scsi/a100u2w.c static UCHAR dftNvRam[64] = · line 162

Quoted 12 lines · Tobias Klauser

Replace the MS_TO_JIFFIES() macro with msecs_to_jiffies() from jiffies.h

drivers/scsi/a100u2w.c +1 -1
 
 static void waitForPause(unsigned amount)
 {
-	ULONG the_time = jiffies + MS_TO_JIFFIES(amount);
+	ULONG the_time = jiffies + msecs_to_jiffies(amount);
 	while (time_before_eq(jiffies, the_time))
 		cpu_relax();
 }

It'd be better to find out what is the equivalent generic sleeping/delaying function and, if any, remove waitForPause() altogether.

However, Bas Vermeulen added these lines at the top of the file:

* 01/31/99 bv - v1.02b Use mdelay instead of waitForPause
* 08/08/99 bv - v1.02c Use waitForPause again.

Maybe he can recall what was wrong with mdelay().

#2 lore raw
In reply to Tobias Klauser

drivers/scsi/a100u2w.c static UCHAR dftNvRam[64] = · line 161

Quoted 6 lines

static void waitForPause(unsigned amount)
{

drivers/scsi/a100u2w.c +1 -1
-	ULONG the_time = jiffies + MS_TO_JIFFIES(amount);
+	ULONG the_time = jiffies + msecs_to_jiffies(amount);
 	while (time_before_eq(jiffies, the_time))
 		cpu_relax();

You should probably replace this function with msleep completely.

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

#3 lore raw
Quoted 8 lines · Christoph Hellwig

drivers/scsi/a100u2w.c static UCHAR dftNvRam[64] = · line 161

Quoted 6 lines

static void waitForPause(unsigned amount)
{

drivers/scsi/a100u2w.c +1 -1
-	ULONG the_time = jiffies + MS_TO_JIFFIES(amount);
+	ULONG the_time = jiffies + msecs_to_jiffies(amount);
 	while (time_before_eq(jiffies, the_time))
 		cpu_relax();

You should probably replace this function with msleep completely.

I actually meant mdelay, but as mentioned in the other followup that might need some more research.

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

#4 lore raw
Quoted 2 lines · Christoph Hellwig

I actually meant mdelay, but as mentioned in the other followup that might need some more research.

Actually, several of the waits look as though they have user context and so could sleep:

waitChipReady
waitFWReady
waitSCSIRSTdone

These I think are also user context: the aborts and nvram functions all seem to be user context

waitHDOoff
waitHDIoff

So could someone with a board try the theory (that msleep will work)?

Thanks,

James

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

#5 lore raw
In reply to Christoph Hellwig
Quoted 10 lines · Christoph Hellwig
Quoted 8 lines · Christoph Hellwig

drivers/scsi/a100u2w.c static UCHAR dftNvRam[64] = · line 161

Quoted 6 lines

static void waitForPause(unsigned amount)
{

drivers/scsi/a100u2w.c +1 -1
-	ULONG the_time = jiffies + MS_TO_JIFFIES(amount);
+	ULONG the_time = jiffies + msecs_to_jiffies(amount);
 	while (time_before_eq(jiffies, the_time))
 		cpu_relax();

You should probably replace this function with msleep completely.

Quoted 2 lines

I actually meant mdelay, but as mentioned in the other followup that might need some more research.

OK, I'll have a look at it. Thanks for your help.

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