[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-id: <28015270222408028683@wsc.cz>
Date: Sun, 15 Apr 2007 19:45:02 +0200 (CEST)
From: Jiri Slaby <jirislaby@...il.com>
To: Jan "Yenya" Kasprzak <kas@...muni.cz>
Cc: <osv@...ad.com>
Subject: [RFC 1/1] Char: mxser_new, fix TIOCMIWAIT
Jiri Slaby wrote:
> On 4/14/07, Jan Yenya Kasprzak <kas@...muni.cz> wrote:
> > Jiri Slaby wrote:
> > : ioctl(fd, TIOCMIWAIT, TIOCM_CD);
> [...]
> > Hmm, I have tried to run this, and got a machine lockup, and after
> > a minute or so the following has been printed to the console:
>
> Hmm, the driver got shot full of holes, there's missing schedule() in
> ioctl of both drivers. I'll post a patch in the morning or during the
> day.
The attached patch should fix TIOCMIWAIT issue. Could you test it?
--
mxser_new, fix TIOCMIWAIT
Signed-off-by: Jiri Slaby <jirislaby@...il.com>
---
commit e5ef19f01ffa9b6105f10fc939a07ceb3c652ed9
tree 1567fc37283da0c8436ee43a323f91140add7e73
parent a00e6d6d5f44defe9c01be2c6a3fdf1c890917c8
author Jiri Slaby <jirislaby@...il.com> Sun, 15 Apr 2007 19:38:46 +0200
committer Jiri Slaby <jirislaby@...il.com> Sun, 15 Apr 2007 19:38:46 +0200
drivers/char/mxser_new.c | 38 +++++++++-----------------------------
1 files changed, 9 insertions(+), 29 deletions(-)
diff --git a/drivers/char/mxser_new.c b/drivers/char/mxser_new.c
index 0086b73..02b6141 100644
--- a/drivers/char/mxser_new.c
+++ b/drivers/char/mxser_new.c
@@ -1767,43 +1767,23 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file,
* (use |'ed TIOCM_RNG/DSR/CD/CTS for masking)
* Caller should use TIOCGICOUNT to see which one it was
*/
- case TIOCMIWAIT: {
- DECLARE_WAITQUEUE(wait, current);
- int ret;
+ case TIOCMIWAIT:
mx_lock(info, flags);
- cprev = info->icount; /* note the counters on entry */
+ cnow = info->icount; /* note the counters on entry */
mx_unlock(info, flags);
- add_wait_queue(&info->delta_msr_wait, &wait);
- while (1) {
+ wait_event_interruptible(info->delta_msr_wait, ({
+ cprev = cnow;
mx_lock(info, flags);
cnow = info->icount; /* atomic copy */
mx_unlock(info, flags);
- set_current_state(TASK_INTERRUPTIBLE);
- if (((arg & TIOCM_RNG) &&
- (cnow.rng != cprev.rng)) ||
- ((arg & TIOCM_DSR) &&
- (cnow.dsr != cprev.dsr)) ||
- ((arg & TIOCM_CD) &&
- (cnow.dcd != cprev.dcd)) ||
- ((arg & TIOCM_CTS) &&
- (cnow.cts != cprev.cts))) {
- ret = 0;
- break;
- }
- /* see if a signal did it */
- if (signal_pending(current)) {
- ret = -ERESTARTSYS;
- break;
- }
- cprev = cnow;
- }
- current->state = TASK_RUNNING;
- remove_wait_queue(&info->delta_msr_wait, &wait);
+ ((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) ||
+ ((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) ||
+ ((arg & TIOCM_CD) && (cnow.dcd != cprev.dcd)) ||
+ ((arg & TIOCM_CTS) && (cnow.cts != cprev.cts));
+ }));
break;
- }
- /* NOTREACHED */
/*
* Get counter of input serial line interrupts (DCD,RI,DSR,CTS)
* Return: write counters to the user passed counter struct
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists