All of lore.kernel.org
 help / color / mirror / Atom feed
* [KJ] [UPDATE PATCH 2/40] atm/zatm: replace sleep_on() with
@ 2005-01-24 22:50 Nishanth Aravamudan
  0 siblings, 0 replies; only message in thread
From: Nishanth Aravamudan @ 2005-01-24 22:50 UTC (permalink / raw)
  To: kernel-janitors

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

On Thu, Jan 20, 2005 at 10:17:42AM -0800, Nishanth Aravamudan wrote:
> Hi,
> 
> Please consider applying.
> 
> Description: Use wait_event() instead of the deprecated sleep_on(). The first
> replacement is relatively non-controversial, as the message is only printed
> once, and still is. In the second, though, the message is printed every
> iteration of the loop. This functionality has been lost with wait_event().
> Removed the unused variable once (which made sure that certain things were done
> on the first iteration of the loop, but not after; now there is only one
> "iteration"). Also fixed some strange tabbing.
> 
> Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
> 
> --- 2.6.11-rc1-kj-v/drivers/atm/zatm.c	2005-01-15 16:55:43.000000000 -0800
> +++ 2.6.11-rc1-kj/drivers/atm/zatm.c	2005-01-19 17:41:21.000000000 -0800

<snip>

> +	wait_event(zatm_vcc->tx_wait, !skb_peek(&zatm_vcc->backlog));
> +	printk("waiting for TX queue to drain ... %p\n",skb);

This line results in a compile failure. Fixed (sort of) below...


Description: Use wait_event() instead of the deprecated sleep_on(). The first
replacement is relatively non-controversial, as the message is only printed
once, and still is. In the second, though, the message is printed every
iteration of the loop. This functionality has been lost with wait_event().
Removed the unused variable once (which made sure that certain things were done
on the first iteration of the loop, but not after; now there is only one
"iteration"). Also fixed some strange tabbing. The final printk had to be
modified as well, since it references a pointer which has not yet been assigned.
Since the printk only happens once now (instead of repeatedly in a loop as
before), I think this should be ok.

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

--- 2.6.11-rc1-kj-v/drivers/atm/zatm.c	2005-01-15 16:55:43.000000000 -0800
+++ 2.6.11-rc1-kj/drivers/atm/zatm.c	2005-01-19 17:41:21.000000000 -0800
@@ -22,6 +22,7 @@
 #include <linux/atm_zatm.h>
 #include <linux/capability.h>
 #include <linux/bitops.h>
+#include <linux/wait.h>
 #include <asm/byteorder.h>
 #include <asm/system.h>
 #include <asm/string.h>
@@ -867,32 +868,19 @@ static void close_tx(struct atm_vcc *vcc
 	struct zatm_vcc *zatm_vcc;
 	unsigned long flags;
 	int chan;
-struct sk_buff *skb;
-int once = 1;
+	struct sk_buff *skb;
 
 	zatm_vcc = ZATM_VCC(vcc);
 	zatm_dev = ZATM_DEV(vcc->dev);
 	chan = zatm_vcc->tx_chan;
 	if (!chan) return;
 	DPRINTK("close_tx\n");
-	while (skb_peek(&zatm_vcc->backlog)) {
-if (once) {
-printk("waiting for backlog to drain ...\n");
-event_dump();
-once = 0;
-}
-		sleep_on(&zatm_vcc->tx_wait);
-	}
-once = 1;
-	while ((skb = skb_peek(&zatm_vcc->tx_queue))) {
-if (once) {
-printk("waiting for TX queue to drain ... %p\n",skb);
-event_dump();
-once = 0;
-}
-		DPRINTK("waiting for TX queue to drain ... %p\n",skb);
-		sleep_on(&zatm_vcc->tx_wait);
-	}
+	printk("waiting for backlog to drain ...\n");
+	event_dump();
+	wait_event(zatm_vcc->tx_wait, !skb_peek(&zatm_vcc->backlog));
+	printk("waiting for TX queue to drain ...\n");
+	event_dump();
+	wait_event(zatm_vcc->tx_wait, !(skb = skb_peek(&zatm_vcc->tx_queue)));
 	spin_lock_irqsave(&zatm_dev->lock, flags);
 #if 0
 	zwait;

[-- 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] only message in thread

only message in thread, other threads:[~2005-01-24 22:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-24 22:50 [KJ] [UPDATE PATCH 2/40] atm/zatm: replace sleep_on() with Nishanth Aravamudan

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.