From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: AB8JxZqaeHj7crsjSccNViGbQrdpTRws1jXGqEo17P5BsDUIYKKP8McaUB+MX4j8eKyaRIyxStpQ ARC-Seal: i=1; a=rsa-sha256; t=1525116362; cv=none; d=google.com; s=arc-20160816; b=YjLq1jRgnpBJHdJQ76zB8VaMVehQDjGj958YN95nKarp07i5tKhHsIf7hctr2Bs3nf XiiwOxWK+SBN+nc9XXj9R/tiEgJMlMNoLBhF+JmTEMnQGm2H2n3jkYf/s7+M3p64s5Fx JJ0J8GNa1gHRt5UfNR5Jcwu4+C0dgc0Fz7KmcYpiIG1Q6xkwzHEVyMMViIBDWw3buHVm cOrAWmmq9X8Hxtn0eNABzIlu8KIbGHeHwlVUdYVx02pxWoV1qiUgqcwmca0NB+KguctW +yY//wOmj+turVB3aOxjfuon7emKICGGy/hpVidIjRToeQp3Xt1XzfD/oyqMfGz3GkaR /Vwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:references:in-reply-to:message-id:date :subject:cc:to:from:dmarc-filter:arc-authentication-results; bh=IFcBjhT5ax87mJAgwUMFF59Nd6moLgH5aEtF2Qi7DRw=; b=HLVXiVmA8eZ8Rdd5lsnRz5wp8ZMZXIsBYYmt1H5eEpb/lal9TyuN6WEGq98AiO2E89 1tqLFkW4ow/rcoLpQyUWVI5//1UG7QxsN+pXrz9PMg1xj7xgiGK6cf8NA5zbQtgL+mer J0cjPWWDZeBLJ2pSJEQINAdebvkx1uzuHfUq/yZosF23XiA4Lz4dRgJa29WNNzmJtZW8 +rD7UJjVBHJTDq/P0Zlb9PthQdfeWU5uVaznX/KkoAzy5GXxh5y1XAHG3X17haFA+EVd WpgD6kYWfsNdoE4+eun9vnUFHsChmxt2KT1+lWeTqwRFNZ/gy30p0R+OSjugYBGF3KdD a+xQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of srs0=k66p=ht=linuxfoundation.org=gregkh@kernel.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=SRS0=K66P=HT=linuxfoundation.org=gregkh@kernel.org Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of srs0=k66p=ht=linuxfoundation.org=gregkh@kernel.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=SRS0=K66P=HT=linuxfoundation.org=gregkh@kernel.org DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C10AE22DC1 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=fail smtp.mailfrom=gregkh@linuxfoundation.org From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, linux-serial@vger.kernel.org, Alan Cox , Dan Williams , Jiri Prchal , Jiri Slaby , Marcel Partap , Merlijn Wajer , Michael Nazzareno Trimarchi , Michael Scott , Pavel Machek , Peter Hurley , Russ Gorby , Sascha Hauer , Sebastian Reichel , Tony Lindgren Subject: [PATCH 4.4 18/44] tty: n_gsm: Fix DLCI handling for ADM mode if debug & 2 is not set Date: Mon, 30 Apr 2018 12:24:29 -0700 Message-Id: <20180430190947.072041702@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180430190946.093694747@linuxfoundation.org> References: <20180430190946.093694747@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-LABELS: =?utf-8?b?IlxcU2VudCI=?= X-GMAIL-THRID: =?utf-8?q?1599200279987877864?= X-GMAIL-MSGID: =?utf-8?q?1599200414893753302?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Tony Lindgren commit b2d89ad9c9682e795ed6eeb9ed455789ad6cedf1 upstream. At least on droid 4 with control channel in ADM mode, there is no response to Modem Status Command (MSC). Currently gsmtty_modem_update() expects to have data in dlci->modem_rx unless debug & 2 is set. This means that on droid 4, things only work if debug & 2 is set. Let's fix the issue by ignoring empty dlci->modem_rx for ADM mode. In the AMD mode, CMD_MSC will never respond and gsm_process_modem() won't get called to set dlci->modem_rx. And according to ts_127010v140000p.pdf, MSC is only relevant if basic option is chosen, so let's test for that too. Fixes: ea3d8465ab9b ("tty: n_gsm: Allow ADM response in addition to UA for control dlci") Cc: linux-serial@vger.kernel.org Cc: Alan Cox Cc: Dan Williams Cc: Jiri Prchal Cc: Jiri Slaby Cc: Marcel Partap Cc: Merlijn Wajer Cc: Michael Nazzareno Trimarchi Cc: Michael Scott Cc: Pavel Machek Cc: Peter Hurley Cc: Russ Gorby Cc: Sascha Hauer Cc: Sebastian Reichel Signed-off-by: Tony Lindgren Cc: stable Signed-off-by: Greg Kroah-Hartman --- drivers/tty/n_gsm.c | 11 +++++++++++ 1 file changed, 11 insertions(+) --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -2891,11 +2891,22 @@ static int gsmtty_modem_update(struct gs static int gsm_carrier_raised(struct tty_port *port) { struct gsm_dlci *dlci = container_of(port, struct gsm_dlci, port); + struct gsm_mux *gsm = dlci->gsm; + /* Not yet open so no carrier info */ if (dlci->state != DLCI_OPEN) return 0; if (debug & 2) return 1; + + /* + * Basic mode with control channel in ADM mode may not respond + * to CMD_MSC at all and modem_rx is empty. + */ + if (gsm->encoding == 0 && gsm->dlci[0]->mode == DLCI_MODE_ADM && + !dlci->modem_rx) + return 1; + return dlci->modem_rx & TIOCM_CD; }