Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp5188333imm; Tue, 16 Oct 2018 06:35:37 -0700 (PDT) X-Google-Smtp-Source: ACcGV61FL4Ww9LiqjOu4sLAE/eyGlBLfgw+7BNJtIeJJO/Cj3YltNLLTcx9fAwV2Cn8zX823FoLK X-Received: by 2002:a63:5726:: with SMTP id l38-v6mr20360215pgb.118.1539696937404; Tue, 16 Oct 2018 06:35:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539696937; cv=none; d=google.com; s=arc-20160816; b=VMFwkU9NKRG7FvBDIRf+2YhKXrEyGTnFTzK+INdRlQgHknGGn2hWmJuVAJ54E9wH+u xJqqFdNZUgA4Ohg817T3BxIBvWysI5cr1C8Znjk7G04lg+oT1O7/yrg47XN7IThU5vIa E4cLm1zHB1VUA7T3HZc2fiFuwwCA/XxHbAWC/E19Phpk8wGAuUZgD6aBBWNQvuRJVqMJ hP6cVHk1lNZcalyn515za0jhnJXH0R2+rt9Hh1Msd8HduURf9ZbHxuXk1eaQwX4PIFoy veMCYLXGsqKdVK+DulI8EHMEFG79imrM8kEmtj/PzR0mopMdjjqCWvsyjKAzosMLRMAq 5glA== 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=wvkfVMdQ4rIspq6r2MpVilkXsJLK2YTLRyqMMtrVRlGKye7lwB9eAG/UUqnCezWcUr pDWh/BYKuYatECz39o23+eQ/ogerJcup1OLrGhjUGHzP5SpTJcNJwQx/HWRzYLFEVeSO fczEG9fJz+Ix4lPuP64a8LDWbRvPyzEG40GVfrvjVOCyXnAApou3j0NU/R2i4FuHAhu/ Yj1R4pmExsmqk638ZCzZ87tlCuCaK3NC9WtiJWrXHiqOphRpmqST07O3BcGCCDcVzlKk PomcF8SpZAsVEFIg5xAHBSFj97c4re1Z0jsdBSyPp3n8rerrcaW5zEQ9iMUX55tfEjB6 sLFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b="J/wqF8ru"; dkim=pass header.i=@codeaurora.org header.s=default header.b=I67Qw0bE; 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 f6-v6si14676720plf.164.2018.10.16.06.35.20; Tue, 16 Oct 2018 06:35:37 -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="J/wqF8ru"; dkim=pass header.i=@codeaurora.org header.s=default header.b=I67Qw0bE; 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 S1727155AbeJPVYu (ORCPT + 99 others); Tue, 16 Oct 2018 17:24:50 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:45710 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727016AbeJPVYt (ORCPT ); Tue, 16 Oct 2018 17:24:49 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 207F060B11; Tue, 16 Oct 2018 13:34:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1539696859; bh=InM/hjtFO+AKpCBvS2k7elQU/r9rpSlchG6DDQ9+3qU=; h=From:To:Cc:Subject:Date:From; b=J/wqF8ruCYwy5fSW5TYz773aSSRemu/QVAfoTh388BDkND7Qu+bSX8R+u5XE6stoU f+GXWkX6RNjTkuZUl4RPkjTv6ER/nOeT/JfvnxxaFKy+gHt/Y8DIimzuBLCpfVJVto deDufeiYJjSqeKyxms471knUOO3NMqigDt+ClTsU= 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 48FA76058E; Tue, 16 Oct 2018 13:34:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1539696858; bh=InM/hjtFO+AKpCBvS2k7elQU/r9rpSlchG6DDQ9+3qU=; h=From:To:Cc:Subject:Date:From; b=I67Qw0bEXLeZEepYtOzxD4PPhUqZ6t9Mpf4tjafJFQkjjE7/raZ7SbfUsWeSG1sJy K/Aq1AApm59bDvHyzTg0tiW0Y53+L3De4tRD4WV4MKS91ukZ25ubAINi6KqT0M/wep AHu2lMSEyA3pKaQZ1MPp3TXCQ1GtMAh3nQR1gqSU= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 48FA76058E 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: Add suspend support to non console UART Date: Tue, 16 Oct 2018 19:04:08 +0530 Message-Id: <1539696848-21988-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