tty: n_gsm: fix closing multiplexer mode

From: Sascha Hauer
Date: Mon May 22 2017 - 04:15:16 EST


Properly closing the n_gsm multiplexer mode is currently not possible.
n_gsm used to send the disconnect command frame in the ttys close
path, but in recent kernels it's no longer possible to do so.

To fix this, remove the sending of disconnect frames from the n_gsm
close path. This means that the modem is still in multiplexing mode
though, so this may lead to problems while re-opening the modem later.
Document the possibilities we have to close the connection in the
Documentation/serial/n_gsm.txt document.

One possibility to close the multiplexing mode is to manually send a
disconnect frame before initialising multiplex mode. Since it's not so
nice that userspace has to know the layout of a disconnect frame,
the second patch introduces a disconnect ioctl which can be issued
right before closing the physical port during the first session.
This ioctl is only useful when during the second session it is known
the the first session has been closed properly, so I'm not sure
how useful it is to introduce such an ioctl.

Sascha

----------------------------------------------------------------
Sascha Hauer (2):
tty: n_gsm: do not send/receive in ldisc close path
tty: n_gsm: Add GSMIOC_DISCONNECT ioctl to disconnect the multiplexer

Documentation/serial/n_gsm.txt | 13 ++++++++++
drivers/tty/n_gsm.c | 56 ++++++++++++++++++++++++++++--------------
include/uapi/linux/gsmmux.h | 1 +
3 files changed, 51 insertions(+), 19 deletions(-)