Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5623266imu; Mon, 26 Nov 2018 03:08:42 -0800 (PST) X-Google-Smtp-Source: AFSGD/XOiJ1DTioKGhTqGtGCvJpQKvsT58YJ89aSFpNQjDyAflC4cPE247tuzuotKZUxVVKoRgNV X-Received: by 2002:a63:4815:: with SMTP id v21mr24151522pga.308.1543230521982; Mon, 26 Nov 2018 03:08:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543230521; cv=none; d=google.com; s=arc-20160816; b=eXF8QI5w8xMmyMeNdQ68NKQqvtjz/LHoNk9rJWILe7vs0okaPSPvRWIoAP0BO0JJe2 Wa15HMQ24iqWA8LKx4wVJFM/NGbd3kyFVZLWvIGxSOut81XEAZpqxbR6MVtZ8WFlHZl/ /H+qjH8U1i/4/jEUHUeCfr97h0/Hn5QKGQ84jRU728TBK+I2y2FqUgBFJDS7ELDVMFu2 YGgZZjYOud7F2Q0oDD1bx1wjcihVLjOx0Qcar3gGln8aKHeXpC09W8yer6XongXBlrmu DDlGkqoDb1AVw1Xu5JGkkodwL7o1D1Y7+sP9/oZz67BR0pAhZW4CmM7vtEoY4w75L7QD b7lg== 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=4Q7RkoQsJmvSfg1TR4OX4GjB5KYWfePaQGiud8j9swc=; b=qt7b/j/HrLN1NaAsBFJ7NUc0C96ydQT8adL9dhdyZkWyTGzVsgVxRtqUuxKAUtm7Dt btuchP4QBeDrD2U3EBXdAcFNQ3YnSZVP1VRX5uj34P2mROHcB7QUEh+ayXJ1akBDpfs+ SZDX71xtiptjZycAqGLLKhuhOeOs/eTDU22WELgTfshwYHcdmisuiz0/DUwou+HomVN1 mrgdO6fQr2TC86vV7ms4HXdICJPm439dV7kBPS7jVJcfrNjaia1gUWD9T9kIYznxYScj pGdHfJY2eQbP4gE7IOfszOco63Y7c4dDBWkIK1diDFT/5oqATXITEwSl6ijlDRg5ehgg aasw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Kpju2SIv; 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 f16si61312356pgb.140.2018.11.26.03.08.28; Mon, 26 Nov 2018 03:08:41 -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=Kpju2SIv; 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 S1731589AbeKZWAR (ORCPT + 99 others); Mon, 26 Nov 2018 17:00:17 -0500 Received: from mail.kernel.org ([198.145.29.99]:47060 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729543AbeKZWAQ (ORCPT ); Mon, 26 Nov 2018 17:00:16 -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 CAC5020645; Mon, 26 Nov 2018 11:06:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543230390; bh=VcWrju7b4gxuc3QUd31rkgd8beeU/0qkOEIgduKtwQM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Kpju2SIvtIIhbOS2mLkhHq6OgiFdfnITiMeMSP51b1qYU0Phd9sFGRMAEaZEwv0So S7//dgdd85SlTjK/47SKMQ0ccx8TY9IbDtP3Vr9A79RMc4GveyzkL8OLvVSBQhJspI FyWd92yAtAf2wDNafX0ENuW03jxW45vq101X+qoc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stephen Boyd , Douglas Anderson , Wolfram Sang , Sasha Levin Subject: [PATCH 4.19 073/118] i2c: qcom-geni: Fix runtime PM mismatch with child devices Date: Mon, 26 Nov 2018 11:51:07 +0100 Message-Id: <20181126105104.336966682@linuxfoundation.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181126105059.832485122@linuxfoundation.org> References: <20181126105059.832485122@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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.19-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 848bd3f3de9d44950c00eda6c115e8e9785440da ] We need to enable runtime PM on this i2c controller before populating child devices with i2c_add_adapter(). Otherwise, if a child device uses runtime PM and stays runtime PM enabled we'll get the following warning at boot. Enabling runtime PM for inactive device (a98000.i2c) with active children [...] Call trace: pm_runtime_enable+0xd8/0xf8 geni_i2c_probe+0x440/0x460 platform_drv_probe+0x74/0xc8 [...] Let's move the runtime PM enabling and setup to before we add the adapter, so that this device can respond to runtime PM requests from children. Fixes: 37692de5d523 ("i2c: i2c-qcom-geni: Add bus driver for the Qualcomm GENI I2C controller") Signed-off-by: Stephen Boyd Reviewed-by: Douglas Anderson Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/i2c/busses/i2c-qcom-geni.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c index 9f2eb02481d3..d7329177b0ea 100644 --- a/drivers/i2c/busses/i2c-qcom-geni.c +++ b/drivers/i2c/busses/i2c-qcom-geni.c @@ -590,18 +590,19 @@ static int geni_i2c_probe(struct platform_device *pdev) dev_dbg(&pdev->dev, "i2c fifo/se-dma mode. fifo depth:%d\n", tx_depth); - ret = i2c_add_adapter(&gi2c->adap); - if (ret) { - dev_err(&pdev->dev, "Error adding i2c adapter %d\n", ret); - return ret; - } - gi2c->suspended = 1; pm_runtime_set_suspended(gi2c->se.dev); pm_runtime_set_autosuspend_delay(gi2c->se.dev, I2C_AUTO_SUSPEND_DELAY); pm_runtime_use_autosuspend(gi2c->se.dev); pm_runtime_enable(gi2c->se.dev); + ret = i2c_add_adapter(&gi2c->adap); + if (ret) { + dev_err(&pdev->dev, "Error adding i2c adapter %d\n", ret); + pm_runtime_disable(gi2c->se.dev); + return ret; + } + return 0; } @@ -609,8 +610,8 @@ static int geni_i2c_remove(struct platform_device *pdev) { struct geni_i2c_dev *gi2c = platform_get_drvdata(pdev); - pm_runtime_disable(gi2c->se.dev); i2c_del_adapter(&gi2c->adap); + pm_runtime_disable(gi2c->se.dev); return 0; } -- 2.17.1