Skip to contentSkip to conversation

staging: dgnc: convert to wait_event_interruptible_timeout

PATCH Superseded Gujulan Elango, Hari Prasath (H.) 2 participants 2 messages Dec 24, 2015 – Feb 8, 2016 Staging

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: dgnc: convert to wait_event_interruptible_timeout

This patch makes use of wait_event_interruptible_timeout to achieve timeout functionality.This is a TODO mentiond in the comment which is also removed. It also aligns with what the function is supposed to do as in the comments.

---
 drivers/staging/dgnc/dgnc_neo.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/staging/dgnc/dgnc_neo.c +1 -3
index 39c76e7..7d9efe0 100644
@@ -1306,10 +1306,8 @@ static int neo_drain(struct tty_struct *tty, uint seconds)
 	/*
 	 * Go to sleep waiting for the tty layer to wake me back up when
 	 * the empty flag goes away.
-	 *
-	 * NOTE: TODO: Do something with time passed in.
 	 */
-	rc = wait_event_interruptible(un->un_flags_wait, ((un->un_flags & UN_EMPTY) == 0));
+	rc = wait_event_interruptible_timeout(un->un_flags_wait, ((un->un_flags & UN_EMPTY) == 0), msecs_to_jiffies(seconds * 1000));
 
 	/* If ret is non-zero, user ctrl-c'ed us */
 	return rc;
Signature · 1 line
1.9.1
#1 lore raw
Quoted 15 lines · Hari Prasath (H.)

This patch makes use of wait_event_interruptible_timeout to achieve timeout functionality.This is a TODO mentiond in the comment which is also removed. It also aligns with what the function is supposed to do as in the comments.

---
 drivers/staging/dgnc/dgnc_neo.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/staging/dgnc/dgnc_neo.c +0 -0
index 39c76e7..7d9efe0 100644

drivers/staging/dgnc/dgnc_neo.c static int neo_drain(struct tty_struct *tty, uint seconds) · line 1310

Quoted 8 lines
drivers/staging/dgnc/dgnc_neo.c +1 -3
@@ -1306,10 +1306,8 @@ static int neo_drain(struct tty_struct *tty, uint seconds)
 	/*
 	 * Go to sleep waiting for the tty layer to wake me back up when
 	 * the empty flag goes away.
-	 *
-	 * NOTE: TODO: Do something with time passed in.
 	 */
-	rc = wait_event_interruptible(un->un_flags_wait, ((un->un_flags & UN_EMPTY) == 0));
+	rc = wait_event_interruptible_timeout(un->un_flags_wait, ((un->un_flags & UN_EMPTY) == 0), msecs_to_jiffies(seconds * 1000));

Any reason you didn't properly wrap your line at the 80 column limit?

Please fix and resend.

thanks,

greg k-h