public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi/a100u2w: Remove custom msecs_to_jiffies and jiffies_to_msecs macros
@ 2005-04-13 12:11 Tobias Klauser
  2005-04-13 14:43 ` Christoph Hellwig
  2005-04-13 17:28 ` [KJ] " Alexey Dobriyan
  0 siblings, 2 replies; 6+ messages in thread
From: Tobias Klauser @ 2005-04-13 12:11 UTC (permalink / raw)
  To: kernel-janitors; +Cc: linux-scsi

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.

Signed-off-by: Tobias Klauser <tklauser@nuerscht.ch>

diff -urpN linux-2.6.12-rc2-mm3/drivers/scsi/a100u2w.c linux-2.6.12-rc2-mm3-tk/drivers/scsi/a100u2w.c
--- linux-2.6.12-rc2-mm3/drivers/scsi/a100u2w.c	2005-03-02 08:38:12.000000000 +0100
+++ linux-2.6.12-rc2-mm3-tk/drivers/scsi/a100u2w.c	2005-04-13 13:53:19.000000000 +0200
@@ -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();
 }

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

* Re: [PATCH] scsi/a100u2w: Remove custom msecs_to_jiffies and jiffies_to_msecs macros
  2005-04-13 12:11 [PATCH] scsi/a100u2w: Remove custom msecs_to_jiffies and jiffies_to_msecs macros Tobias Klauser
@ 2005-04-13 14:43 ` Christoph Hellwig
  2005-04-13 14:51   ` [KJ] " Christoph Hellwig
  2005-04-13 17:28 ` [KJ] " Alexey Dobriyan
  1 sibling, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2005-04-13 14:43 UTC (permalink / raw)
  To: Tobias Klauser; +Cc: kernel-janitors, linux-scsi

>  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();

You should probably replace this function with msleep completely.

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

* [KJ] Re: [PATCH] scsi/a100u2w: Remove custom msecs_to_jiffies and jiffies_to_msecs macros
  2005-04-13 14:43 ` Christoph Hellwig
@ 2005-04-13 14:51   ` Christoph Hellwig
  2005-04-13 15:00     ` James Bottomley
  2005-04-13 15:01     ` Tobias Klauser
  0 siblings, 2 replies; 6+ messages in thread
From: Christoph Hellwig @ 2005-04-13 14:51 UTC (permalink / raw)
  To: Tobias Klauser; +Cc: kernel-janitors, linux-scsi

[-- Attachment #1: Type: text/plain, Size: 477 bytes --]

On Wed, Apr 13, 2005 at 03:43:08PM +0100, Christoph Hellwig wrote:
> >  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();
> 
> 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.


[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

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

* [KJ] Re: [PATCH] scsi/a100u2w: Remove custom msecs_to_jiffies and jiffies_to_msecs macros
  2005-04-13 14:51   ` [KJ] " Christoph Hellwig
@ 2005-04-13 15:00     ` James Bottomley
  2005-04-13 15:01     ` Tobias Klauser
  1 sibling, 0 replies; 6+ messages in thread
From: James Bottomley @ 2005-04-13 15:00 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: kernel-janitors, SCSI Mailing List

[-- Attachment #1: Type: text/plain, Size: 506 bytes --]

On Wed, 2005-04-13 at 15:51 +0100, Christoph Hellwig wrote:
> 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



[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

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

* Re: [PATCH] scsi/a100u2w: Remove custom msecs_to_jiffies and jiffies_to_msecs macros
  2005-04-13 14:51   ` [KJ] " Christoph Hellwig
  2005-04-13 15:00     ` James Bottomley
@ 2005-04-13 15:01     ` Tobias Klauser
  1 sibling, 0 replies; 6+ messages in thread
From: Tobias Klauser @ 2005-04-13 15:01 UTC (permalink / raw)
  To: Christoph Hellwig, Alexey Dobriyan; +Cc: kernel-janitors, linux-scsi

On Wed, Apr 13, 2005 at 03:51:00PM +0100, Christoph Hellwig wrote:
> On Wed, Apr 13, 2005 at 03:43:08PM +0100, Christoph Hellwig wrote:
> > >  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();
> > 
> > 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.

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

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

* Re: [KJ] [PATCH] scsi/a100u2w: Remove custom msecs_to_jiffies and jiffies_to_msecs macros
  2005-04-13 12:11 [PATCH] scsi/a100u2w: Remove custom msecs_to_jiffies and jiffies_to_msecs macros Tobias Klauser
  2005-04-13 14:43 ` Christoph Hellwig
@ 2005-04-13 17:28 ` Alexey Dobriyan
  1 sibling, 0 replies; 6+ messages in thread
From: Alexey Dobriyan @ 2005-04-13 17:28 UTC (permalink / raw)
  To: Tobias Klauser; +Cc: kernel-janitors, linux-scsi

On Wednesday 13 April 2005 12:11, Tobias Klauser wrote:
> Replace the MS_TO_JIFFIES() macro with msecs_to_jiffies() from jiffies.h

> --- linux-2.6.12-rc2-mm3/drivers/scsi/a100u2w.c
> +++ linux-2.6.12-rc2-mm3-tk/drivers/scsi/a100u2w.c

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

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

end of thread, other threads:[~2005-04-13 15:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-13 12:11 [PATCH] scsi/a100u2w: Remove custom msecs_to_jiffies and jiffies_to_msecs macros Tobias Klauser
2005-04-13 14:43 ` Christoph Hellwig
2005-04-13 14:51   ` [KJ] " Christoph Hellwig
2005-04-13 15:00     ` James Bottomley
2005-04-13 15:01     ` Tobias Klauser
2005-04-13 17:28 ` [KJ] " Alexey Dobriyan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox