mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Russ Gorby <russ.gorby@intel.com>
To: Greg Kroah-Hartman <gregkh@suse.de>,
	Russ Gorby <russ.gorby@intel.com>,
	linux-kernel@vger.kernel.org
Cc: suhail.ahmed@intel.com, russ.gorby@intel.com
Subject: [PATCHv2 4/7] tty: n_gsm: initiate close of all DLCIs during mux shutdown
Date: Fri,  3 Jun 2011 16:43:59 -0700	[thread overview]
Message-ID: <1307144642-5915-5-git-send-email-russ.gorby@intel.com> (raw)
In-Reply-To: <[PATCHv2 0/5] N_GSM patchset : 06/03/2011: v2>

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@intel.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


  parent reply	other threads:[~2011-06-03 23:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <[PATCHv2 0/5] N_GSM patchset : 06/03/2011: v2>
2011-06-03 23:43 ` [PATCHv2 0/5] N_GSM patchset : 06/03/2011: v2 Russ Gorby
2011-06-06 23:35   ` Greg KH
2011-06-03 23:43 ` [PATCHv2 1/7] tty: n_gsm: Add raw-ip support Russ Gorby
2011-06-03 23:43 ` [PATCHv2 2/7] tty: n_gsm: expose gsmtty device nodes at ldisc open time Russ Gorby
2011-06-03 23:43 ` [PATCHv2 3/7] tty: n_gsm: Added refcount usage to gsm_mux and gsm_dlci structs Russ Gorby
2011-06-03 23:43 ` Russ Gorby [this message]
2011-06-03 23:44 ` [PATCHv2 5/7] tty: n_gsm: Fixed NULL ptr OOPs in tty_write_room() Russ Gorby
2011-06-03 23:44 ` [PATCHv2 6/7] tty: n_gsm: Fixed logic to decode break signal in modem status Russ Gorby
2011-06-03 23:44 ` [PATCHv2 7/7] char: n_gsm: improper skb_pull() use was leaking framed data Russ Gorby

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1307144642-5915-5-git-send-email-russ.gorby@intel.com \
    --to=russ.gorby@intel.com \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=suhail.ahmed@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome