From 23d1358aecb51c943cb2aa3892d27ac5271b53a9 Mon Sep 17 00:00:00 2001 From: Amol Bhatkar--NJ05 Date: Tue, 23 Nov 2010 17:31:13 -0800 Subject: [PATCH] misc: ts27010: Propogate Error to Userspace on USB disconnect - 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 --- drivers/misc/ts27010mux/ts27010_ldisc.c | 13 ++++++++++++- drivers/misc/ts27010mux/ts27010_mux.c | 6 ++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/misc/ts27010mux/ts27010_ldisc.c b/drivers/misc/ts27010mux/ts27010_ldisc.c index 586a5183eaba..2fc89b25a134 100644 --- a/drivers/misc/ts27010mux/ts27010_ldisc.c +++ b/drivers/misc/ts27010mux/ts27010_ldisc.c @@ -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; + + } /* diff --git a/drivers/misc/ts27010mux/ts27010_mux.c b/drivers/misc/ts27010mux/ts27010_mux.c index 3c6f48cd4723..e302c60f2ef7 100644 --- a/drivers/misc/ts27010mux/ts27010_mux.c +++ b/drivers/misc/ts27010mux/ts27010_mux.c @@ -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); -- 2.34.1