Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9175382pxu; Mon, 28 Dec 2020 08:27:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJxXyL2LKEM6bYCEwrgM2o+it3Axw/HpHwDHrwQzJMyrzvhU7uFi12lfVn+jbwJbwn7//oVx X-Received: by 2002:a50:f392:: with SMTP id g18mr43043333edm.306.1609172823038; Mon, 28 Dec 2020 08:27:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609172823; cv=none; d=google.com; s=arc-20160816; b=u/wSGBy9K5PxqLy51DqieQ7M/GrxYctT8DItnjXlFmkRwfTusb/766mPn6vqlmwqI1 AJk0+qOfPgXuRw6WxFAdp11YvpqtooMF6rFsSwr5iUuylnlYLBpzj92US1gTHuW4kjxJ XS/qAme42lF8qUhQItDCCh7MseYdBK+X7f4y97kPVraHo/1jdxjCzUnumKLz7I80aM2G VxE4M0di2scIM/PVIW6B3VzU+3bXXx9ruWwEE7ORf1RQbLSVMGo8svlL9OM53uIFPQxe Fa/zNZbiYSrWHqvKEtrEKNg4ZS3rJt2A+DGaGNeraE7VhQspdjqz1Lmxj89EMr4bB1iW R3Jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5mVzDjISFq4VETCVel4dhT8W1DLvOPuYLrQR6+lEhTs=; b=EgZNaKUS+DVunXzbdziM7LDC/aOVceoYYpToHVlwT/BcudEYBUSfSwXvBMuS6r2qRZ 65zHRIFjDqtQdnPKeV97GOAtyOEiLh+nj2VhfPL3xq/L9/JYGEVY7yVLEL5dJcUvYaNo Q6b3RQBWBp+hs0Y6C+g/fY+s86R1iUNP0gfqPWCfWY2EVxP/ofGTJarLEf2s3lWI74T9 P0SD4/QlqC+Jy31g6Nte5SvCVIgkf1tONtGsq0TgXgMl9UAG3MfeSt5xCQgyx+AIGkGG yXPUGqhZDlrSzDFya1XCQ+UGKB0zUTeat3jH3gtpkWhP76xx+ku7pGI2g9XzOA5BadH+ nQuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GrGertuj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u10si21075958edd.90.2020.12.28.08.26.40; Mon, 28 Dec 2020 08:27:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GrGertuj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2633391AbgL1QYV (ORCPT + 99 others); Mon, 28 Dec 2020 11:24:21 -0500 Received: from mail.kernel.org ([198.145.29.99]:37762 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731312AbgL1NKS (ORCPT ); Mon, 28 Dec 2020 08:10:18 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5A56B2076D; Mon, 28 Dec 2020 13:10:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609161002; bh=EeYPUFr/QSUl3eSn9plS5GQKVSDJK/lV+R1DyJ++noc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GrGertujjL2ocv+sRXTeFGt99vb7oQbsYivDjZUTUCdcRaNAAP3HRFoWW3M7cDepW 7uOJ9ESPNxq2R25TYMaz0QA7Hsn1fQOoXPqb02fCA+fS/7TnOW9khT1OSlmUfsztAM puCljuPF8eYnjsMNBnCVcuwFVBwX9qCQMJQRU7AQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicolas Boichat , Matthias Brugger , Sasha Levin Subject: [PATCH 4.14 067/242] soc: mediatek: Check if power domains can be powered on at boot time Date: Mon, 28 Dec 2020 13:47:52 +0100 Message-Id: <20201228124907.980113755@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124904.654293249@linuxfoundation.org> References: <20201228124904.654293249@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nicolas Boichat [ Upstream commit 4007844b05815717f522c7ea9914e24ad0ff6c79 ] In the error case, where a power domain cannot be powered on successfully at boot time (in mtk_register_power_domains), pm_genpd_init would still be called with is_off=false, and the system would later try to disable the power domain again, triggering warnings as disabled clocks are disabled again (and other potential issues). Also print a warning splat in that case, as this should never happen. Fixes: c84e358718a66f7 ("soc: Mediatek: Add SCPSYS power domain driver") Signed-off-by: Nicolas Boichat Link: https://lore.kernel.org/r/20200928113107.v2.1.I5e6f8c262031d0451fe7241b744f4f3111c1ce71@changeid Signed-off-by: Matthias Brugger Signed-off-by: Sasha Levin --- drivers/soc/mediatek/mtk-scpsys.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/soc/mediatek/mtk-scpsys.c b/drivers/soc/mediatek/mtk-scpsys.c index fb2a8b1e79791..d0b18cc7e61b5 100644 --- a/drivers/soc/mediatek/mtk-scpsys.c +++ b/drivers/soc/mediatek/mtk-scpsys.c @@ -481,6 +481,7 @@ static void mtk_register_power_domains(struct platform_device *pdev, for (i = 0; i < num; i++) { struct scp_domain *scpd = &scp->domains[i]; struct generic_pm_domain *genpd = &scpd->genpd; + bool on; /* * Initially turn on all domains to make the domains usable @@ -488,9 +489,9 @@ static void mtk_register_power_domains(struct platform_device *pdev, * software. The unused domains will be switched off during * late_init time. */ - genpd->power_on(genpd); + on = !WARN_ON(genpd->power_on(genpd) < 0); - pm_genpd_init(genpd, NULL, false); + pm_genpd_init(genpd, NULL, !on); } /* -- 2.27.0