All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nishanth Aravamudan <nacc@us.ibm.com>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: kernel-janitors@lists.osdl.org, netdev@oss.sgi.com,
	acme@conectiva.com.br
Subject: [KJ] [PATCH] net/cycx_drv: replace delay_cycx() with
Date: Mon, 01 Nov 2004 19:48:33 +0000	[thread overview]
Message-ID: <20041101194833.GA3391@us.ibm.com> (raw)
In-Reply-To: <4184C6A7.7060400@pobox.com>

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

On Sun, Oct 31, 2004 at 06:04:07AM -0500, Jeff Garzik wrote:
> janitor@sternwelten.at wrote:
> >-/* Delay */
> >-static void delay_cycx(int sec)
> >-{
> >-	set_current_state(TASK_INTERRUPTIBLE);
> >-	schedule_timeout(sec * HZ);
> >-}
> 
> 
> this _clearly_ wants an ssleep() derivative, not msleep()

Fixed, see patch below.

Description: Use ssleep_interruptible() instead of delay_cycx()
to guarantee the task delays as expected. Remove the prototype and
definition of delay_cycx().

Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>


--- 2.6.10-rc1-vanilla/drivers/net/wan/cycx_drv.c	2004-10-30 15:33:28.000000000 -0700
+++ 2.6.10-rc1/drivers/net/wan/cycx_drv.c	2004-11-01 11:46:08.000000000 -0800
@@ -74,7 +74,6 @@ static int reset_cyc2x(void __iomem *add
 static int detect_cyc2x(void __iomem *addr);
 
 /* Miscellaneous functions */
-static void delay_cycx(int sec);
 static int get_option_index(long *optlist, long optval);
 static u16 checksum(u8 *buf, u32 len);
 
@@ -259,7 +258,7 @@ static int memory_exists(void __iomem *a
 			if (readw(addr + 0x10) == TEST_PATTERN)
 				return 1;
 
-		delay_cycx(1);
+		ssleep_interruptible(1);
 	}
 
 	return 0;
@@ -316,7 +315,7 @@ static void cycx_reset_boot(void __iomem
 
 	/* 80186 was in hold, go */
 	writeb(0, addr + START_CPU);
-	delay_cycx(1);
+	ssleep_interruptible(1);
 }
 
 /* Load data.bin file through boot (reset) interface. */
@@ -462,13 +461,13 @@ static int load_cyc2x(struct cycx_hw *hw
 		cycx_reset_boot(hw->dpmbase, reset_image, img_hdr->reset_size);
 		/* reset is waiting for boot */
 		writew(GEN_POWER_ON, pt_cycld);
-		delay_cycx(1);
+		ssleep_interruptible(1);
 
 		for (j = 0 ; j < 3 ; j++)
 			if (!readw(pt_cycld))
 				goto reset_loaded;
 			else
-				delay_cycx(1);
+				ssleep_interruptible(1);
 	}
 
 	printk(KERN_ERR "%s: reset not started.\n", modname);
@@ -495,7 +494,7 @@ reset_loaded:
 
 	/* Arthur Ganzert's tip: wait a while after the firmware loading...
 	   seg abr 26 17:17:12 EST 1999 - acme */
-	delay_cycx(7);
+	ssleep_interruptible(7);
 	printk(KERN_INFO "%s: firmware loaded!\n", modname);
 
 	/* enable interrupts */
@@ -547,20 +546,13 @@ static int get_option_index(long *optlis
 static int reset_cyc2x(void __iomem *addr)
 {
 	writeb(0, addr + RST_ENABLE);
-	delay_cycx(2);
+	ssleep_interruptible(2);
 	writeb(0, addr + RST_DISABLE);
-	delay_cycx(2);
+	ssleep_interruptible(2);
 
 	return memory_exists(addr);
 }
 
-/* Delay */
-static void delay_cycx(int sec)
-{
-	set_current_state(TASK_INTERRUPTIBLE);
-	schedule_timeout(sec * HZ);
-}
-
 /* Calculate 16-bit CRC using CCITT polynomial. */
 static u16 checksum(u8 *buf, u32 len)
 {

[-- 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

WARNING: multiple messages have this Message-ID (diff)
From: Nishanth Aravamudan <nacc@us.ibm.com>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: kernel-janitors@lists.osdl.org, netdev@oss.sgi.com,
	acme@conectiva.com.br
Subject: [PATCH] net/cycx_drv: replace delay_cycx() with ssleep_interruptible()
Date: Mon, 1 Nov 2004 11:48:33 -0800	[thread overview]
Message-ID: <20041101194833.GA3391@us.ibm.com> (raw)
In-Reply-To: <4184C6A7.7060400@pobox.com>

On Sun, Oct 31, 2004 at 06:04:07AM -0500, Jeff Garzik wrote:
> janitor@sternwelten.at wrote:
> >-/* Delay */
> >-static void delay_cycx(int sec)
> >-{
> >-	set_current_state(TASK_INTERRUPTIBLE);
> >-	schedule_timeout(sec * HZ);
> >-}
> 
> 
> this _clearly_ wants an ssleep() derivative, not msleep()

Fixed, see patch below.

Description: Use ssleep_interruptible() instead of delay_cycx()
to guarantee the task delays as expected. Remove the prototype and
definition of delay_cycx().

Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>


--- 2.6.10-rc1-vanilla/drivers/net/wan/cycx_drv.c	2004-10-30 15:33:28.000000000 -0700
+++ 2.6.10-rc1/drivers/net/wan/cycx_drv.c	2004-11-01 11:46:08.000000000 -0800
@@ -74,7 +74,6 @@ static int reset_cyc2x(void __iomem *add
 static int detect_cyc2x(void __iomem *addr);
 
 /* Miscellaneous functions */
-static void delay_cycx(int sec);
 static int get_option_index(long *optlist, long optval);
 static u16 checksum(u8 *buf, u32 len);
 
@@ -259,7 +258,7 @@ static int memory_exists(void __iomem *a
 			if (readw(addr + 0x10) == TEST_PATTERN)
 				return 1;
 
-		delay_cycx(1);
+		ssleep_interruptible(1);
 	}
 
 	return 0;
@@ -316,7 +315,7 @@ static void cycx_reset_boot(void __iomem
 
 	/* 80186 was in hold, go */
 	writeb(0, addr + START_CPU);
-	delay_cycx(1);
+	ssleep_interruptible(1);
 }
 
 /* Load data.bin file through boot (reset) interface. */
@@ -462,13 +461,13 @@ static int load_cyc2x(struct cycx_hw *hw
 		cycx_reset_boot(hw->dpmbase, reset_image, img_hdr->reset_size);
 		/* reset is waiting for boot */
 		writew(GEN_POWER_ON, pt_cycld);
-		delay_cycx(1);
+		ssleep_interruptible(1);
 
 		for (j = 0 ; j < 3 ; j++)
 			if (!readw(pt_cycld))
 				goto reset_loaded;
 			else
-				delay_cycx(1);
+				ssleep_interruptible(1);
 	}
 
 	printk(KERN_ERR "%s: reset not started.\n", modname);
@@ -495,7 +494,7 @@ reset_loaded:
 
 	/* Arthur Ganzert's tip: wait a while after the firmware loading...
 	   seg abr 26 17:17:12 EST 1999 - acme */
-	delay_cycx(7);
+	ssleep_interruptible(7);
 	printk(KERN_INFO "%s: firmware loaded!\n", modname);
 
 	/* enable interrupts */
@@ -547,20 +546,13 @@ static int get_option_index(long *optlis
 static int reset_cyc2x(void __iomem *addr)
 {
 	writeb(0, addr + RST_ENABLE);
-	delay_cycx(2);
+	ssleep_interruptible(2);
 	writeb(0, addr + RST_DISABLE);
-	delay_cycx(2);
+	ssleep_interruptible(2);
 
 	return memory_exists(addr);
 }
 
-/* Delay */
-static void delay_cycx(int sec)
-{
-	set_current_state(TASK_INTERRUPTIBLE);
-	schedule_timeout(sec * HZ);
-}
-
 /* Calculate 16-bit CRC using CCITT polynomial. */
 static u16 checksum(u8 *buf, u32 len)
 {

  reply	other threads:[~2004-11-01 19:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-30 22:43 [patch 13/18] net/cycx_drv: replace delay_cycx() with msleep_interruptible() janitor
2004-10-31 11:04 ` Jeff Garzik
2004-11-01 19:48   ` Nishanth Aravamudan [this message]
2004-11-01 19:48     ` [PATCH] net/cycx_drv: replace delay_cycx() with ssleep_interruptible() Nishanth Aravamudan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041101194833.GA3391@us.ibm.com \
    --to=nacc@us.ibm.com \
    --cc=acme@conectiva.com.br \
    --cc=jgarzik@pobox.com \
    --cc=kernel-janitors@lists.osdl.org \
    --cc=netdev@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.