[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1307127821-21665-5-git-send-email-russ.gorby@intel.com>
Date: Fri, 3 Jun 2011 12:03:40 -0700
From: Russ Gorby <russ.gorby@...el.com>
To: Greg Kroah-Hartman <gregkh@...e.de>,
Russ Gorby <russ.gorby@...el.com>, linux-kernel@...r.kernel.org
Cc: suhail.ahmed@...el.com, russ.gorby@...el.com
Subject: [PATCH 4/5] tty: n_gsm: initiate close of all DLCIs during mux shutdown
Although DLCI-0 is closed during ldisc close, we found the
applications were better served when open DLCI shutdowns where
initiated at that time as well.
initiated shutdown of all DLCI during ldisc close.
Signed-off-by: Russ Gorby <russ.gorby@...el.com>
---
drivers/tty/n_gsm.c | 30 +++++++++++++++++++++++-------
1 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
index c8a43de..22c844d 100644
--- a/drivers/tty/n_gsm.c
+++ b/drivers/tty/n_gsm.c
@@ -43,6 +43,8 @@
#include <linux/sched.h>
#include <linux/interrupt.h>
#include <linux/tty.h>
+#include <linux/timer.h>
+#include <linux/wait.h>
#include <linux/ctype.h>
#include <linux/mm.h>
#include <linux/string.h>
@@ -1979,6 +1981,7 @@ static void gsm_error(struct gsm_mux *gsm,
void gsm_cleanup_mux(struct gsm_mux *gsm)
{
int i;
+ int t;
struct gsm_dlci *dlci = gsm->dlci[0];
struct gsm_msg *txq;
@@ -1996,14 +1999,27 @@ void gsm_cleanup_mux(struct gsm_mux *gsm)
del_timer_sync(&gsm->t2_timer);
/* Now we are sure T2 has stopped */
- if (dlci) {
- dlci->dead = 1;
- gsm_dlci_begin_close(dlci);
- wait_event_interruptible(gsm->event,
- dlci->state == DLCI_CLOSED);
- }
/* Free up any link layer users */
- for (i = 0; i < NUM_DLCI; i++)
+ for (i = NUM_DLCI-1; i >= 0; i--) {
+ dlci = gsm->dlci[i];
+ if (dlci) {
+ if (i != 0)
+ gsm_dlci_begin_close(dlci);
+ else {
+ dlci->dead = 1;
+ gsm_dlci_begin_close(dlci);
+ t = wait_event_timeout(gsm->event,
+ dlci->state == DLCI_CLOSED,
+ gsm->t2 * HZ / 100);
+ if (!t) {
+ pr_info("%s: timeout dlci0 close",
+ __func__);
+ gsm_dlci_close(dlci);
+ }
+ }
+ }
+ }
+ for (i = NUM_DLCI-1; i >= 0; i--)
if (gsm->dlci[i])
gsm_dlci_release(gsm->dlci[i]);
/* Now wipe the queues */
--
1.7.0.4
--
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