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: 10699711 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 A02E214E2 for ; Tue, 27 Nov 2018 04:50:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8E34C2A7BB for ; Tue, 27 Nov 2018 04:50:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 81E032A7BE; Tue, 27 Nov 2018 04:50:50 +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=ham 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 2E20F2A7BB for ; Tue, 27 Nov 2018 04:50:50 +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=v6ihHhbLQS8hCuVVxSEMeHxkdEpyyQqmOfJGOK0tjkQ=; b=PdUYW+bk0jB+Mi qKS0wuocq2hnnJE3IpOI/t1MOOgRvWBl3KdOnVpRK6l+awBjb4+uztAqabOq4plZhhF/lxQX3vxTj +tn37JDhgS79YPENBGnFLPrI1jdgmZcwTm7A1oB6EGC4KA+x4wjt+ZljjxBDRez896eM6uG+EiaAl 6vuLhYaX6CAEU9PT6S5OtR/xL2OGQqZmEDjZB9tNWWABnn2wKeNTf5cSwi7wrKe2ALdzSx8XYda+d S2Oi8jggV2pb+kl2WVtKxiTIkrjQtmD0Pft6YdksMY5OLGQQnLGZ4jqJ7hCameazjNyFZa8GbvLU+ uIm04x+54bfnMZ0eQvQQ==; 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 1gRVKj-0007UF-Cz; Tue, 27 Nov 2018 04:50:49 +0000 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gRVKg-0007Ru-0C for linux-mediatek@lists.infradead.org; Tue, 27 Nov 2018 04:50:47 +0000 Received: by mail-pf1-x442.google.com with SMTP id i12so7735558pfo.7 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=O6FDqjB5ye27nQBtSu1n7qB7MWyQ3UPM6/ZNtb2JHQqQK2ebh5ahtI7LYeaDk0Nrvh pnA2jt1hczHqWS6itVnGIwqsyMICSi8rLC3LC7H8aKd8ODnm6NEPnbWVMPUBYWkvt/1W mPB4OoZJ87dLY2fGebV1fJeoDjdJeAJDADOXjQEggEqkbBC+TfVBp4apDuw+sAxlaDP8 wy8Te3K7sLPC2HCI+71oV+HMNrFZ3nAgBoYMmiIiYYay0C5hxdo8l3hiKw+SHtIE50u3 nsDPJYyjGQ4U5B+MF+arskBiowCThKtJ3kffdLvgVXwOxZbtV7e6OUC5q1tHWsn3wdSg MMsw== X-Gm-Message-State: AGRZ1gL7LizAxv8odO0E9+LgBQuoi5kt3UioSBy4O7WwHxw4j6XmsgC7 zuCkrUdxwxX/UKX4U2LXbZvOwpSeIEM= 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_205046_038947_80F1619D X-CRM114-Status: GOOD ( 13.66 ) X-BeenThere: linux-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=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; }