From patchwork Tue Nov 27 04:49:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pi-Hsun Shih X-Patchwork-Id: 10699713 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B14A813BF for ; Tue, 27 Nov 2018 04:51:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9FA962A7BC for ; Tue, 27 Nov 2018 04:51:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 915932A7D1; Tue, 27 Nov 2018 04:51:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3E9852A7BC for ; Tue, 27 Nov 2018 04:51:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=h+LdD6d8V2sX7ld1ARPx391mC1tTBT5cmggiteef5kU=; b=CT45aF/SM7DTgK UH85ql1oxogPZZgiRK0Ytopy+Q8+6FYcYwmp8oH+Y3j8581StV7RRwkvCMbXDGbu/FNHuM/tkNeZz 3nj8A3d/O4nUlouI0L0U/Bfs2p9uFWinDZ4AClYTQL9CeUcVinQKOK7fmnGdqdggu70jJNi65IonF qSw/W8z3q0f7YDDfn6nckE268zffkwbrluZfq5OtArVbCy2gxZwI68By9dd/LqqR31V7pXY7izxe5 xK2+W6mbbJYZCwr/CioTHTJBdkr+ZZ+j5piBKhu7/JUanqConv2vMqsQq/d7UW9heZ7MZzehXXuJD RUI/h8g3dVFyou1Om2Zg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gRVKk-0007UY-As; Tue, 27 Nov 2018 04:50:50 +0000 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gRVKf-0007Rt-H8 for linux-arm-kernel@lists.infradead.org; Tue, 27 Nov 2018 04:50:47 +0000 Received: by mail-pg1-x544.google.com with SMTP id w6so7262191pgl.6 for ; Mon, 26 Nov 2018 20:50:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=yL4PxkCnnwRXSRf/RUNTt7B9beLsEOSxMycnGtl5vO0=; b=kr9E7P5rEKeJsGjS9iYegj81caGmrU5npROkRpqSUAw4FnBHH0lOiMtdPCjiPAs8zY MdUgB51sMj0c/MEBUK0lmVn6y4QGPh10NqwbrTX+NsJF6GFO5vdomxnk7ByLurGOzJEh lCsUc6mQfEFu9xbuCLNdpcP7wEn50z9BixzWM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=yL4PxkCnnwRXSRf/RUNTt7B9beLsEOSxMycnGtl5vO0=; b=CXl7fo/CHAwXX97cklg+w+esq+YKnqx9gLPEhVDPh6VuW7diwWgN7F2JZVPqmg+SDG hzGfUFLdZnWKx6muliz7dWyX7iHQU9qCbybt2JGCkuXSJjfnqk4L1NjMPrwOEHTUi97u OIZZsnub+3QG2QZ5SCTXcZGTBhSdGgFcD289amK+RX0y41Avryzi76f3371uzuZBHzVh 20yiZlq0WFn6PyGUCLSSRpgEn4gIavy6CnUUk9lg+B3x5UkZSsxAyLKW9kh0soThhmGr lc9w9oJZwtBc+KSsj7a0Uim3rBp9yiUQeowBG2Lz3vzIFNwEmOFWjko0XHNVGClO8ZcS 34cw== X-Gm-Message-State: AGRZ1gI50/sJKsjOZC4V42vniibC9OtRLb5BQqTNb0esfOkynqlAjwH8 hifYw0/AUeUCFU88F72xGT+juQ== X-Google-Smtp-Source: AJdET5ceT5FmBEB9jXiY987LDEfyAHsID3c6C3zlLPkpZjogACe1zoJ5/8U1LMcTMUxOEZzAfdhQfg== X-Received: by 2002:a62:ca9c:: with SMTP id y28mr31183704pfk.236.1543294231722; Mon, 26 Nov 2018 20:50:31 -0800 (PST) Received: from pihsun-z840.tpe.corp.google.com ([2401:fa00:1:10:7889:7a43:f899:134c]) by smtp.googlemail.com with ESMTPSA id z7sm4115875pga.6.2018.11.26.20.50.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Nov 2018 20:50:31 -0800 (PST) From: Peter Shih To: Subject: [PATCH] tty: serial: 8250_mtk: always resume the device in probe. Date: Tue, 27 Nov 2018 12:49:50 +0800 Message-Id: <20181127044952.45703-1-pihsun@chromium.org> X-Mailer: git-send-email 2.20.0.rc0.387.gc7a69e6b6c-goog MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181126_205045_581060_C5735C25 X-CRM114-Status: GOOD ( 15.53 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pihsun@chromium.org, Greg Kroah-Hartman , linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-serial@vger.kernel.org, Jiri Slaby , Matthias Brugger , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP serial8250_register_8250_port calls uart_config_port, which calls config_port on the port before it tries to power on the port. So we need the port to be on before calling serial8250_register_8250_port. Change the code to always do a runtime resume in probe before registering port, and always do a runtime suspend in remove. This basically reverts the change in commit 68e5fc4a255a ("tty: serial: 8250_mtk: use pm_runtime callbacks for enabling"), but still use pm_runtime callbacks. Fixes: 68e5fc4a255a ("tty: serial: 8250_mtk: use pm_runtime callbacks for enabling") Signed-off-by: Peter Shih --- drivers/tty/serial/8250/8250_mtk.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c index dd5e1cede2b58..c3f933d10295e 100644 --- a/drivers/tty/serial/8250/8250_mtk.c +++ b/drivers/tty/serial/8250/8250_mtk.c @@ -213,17 +213,17 @@ static int mtk8250_probe(struct platform_device *pdev) platform_set_drvdata(pdev, data); - pm_runtime_enable(&pdev->dev); - if (!pm_runtime_enabled(&pdev->dev)) { - err = mtk8250_runtime_resume(&pdev->dev); - if (err) - return err; - } + err = mtk8250_runtime_resume(&pdev->dev); + if (err) + return err; data->line = serial8250_register_8250_port(&uart); if (data->line < 0) return data->line; + pm_runtime_set_active(&pdev->dev); + pm_runtime_enable(&pdev->dev); + return 0; } @@ -234,13 +234,11 @@ static int mtk8250_remove(struct platform_device *pdev) pm_runtime_get_sync(&pdev->dev); serial8250_unregister_port(data->line); + mtk8250_runtime_suspend(&pdev->dev); pm_runtime_disable(&pdev->dev); pm_runtime_put_noidle(&pdev->dev); - if (!pm_runtime_status_suspended(&pdev->dev)) - mtk8250_runtime_suspend(&pdev->dev); - return 0; }