Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp900995imu; Tue, 11 Dec 2018 09:16:43 -0800 (PST) X-Google-Smtp-Source: AFSGD/UaFhjipqf7lcX8OgzXLGFeZCUcSth/pL8BVvaHWA4d+WFNgGnCVxZpdsKet8Tr0j4foDqP X-Received: by 2002:a17:902:a83:: with SMTP id 3mr15670295plp.276.1544548603925; Tue, 11 Dec 2018 09:16:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544548603; cv=none; d=google.com; s=arc-20160816; b=wvD7kXtUQn804if6lpbPvJjDX3zuYuv69XCwgZ7Yjc244XSJBUFsF44KJTmJQFzGJH Dh+fQxviQAYVfWJSPQQT+REvWO6VIHzXvUiMRjg0PMg5CHz0Nng3Cod1B/Po/Eo77KNg 2Gn8ZT5+19oYBZFd3k65HFTNpmOcmcjjRj+AKmIigWOVwepo7JSnMOXzCO/BrZsVVcul c6iRuYyuVApwptD8kqgjgnBzJIdHnZA3ka6aumxH7znMH53xQ8KqqQ1q9FtiYFmcIKgM udixc0apM+Wos5IFDHSMfr4zIhtxOqospd6oPqIXEu9Hp9qsY983PB7HfUYO0MlzLbEG oNXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NBq5bQ3khZeuIyq8k1/1JfS9scM/ilA3grvq+o50wJA=; b=ReYt8BFx8L5qUKwkYpKjY8halIPqHoHabKJEGrzE0Aqom2j/W8gwxG9QSDA2G0ui2t +vTcFVaf9YwioSiDLwgAxZIAxOIOxEpoZ20TcDzOHXi2CCAwKdp1AkvTGrsgnCgW3Vry zoMaBaxwWKa7pqmQ2xvJxhje1T13feRKNZhUXrcJkJMB6UbidnSjo97CMbijfpBm70KX 6C2LBrAxwfzEq0Ye25ZueosxcrIN6uKJY+2ql7Eb7tVsv1TNKjYuoMVrLS5sv+6VbLDy EG1secfYjTk4MebOuUI1tZKp96cXGV+f7r1TNsqR8gXaD9NSIY6JDRFVNRTEor91n59j olUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Zm+t+NLw; 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 d92si13456307pld.45.2018.12.11.09.16.28; Tue, 11 Dec 2018 09:16:43 -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=pass header.i=@kernel.org header.s=default header.b=Zm+t+NLw; 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 S1728769AbeLKPsQ (ORCPT + 99 others); Tue, 11 Dec 2018 10:48:16 -0500 Received: from mail.kernel.org ([198.145.29.99]:36568 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727411AbeLKPsN (ORCPT ); Tue, 11 Dec 2018 10:48:13 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D833720870; Tue, 11 Dec 2018 15:48:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1544543293; bh=oOa5qhhbmJoHdzdPUpLCL/wP25r24gslpxAv6e21Q/o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zm+t+NLwt2ZfOGnnX4/VPzRLrTO2TFG+Egm3I7jbkvUMx36i+wz1jn6iWwBebuEtL ioFNW/Mb4T9ozPpOrGDvZh8Az4i24fsh8nX0JE6QHREachqKspui5zy0fAHg5/HEeh bnmgUxF3nF0zzl4urIHXgdFbYdwnmUjYCo9ihDJI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Shih Subject: [PATCH 4.4 85/91] tty: serial: 8250_mtk: always resume the device in probe. Date: Tue, 11 Dec 2018 16:41:44 +0100 Message-Id: <20181211151613.757661688@linuxfoundation.org> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20181211151606.026852373@linuxfoundation.org> References: <20181211151606.026852373@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Peter Shih commit 100bc3e2bebf95506da57cbdf5f26b25f6da4c81 upstream. 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 Cc: stable Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/8250/8250_mtk.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) --- a/drivers/tty/serial/8250/8250_mtk.c +++ b/drivers/tty/serial/8250/8250_mtk.c @@ -231,17 +231,17 @@ static int mtk8250_probe(struct platform 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; } @@ -252,13 +252,11 @@ static int mtk8250_remove(struct platfor 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; }