Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp5231922imm; Tue, 16 Oct 2018 07:13:41 -0700 (PDT) X-Google-Smtp-Source: ACcGV6321+5pQNtvjw1AiDjckHQk8KS4z70EtkR2wTpBgH7x4czlxa/n8kKw7Wccf1U+O+e2RXZG X-Received: by 2002:a17:902:6a83:: with SMTP id n3-v6mr22027867plk.288.1539699221830; Tue, 16 Oct 2018 07:13:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539699221; cv=none; d=google.com; s=arc-20160816; b=MaHodBqHsLmIuHONYpPGTW89SMI0oOj4TX6s4ODlL4U3NihpUdmdyb0SkpgsrbOqZK TbDqsSHcJ2Q8ERbI6CYDuYdIZZA0YGV7/vWyGMEBsYSzgId0pliDfp15Rc7BY92BPcm0 myZXtcf6/k/UlhOySiPqztKFxafRq9xfYIXXi6xgMMWhIXeNqkXWiLFrQeel5uwUE02U omPcLuJ1U0a2/ikly0wFuKFMJN4IjPsh0AQcJpvbebtFvph+Cpydjyu8OyINftPnta6X VjlZiZ8yFiyXiGh19+2+e+0mmTY9wBvb5VpCpTtGmtJZ1bR0r3/g7iQG+RvdwE9nEouh MXvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dmarc-filter:dkim-signature:dkim-signature; bh=XLYFcHq7d7/kDJn04pZdofejyGn0Jvdu5MlYhTOE6j0=; b=OU7KlrLor2FRvejHQYiG9uVz03JFPawH9/np50qCIHUtAGlFqafYrqvAUMA1KhYJQ1 LuzqSI/Jf7/9mpS7jj+y7Um87l4GbctihcySDtFPv4q9fCkCIyzabGviVIv35vB0j7Qb UfNaoG2zbpG3zGnVpg0/0gsskHWRexPhnsBWlbK6fsKJXLTw2O4PtWvzlouCF39DI7vi QR7eiIyR2P0rS1SFt+Qs0hx5LahP4aL0jmh0rlgr8XJ5FEibqcNtxmMM5ZfFVr42+9Ns WvukH9uuk4StLtuoniQw2dEth/PXvnKF++WeFoomzjf/eM/YfCFBeyhWl1nn8DblifTu x/jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=Y5Ybj0Qc; dkim=pass header.i=@codeaurora.org header.s=default header.b=Zm5kbe5g; 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 z27-v6si13905624pgk.297.2018.10.16.07.13.25; Tue, 16 Oct 2018 07:13:41 -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; dkim=pass header.i=@codeaurora.org header.s=default header.b=Y5Ybj0Qc; dkim=pass header.i=@codeaurora.org header.s=default header.b=Zm5kbe5g; 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 S1727160AbeJPWBw (ORCPT + 99 others); Tue, 16 Oct 2018 18:01:52 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:44978 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726978AbeJPWBw (ORCPT ); Tue, 16 Oct 2018 18:01:52 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 3839D60769; Tue, 16 Oct 2018 14:11:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1539699073; bh=InM/hjtFO+AKpCBvS2k7elQU/r9rpSlchG6DDQ9+3qU=; h=From:To:Cc:Subject:Date:From; b=Y5Ybj0QcKg+yG0raAWLcZsGrc9tCbatIlQYTN1HPLRuMYpPYh90WEQ4Os/4QGAixn 3lH+BuROgMPsA/mHxtuvJZOvS9HI3pdvR0b5VUW/u0+KwOGkzXjigUOCdwhTbwWzLD 1JmiEwUD+yFaggNiHJ1x5nTBOJWyrGhynl00wR6M= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED autolearn=no autolearn_force=no version=3.4.0 Received: from msavaliy-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: msavaliy@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 6332360558; Tue, 16 Oct 2018 14:11:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1539699072; bh=InM/hjtFO+AKpCBvS2k7elQU/r9rpSlchG6DDQ9+3qU=; h=From:To:Cc:Subject:Date:From; b=Zm5kbe5gUHjflDk7QjDFyNhGDrSLYd7mOFBMbD0k+TtAmTbVYF17/nuemG9i2dfgI 4QK2Atrtb/71f/9wiWo6++4s6gny+AtmazL0N9lXBzGKi+b4pIauCZ/mIKJUkkY6Zl YYSuSZv+k8d8dgMH44078/y1Rhi531E4amJeMrQw= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 6332360558 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=msavaliy@codeaurora.org From: "Mukesh, Savaliya" To: alokc@codeaurora.org, dianders@google.com, Greg Kroah-Hartman , Jiri Slaby , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Mukesh Kumar Savaliya Subject: [PATCH] tty: serial: qcom_geni_serial: Rectify UART suspend mechanism Date: Tue, 16 Oct 2018 19:41:00 +0530 Message-Id: <1539699060-3055-1-git-send-email-msavaliy@codeaurora.org> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mukesh Kumar Savaliya UART driver checks for the PM state and denies suspend if state is ACTIVE. This makes UART to deny suspend when client keeps port open which is not correct. Instead follow framework and obey suspend-resume callbacks. Signed-off-by: Mukesh Kumar Savaliya --- drivers/tty/serial/qcom_geni_serial.c | 36 ++++++----------------------------- 1 file changed, 6 insertions(+), 30 deletions(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index 29ec343..93598d7 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -1327,49 +1327,25 @@ static int qcom_geni_serial_remove(struct platform_device *pdev) return 0; } -static int __maybe_unused qcom_geni_serial_sys_suspend_noirq(struct device *dev) +static int __maybe_unused qcom_geni_serial_sys_suspend(struct device *dev) { struct qcom_geni_serial_port *port = dev_get_drvdata(dev); struct uart_port *uport = &port->uport; - if (uart_console(uport)) { - uart_suspend_port(uport->private_data, uport); - } else { - struct uart_state *state = uport->state; - /* - * If the port is open, deny system suspend. - */ - if (state->pm_state == UART_PM_STATE_ON) - return -EBUSY; - } - - return 0; + return uart_suspend_port(uport->private_data, uport); } -static int __maybe_unused qcom_geni_serial_sys_resume_noirq(struct device *dev) +static int __maybe_unused qcom_geni_serial_sys_resume(struct device *dev) { struct qcom_geni_serial_port *port = dev_get_drvdata(dev); struct uart_port *uport = &port->uport; - if (uart_console(uport) && - console_suspend_enabled && uport->suspended) { - uart_resume_port(uport->private_data, uport); - /* - * uart_suspend_port() invokes port shutdown which in turn - * frees the irq. uart_resume_port invokes port startup which - * performs request_irq. The request_irq auto-enables the IRQ. - * In addition, resume_noirq implicitly enables the IRQ and - * leads to an unbalanced IRQ enable warning. Disable the IRQ - * before returning so that the warning is suppressed. - */ - disable_irq(uport->irq); - } - return 0; + return uart_resume_port(uport->private_data, uport); } static const struct dev_pm_ops qcom_geni_serial_pm_ops = { - SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(qcom_geni_serial_sys_suspend_noirq, - qcom_geni_serial_sys_resume_noirq) + SET_SYSTEM_SLEEP_PM_OPS(qcom_geni_serial_sys_suspend, + qcom_geni_serial_sys_resume) }; static const struct of_device_id qcom_geni_serial_match_table[] = { -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project