Received: by 10.192.165.148 with SMTP id m20csp4187316imm; Mon, 30 Apr 2018 13:28:10 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqLgtqnBcWtviRT7n0pbS93AzWIL5EsNj3DAxLSzM7S0WK19nOd3Tiwjat+BpNb7ZpkGZd4 X-Received: by 10.98.150.150 with SMTP id s22mr12744050pfk.191.1525120090378; Mon, 30 Apr 2018 13:28:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525120090; cv=none; d=google.com; s=arc-20160816; b=V64t6tkVA7bSOQu5KtTAsTC26Z0OEo4GOmoeeHwDAThoPfckXN87MZarf5exugG6HO I6H05ko0BpkDJgm3TE4rJBnYUFZwRtTlA9z/h3+pbgqHuM2cn7wfor/D8xdwRw57TEMo aGrVBGPsLAaBaP4J58kg9AVppD1z6bT9vsz+vShhru1WI/tP0OtjGYIUSnbr5bsrku91 YMHWbpqRRxmpxa4Z0Bqu1rV1nKmX8WwqgquCgXuqgd7J6ibfglcd4Wx0UouQ3Ic4Cvv2 v5P7GIt9ftVRhWtLvDWClghWGLDR3NCAaCuAguWOZG2gTdIuU7CjzR/w9x9r4uv4YSi2 9qmg== 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=EGeAdcBhBxYXYPpOsmpE7/pUY6feaksDZZnGzJNZZ3E=; b=m0x5Axpd1AYpeaO9FLwUBADCzmeuICCG7tAfBbsPduCOMw7BhotAy1r6UFhFu+tWdQ 7PJyxLyzvf45+feOWvVDhEWVXiuuNc3xSfDfH9qmAh9iKUv+olM8QAZxwvtZ3sMjOSE9 ji8Idl64nPdK3xTAhWmfrfIiuUimln1CuEDbxVwKeTMV1AtqnarSYklAFUco8t3ZJgYD oLlIX9hP5Rk80hwl4dKfql16PL4rmEDbWLlHRjqbaocrIq4zxrPqrV1N3AuMrn8gZhBt QQ7PI1ZrodwsPsamQagaM/8no0vbqbgjGwduojXegwbv67esyX3VJNfRO2vLw/bzvKA4 GKdA== 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 i21si5602928pfj.190.2018.04.30.13.27.56; Mon, 30 Apr 2018 13:28:10 -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 S1755825AbeD3U1a (ORCPT + 99 others); Mon, 30 Apr 2018 16:27:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:60008 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755212AbeD3T0Y (ORCPT ); Mon, 30 Apr 2018 15:26:24 -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 0884722E01; Mon, 30 Apr 2018 19:26:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0884722E01 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.9 22/61] tty: n_gsm: Fix DLCI handling for ADM mode if debug & 2 is not set Date: Mon, 30 Apr 2018 12:24:25 -0700 Message-Id: <20180430183953.203892608@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180430183951.312721450@linuxfoundation.org> References: <20180430183951.312721450@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.9-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 @@ -2875,11 +2875,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; }