Skip to contentSkip to conversation

usb/digi_acceleport: remove

PATCH New Nishanth Aravamudan 1 participant 2 messages Apr 4, 2005

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

PATCH 1/1 usb/digi_acceleport: remove

Quoted 7 lines · Nishanth Aravamudan

Hello,

Description: Replace deprecated interruptible_sleep_on_timeout() with direct wait-queue usage. Also replace some rather odd wait-queue usage with the existent macros. Also adjusted the wake_up_interruptible() call appropriately, as I changed all the states to TASK_UNINTERRUPTIBLE (signals were not be checked in the current code). Patch is compile-tested.

Patch was broken in various ways. Fixed-up below (ends up being fewer changes). Please drop previous patch and apply the attached.

Description: Replace deprecated interruptible_sleep_on_timeout() with direct wait-queue usage. Patch is compile-tested.

drivers/usb/serial/digi_acceleport.c +15 -16
@@ -14,6 +14,9 @@
 *  Peter Berger ([email protected])
 *  Al Borchers ([email protected])
 * 
+* (04/04/2005) nacc
+* 	removed interruptible_sleep_on_timeout() usage [deprecated]
+*
 * (12/03/2001) gkh
 *	switched to using port->open_count instead of private version.
 *	Removed port->active
@@ -244,6 +247,7 @@
 #include <linux/module.h>
 #include <linux/spinlock.h>
 #include <linux/workqueue.h>
+#include <linux/wait.h>
 #include <asm/uaccess.h>
 #include <linux/usb.h>
 #include "usb-serial.h"
@@ -567,27 +571,21 @@ static struct usb_serial_device_type dig
 *  and the sleep.  In other words, spin_unlock_irqrestore and
 *  interruptible_sleep_on_timeout are "atomic" with respect to
 *  wake ups.  This is used to implement condition variables.
+*
+*  interruptible_sleep_on_timeout is deprecated and has been replaced
+*  with the equivalent code.
 */
 
 static inline long cond_wait_interruptible_timeout_irqrestore(
 	wait_queue_head_t *q, long timeout,
 	spinlock_t *lock, unsigned long flags )
 {
+	DEFINE_WAIT(wait);
 
-	wait_queue_t wait;
-
-
-	init_waitqueue_entry( &wait, current );
-
-	set_current_state( TASK_INTERRUPTIBLE );
-
-	add_wait_queue( q, &wait );
-
-	spin_unlock_irqrestore( lock, flags );
-
+	prepare_to_wait(q, &wait, TASK_INTERRUPTIBLE);
+	spin_unlock_irqrestore(lock, flags);
 	timeout = schedule_timeout(timeout);
-
-	remove_wait_queue( q, &wait );
+	finish_wait(q, &wait);
 
 	return( timeout );
 
@@ -1528,7 +1526,7 @@ dbg( "digi_open: TOP: port=%d, open_coun
 
 static void digi_close( struct usb_serial_port *port, struct file *filp )
 {
-
+	DEFINE_WAIT(wait);
 	int ret;
 	unsigned char buf[32];
 	struct tty_struct *tty = port->tty;
@@ -1604,8 +1602,9 @@ dbg( "digi_close: TOP: port=%d, open_cou
 			dbg( "digi_close: write oob failed, ret=%d", ret );
 
 		/* wait for final commands on oob port to complete */
-		interruptible_sleep_on_timeout( &priv->dp_flush_wait,
-			DIGI_CLOSE_TIMEOUT );
+		prepare_to_wait(&priv->dp_flush_wait, &wait, TASK_INTERRUPTIBLE);
+		schedule_timeout(DIGI_CLOSE_TIMEOUT);
+		finish_wait(&priv->dp_flush_wait, &wait);
 
 		/* shutdown any outstanding bulk writes */
 		usb_kill_urb(port->write_urb);

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

#1 lore raw

PATCH 1/1 usb/digi_acceleport: correct wait-queue state

Quoted 9 lines · Nishanth Aravamudan
Quoted 7 lines · Nishanth Aravamudan

Hello,

Description: Replace deprecated interruptible_sleep_on_timeout() with direct wait-queue usage. Also replace some rather odd wait-queue usage with the existent macros. Also adjusted the wake_up_interruptible() call appropriately, as I changed all the states to TASK_UNINTERRUPTIBLE (signals were not be checked in the current code). Patch is compile-tested.

Quoted 5 lines

Patch was broken in various ways. Fixed-up below (ends up being fewer changes). Please drop previous patch and apply the attached.

Description: Replace deprecated interruptible_sleep_on_timeout() with direct wait-queue usage. Patch is compile-tested.

Original patch was merged into 2.6.11-rc2. Incremental patch for 2.6.11-rc2 attached.

Description: First patch incorrectly changed state of the wait-queue usage to TASK_UNINTERRUPTIBLE. Reverted to TASK_INTERRUPTIBLE.

drivers/usb/serial/digi_acceleport.c +6 -4
@@ -568,6 +568,9 @@ static struct usb_serial_device_type dig
 *  and the sleep.  In other words, spin_unlock_irqrestore and
 *  interruptible_sleep_on_timeout are "atomic" with respect to
 *  wake ups.  This is used to implement condition variables.
+*
+*  interruptible_sleep_on_timeout is deprecated and has been replaced
+*  with the equivalent code.
 */
 
 static inline long cond_wait_interruptible_timeout_irqrestore(
@@ -576,13 +579,12 @@ static inline long cond_wait_interruptib
 {
 	DEFINE_WAIT(wait);
 
-	prepare_to_wait(q, &wait, TASK_UNINTERRUPTIBLE);
+	prepare_to_wait(q, &wait, TASK_INTERRUPTIBLE);
 	spin_unlock_irqrestore(lock, flags);
 	timeout = schedule_timeout(timeout);
 	finish_wait(q, &wait);
 
 	return timeout;
-
 }
 
 
@@ -1596,7 +1598,7 @@ dbg( "digi_close: TOP: port=%d, open_cou
 			dbg( "digi_close: write oob failed, ret=%d", ret );
 
 		/* wait for final commands on oob port to complete */
-		prepare_to_wait(&priv->dp_flush_wait, &wait, TASK_UNINTERRUPTIBLE);
+		prepare_to_wait(&priv->dp_flush_wait, &wait, TASK_INTERRUPTIBLE);
 		schedule_timeout(DIGI_CLOSE_TIMEOUT);
 		finish_wait(&priv->dp_flush_wait, &wait);
 
@@ -1995,7 +1997,7 @@ opcode, line, status, val );
 
 		} else if( opcode == DIGI_CMD_IFLUSH_FIFO ) {
 
-			wake_up( &priv->dp_flush_wait );
+			wake_up_interruptible( &priv->dp_flush_wait );
 
 		}
 

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