misc: ts27010: Propogate Error to Userspace on USB disconnect
authorAmol Bhatkar--NJ05 <amolbhatkar@motorola.com>
Wed, 24 Nov 2010 01:31:13 +0000 (17:31 -0800)
committerBenoit Goby <benoit@android.com>
Wed, 1 Dec 2010 23:27:02 +0000 (15:27 -0800)
- Propogate error to userspace on ttyUSB disconnect
- Set Mux open/disconnect retry to 1 to reduce recovery time.

Change-Id: I2b381299d36660480cfc60faffeb710685ccaaf8
Signed-off-by: Amol Bhatkar <amolbhatkar@motorola.com>
drivers/misc/ts27010mux/ts27010_ldisc.c
drivers/misc/ts27010mux/ts27010_mux.c

index 586a5183eabaec2d70639ab44c873fa09027717c..2fc89b25a134efeef872787266dfc301aad841e5 100644 (file)
@@ -159,7 +159,18 @@ static unsigned int ts27010_ldisc_poll(struct tty_struct *tty,
                                       struct file *file,
                                       poll_table *wait)
 {
-       return 0;
+       unsigned int mask = 0;
+
+       poll_wait(file, &tty->read_wait, wait);
+       poll_wait(file, &tty->write_wait, wait);
+       if (tty_hung_up_p(file))
+               mask |= POLLHUP;
+       if (!tty_is_writelocked(tty) && tty_write_room(tty) > 0)
+               mask |= POLLOUT | POLLWRNORM;
+
+       return mask;
+
+
 }
 
 /*
index 3c6f48cd4723f79c7e21ef547fb4ecb8cc6000bb..e302c60f2ef77f5baa132a94dde96c32244a361f 100644 (file)
@@ -948,7 +948,8 @@ static int ts0710_close_channel(u8 dlci)
        }
 
        d->state = DISCONNECTING;
-       try = 3;
+       /* Reducing retry to improve recovery times on BP panic/powercycle */
+       try = 1;
        while (try--) {
                ts27010_send_disc(ts0710, dlci);
                mutex_unlock(&d->lock);
@@ -1067,7 +1068,8 @@ int ts0710_open_channel(u8 dlci)
 
        /* we are the first to try to open the dlci */
        d->state = CONNECTING;
-       try = dlci == 0 ? 10 : 3;
+       /* userspace already has a retry mechanism, not needed here */
+       try = dlci == 0 ? 10 : 1;
        while (try--) {
                ts27010_send_sabm(ts0710, dlci);