From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753269AbbF2P4w (ORCPT ); Mon, 29 Jun 2015 11:56:52 -0400 Received: from mga14.intel.com ([192.55.52.115]:38749 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752755AbbF2P4o (ORCPT ); Mon, 29 Jun 2015 11:56:44 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,699,1427785200"; d="scan'208";a="736979914" Message-ID: <1435593236.25711.3.camel@tldlab125> Subject: [PATCH]: Mux n_gsm: Add a DLCI hangup state and callback From: Gwenn =?ISO-8859-1?Q?Bourr=E9e?= To: gregkh@linuxfoundation.org, jslaby@suse.cz Cc: linux-kernel@vger.kernel.org, linux-api@vger.kernel.org Date: Mon, 29 Jun 2015 17:53:56 +0200 X-Mailer: Evolution 3.10.4-0ubuntu2 Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id t5TFuwjU006719 Dear kernel tty maintainers, Please review the following patch: >>From 6e006bd522124d0e8a2f6075099a21f7051a426f Mon Sep 17 00:00:00 2001 From: Gwenn Bourree Date: Mon, 29 Jun 2015 17:26:01 +0200 Subject: [PATCH] Mux n_gsm: Add a DLCI hangup state and callback Use of asynchronous hangup instead of vhangup. Signed-off-by: Gwenn Bourree Signed-off-by: Gwenn Bourree Signed-off-by: Mustapha Ben Zoubeir Signed-off-by: Nicolas LOUIS Reviewed-by: Ravindran, Arun gsm; - if (dlci->state == DLCI_CLOSED || dlci->state == DLCI_CLOSING) + if (dlci->state == DLCI_CLOSED || dlci->state == DLCI_CLOSING || + dlci->state == DLCI_HANGUP) return; dlci->retries = gsm->n2; dlci->state = DLCI_CLOSING; @@ -1717,7 +1719,7 @@ static void gsm_dlci_release(struct gsm_dlci *dlci) gsm_destroy_network(dlci); mutex_unlock(&dlci->mutex); - tty_vhangup(tty); + tty_hangup(tty); tty_port_tty_set(&dlci->port, NULL); tty_kref_put(tty); @@ -2339,6 +2341,26 @@ static void gsmld_flush_buffer(struct tty_struct *tty) } /** + * gsmld_hangup - hangup the ldisc for this tty + * @tty: device + */ + +static int gsmld_hangup(struct tty_struct *tty) +{ + struct gsm_mux *gsm = tty->disc_data; + int i; + struct gsm_dlci *dlci; + + for (i = NUM_DLCI-1; i >= 0; i--) { + dlci = gsm->dlci[i]; + if (dlci) + dlci->state = DLCI_HANGUP; + } + + return 0; +} + +/** * gsmld_close - close the ldisc for this tty * @tty: device * @@ -2836,6 +2858,7 @@ static struct tty_ldisc_ops tty_ldisc_packet = { .name = "n_gsm", .open = gsmld_open, .close = gsmld_close, + .hangup = gsmld_hangup, .flush_buffer = gsmld_flush_buffer, .chars_in_buffer = gsmld_chars_in_buffer, .read = gsmld_read, --------------------------------------------------------------------- Intel Corporation SAS (French simplified joint stock company) Registered headquarters: "Les Montalets"- 2, rue de Paris, 92196 Meudon Cedex, France Registration Number: 302 456 199 R.C.S. NANTERRE Capital: 4,572,000 Euros This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies. {.n++%ݶw{.n+{G{ayʇڙ,jfhz_(階ݢj"mG?&~iOzv^m ?I