Received: by 10.192.165.148 with SMTP id m20csp4192141imm; Mon, 30 Apr 2018 13:33:29 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrWvx6a8vne4alc7GTI+k3dYS7IgsbGTqSw1cEKdGEO0AXu3zcJUMFjTTa3hLCLURnT+Eb5 X-Received: by 2002:a17:902:8692:: with SMTP id g18-v6mr13715247plo.152.1525120409700; Mon, 30 Apr 2018 13:33:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525120409; cv=none; d=google.com; s=arc-20160816; b=Blf9U4aE0ILn7K9b9/+LtcZZKq7YVcA3EQjIGtcb21jblzshWl3tyJ4PDEakEpBtt8 0DGSE6cYPYcyX22J5FAkqcfRe7Z35AKbqrnvchoJICWT/4w4XIwRmTO9B9BkAt4R6AEH UxHSN46RqfRgE8I3Spq3WWwguHbclN5A8ZTwF6Z1H9HHzy2k8AnDqu4NhlXq/LcE4HTG +nR+60L75hD+C66oeCNd1TPazFv8foH+BgUgudQ05AWoUST2d3efbZFS5gtjnKUrXaPO C843CP0fTW0qriNGIsvY24SAye7HzitsiQeQ94ig1+Ph1GP2HgmSH6ZVEPelwucxQJQE rsGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dmarc-filter :arc-authentication-results; bh=IFcBjhT5ax87mJAgwUMFF59Nd6moLgH5aEtF2Qi7DRw=; b=0zq3Ow7Mr9TWKRndmBmVB+JwaTUUaQiVDHqjzy3m4kgvrrSOnT8xiJQYWSgaQBRzLS CLPzLX9O0rGhn9BINQAISpJB1JSbMfrQNSQSaNOweAFeFgz8LdpM8lcD2aDdPmRnCL12 AoUUKiiHz7iU3zpqHetqCD5Az9xIq8ZEsU8gfo3pxdBiXPZrDL8hqhzRIFmuPyIIOEU5 /xmNJr/L4EWo4hwUlwP0TfxXHq+TPGE44b7u99gYX5rHzfOQyb/Sv2ndzyWQlxMryzTC 3r7rbUE5h+AtLhc7Tv3cpFiRU0EI/Q3EmpSl6x5xxlxBw1MhbRZgQyCVEI5dlmIksKut /zTA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x7-v6si7364358plw.3.2018.04.30.13.33.15; Mon, 30 Apr 2018 13:33:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755925AbeD3UdE (ORCPT + 99 others); Mon, 30 Apr 2018 16:33:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:59180 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755229AbeD3T0C (ORCPT ); Mon, 30 Apr 2018 15:26:02 -0400 Received: from localhost (unknown [104.132.1.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C10AE22DC1; Mon, 30 Apr 2018 19:26:01 +0000 (UTC) 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; }