Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp257254imu; Mon, 26 Nov 2018 20:51:42 -0800 (PST) X-Google-Smtp-Source: AFSGD/XvXO15GMYQzwaoM9m14YcE8uhex4xGu1jzXtAOnjg544ffrpUKn/aKf4eapNb2k76TlJak X-Received: by 2002:a63:cf56:: with SMTP id b22mr26331623pgj.336.1543294302556; Mon, 26 Nov 2018 20:51:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543294302; cv=none; d=google.com; s=arc-20160816; b=cr65uiX9ePSWoWa97656dPzH0wKOn0iN32t4uQa+cQlOXnNCiixlrazoUoeFXQtib+ IutFPQUhhen6fIuRp4HaxC6+LjhwXGvWUc4Tp3gFPTpyYJjWuyBwRkV+wWi4i/6O37ow yCTdYF5fMFXr7Su4rdtkH/GSta4xxpqjhgMyjpz6jMKe8Kyip+AimM245xubMQHkAu+G yW8IaXi2emQFhZdtSuGhg+LNhjU9899PJ6F6D5zmIOwPZv48KvKhSE3V4vrUW/3Pab5c PpKm+rlWehymolhI92lpzbDFfr1Ho6HSMQtXivROlASlo8aiaDnBiJU7DS+rYtlAev6C mwUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:content-transfer-encoding:mime-version :message-id:date:subject:cc:from:dkim-signature; bh=yL4PxkCnnwRXSRf/RUNTt7B9beLsEOSxMycnGtl5vO0=; b=lm0SOA5a7HgQeoLEPtdAxAdocszJLXKMjGHLXxltfA2By0IzjZ8XBYuIrQQTKjOQ2J gsWrVaqu9t8U/7nLIfsbtWmYzLW+MKjlo5IXROqDhR+is67Zw76E5kDg1gZB0vpIx/5A IBcz9zssiUPUxpuAD523w3jhKxr4WUh94dsLIrzDksxq4L7lI48S/HT6dt5DD9Eh9Pm/ hdHfkbnx8YrPVpWTUbyhSA70EbZTeiTYx5yijTjJFy1BBZLX8+OqQdqtC4mGDFs31get ZR7MzYE9LKLUVFa4Xr1StrHh4A8srVhFv6SlSFOkyFNb1lSzaiblCtCcFExosjpXU8or Feyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@chromium.org header.s=google header.b=kr9E7P5r; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 4si2761246pff.161.2018.11.26.20.51.26; Mon, 26 Nov 2018 20:51:42 -0800 (PST) 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=fail header.i=@chromium.org header.s=google header.b=kr9E7P5r; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728362AbeK0PrJ (ORCPT + 99 others); Tue, 27 Nov 2018 10:47:09 -0500 Received: from mail-pf1-f195.google.com ([209.85.210.195]:33574 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727974AbeK0PrI (ORCPT ); Tue, 27 Nov 2018 10:47:08 -0500 Received: by mail-pf1-f195.google.com with SMTP id c123so7038989pfb.0 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=mX6teoGp5IqggI8lsir8neWWXwZ16p6341hPLZJCC8v92ttXcmYjlj0hUeYRyerhgQ zcpiMh3ZHfhsA8VudfFg05G7c/i3kbHahFrCLmhx5rs3XRDUGjIdoPzvoY/a6Ds1IgKB dNq/8t9GBuGEMUHEIUAt+sBW3QgltaW6xinNP2uZ5Ix7VnEMQIS0PU/K9pYuTrcYl4jZ rMLCanfrLCbBB9kR1uaEpJa2RjQmQLCXD38J1LgX5LrKUJiwRluRNY0QHq0D4vZdSulu PMkQfe3o433gsvWLpzUpmmZ1/+hZqAXWJ9IqF5COwTVrXs5eTAw+kHqifp7w/kXQQdZd 720w== X-Gm-Message-State: AGRZ1gL13mIUkZuN3yGQcDHRs86LYyZS3dGXz34YF5j3OWJG0yrOfpZQ omeo8lgKqsS3MZj2HllrtmYv/w== 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 Cc: pihsun@chromium.org, Greg Kroah-Hartman , Jiri Slaby , Matthias Brugger , linux-serial@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org 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 Content-Transfer-Encoding: 8bit To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; } -- 2.20.0.rc0.387.gc7a69e6b6c-goog