Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2653065imj; Mon, 11 Feb 2019 06:31:00 -0800 (PST) X-Google-Smtp-Source: AHgI3IZQYhVh2jqN0bnw4bQBmNjx0Ne/Dys+yLirpBagh/pxfQv8yphpeb1iAb/RXRy6N0l9/DOF X-Received: by 2002:a63:c946:: with SMTP id y6mr5140235pgg.109.1549895460611; Mon, 11 Feb 2019 06:31:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549895460; cv=none; d=google.com; s=arc-20160816; b=Kr3saeDFddULvzwPhqneEP4uRWOE2JGdYpjMBHWoznrlnn7V6GCpH6V9617lQTiLDJ UE0x+s3w6VdVAi51jEontFZ4+kXkUgUWSjZ54FH7lHMDa9bWkpz1G0usNGqvSnRlY25D DTS9kB0xub02TPl0TYBV2pu+rRRiB/eYT4bRxEwoElKj1lt2wtQ5b/aSgpJrAJ750clz iVfJqv3TzD2+kMsYB0n7Y+eL8ORzTRZgYGH4cUpOkxQBBCk0F74tXMOYOyREoCsrcWsh lPgG93TdJBEPbqV9NYORZJGgp+llu8F5IHu3yf2muNCcyiflXKps3B/Fa78Iktp12lhs 7cFw== 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=m5pV5rW83QVNdd0ExZXWatRvjeOlNSYS0ygGReysW78=; b=1Dl3EzIcwFKLGWF9jEkZSs9IyzLODObYe1wvJCr8WkVYwS//t/eqAqkGJiGzPYfZl9 fQi17ak6F4cLIbZ7sZvIvPIl4Bamp3jCacy0hPbRW73ImOKzbqdsr75KW97x3Qv4ncNB u+Et/pGeKL+ulJ8fDhXMlLSwcJuoLfSKaTS5TjsJ8KdaoGozV0e5HTiKSxvJpL5dXoYO z3KS+b6FyhK2KetZmNtN4dbW0BpoYuhPd2gSfXIe+u6QEQ4Kf06GFA55XD/1sNsuEoLE zFWPZaR4BaBhx2H3cxAbVbfYp0hbxAfTbeldGCCGfqeqIgkwJWxJsGUN9V/Q5OI8zO1q vLIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ojaXinqq; 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 12si10642037pfx.102.2019.02.11.06.30.44; Mon, 11 Feb 2019 06:31:00 -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=ojaXinqq; 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 S1729993AbfBKO31 (ORCPT + 99 others); Mon, 11 Feb 2019 09:29:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:35482 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728934AbfBKO3X (ORCPT ); Mon, 11 Feb 2019 09:29:23 -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 0570F2075C; Mon, 11 Feb 2019 14:29:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549895363; bh=DXy3oMxX7ILCGwVqdqFfLxysEeD9Rlz8AGTtLLjCOC8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ojaXinqqQM9PCC+k1YMdsQSmggQHxyyVM5BCUSPqvcgJmUIXi5eHLaBgaic9xNPmv XJh7ZyVZGdHpbtmZYByK/lQFr8qCKdCx6sgiRQ+xeIkQoX1slMr8vukZVsJ78OcrcL AN4YyimWJ+5pO80OvxoDOPLdEJucMGpu1lJGbfQw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Quentin Perret , Viresh Kumar , Sasha Levin Subject: [PATCH 4.20 149/352] OPP: Use opp_table->regulators to verify no regulator case Date: Mon, 11 Feb 2019 15:16:16 +0100 Message-Id: <20190211141856.130416362@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@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.20-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 90e3577b5feb42bac1269e16bb3d2bdd8f6df40f ] The value of opp_table->regulator_count is not very consistent right now and it may end up being 0 while we do have a "opp-microvolt" property in the OPP table. It was kept that way as we used to check if any regulators are set with the OPP core for a device or not using value of regulator_count. Lets use opp_table->regulators for that purpose as the meaning of regulator_count is going to change in the later patches. Reported-by: Quentin Perret Signed-off-by: Viresh Kumar Signed-off-by: Sasha Levin --- drivers/opp/core.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 9280f51f1ce6..82baed4b80d4 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -196,12 +196,12 @@ unsigned long dev_pm_opp_get_max_volt_latency(struct device *dev) if (IS_ERR(opp_table)) return 0; - count = opp_table->regulator_count; - /* Regulator may not be required for the device */ - if (!count) + if (!opp_table->regulators) goto put_opp_table; + count = opp_table->regulator_count; + uV = kmalloc_array(count, sizeof(*uV), GFP_KERNEL); if (!uV) goto put_opp_table; @@ -1102,6 +1102,9 @@ static bool _opp_supported_by_regulators(struct dev_pm_opp *opp, struct regulator *reg; int i; + if (!opp_table->regulators) + return true; + for (i = 0; i < opp_table->regulator_count; i++) { reg = opp_table->regulators[i]; @@ -1386,7 +1389,7 @@ static int _allocate_set_opp_data(struct opp_table *opp_table) struct dev_pm_set_opp_data *data; int len, count = opp_table->regulator_count; - if (WARN_ON(!count)) + if (WARN_ON(!opp_table->regulators)) return -EINVAL; /* space for set_opp_data */ -- 2.19.1