From patchwork Tue Dec 11 11:26:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 153447 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp498551ljp; Tue, 11 Dec 2018 03:26:41 -0800 (PST) X-Google-Smtp-Source: AFSGD/V9Vy9DcB3ku8h9f8oUI3rn3s4UelmYSpU578XaOSMFhDtpwO9ji038nzxvg/naEAQOncKb X-Received: by 2002:a62:1b50:: with SMTP id b77mr16096515pfb.36.1544527601618; Tue, 11 Dec 2018 03:26:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544527601; cv=none; d=google.com; s=arc-20160816; b=UMMyblbnJ7Eb+0BPZgaA7khqAT0x26WoOlaqumWrcthx/f7UJ3F2kQgputVgDbRJ2n K+9UhnP5fzPbnkPbagoZtEXSKDaXKT/EoWPX5RISq9MgVzBE7LaxGGEOh9QPSSh60NQf OG3H2meF+tkb+b23Fa6XbhdfcEhf/kp4FIvGZcZF87/KdkeWA2VpnWXrwqpImBWj+gwl QQKo3hjWL5IePuHuUki4GYbiI1QI5WlDqVs7B/FkFA8iUxrad9cR1qDQ6kBLFPF5AhvM 8PrTkuqhvXGhaLf7qYJREbOEkjNl3f9HrpljcaVncWcS4v9RBRXHWG5r4+Z/jVHEzjKi APlw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=EZLJXHxTcd+FGSvGzSmPEZcFBlWXa9ssKRuIJpqqIhQ=; b=aBztrBgsMfsiLG5Nf77pP0OiXyRUKU45+4GdAH8rvFhS0h5GBolXP9i87YUHGIDuEk WpJj6B4dVxZ21N09+/mvO3pap0K7UeNNVZLNrDHUBtq+37w4oapuWvFd9E9DSD6DJQ02 3oqadquJXdqZsBeANRp01R+35CiyKrgH4siiF4jq5DOYIsuELSU5Gh8ScpfgefarCCUu ULe7aHWkKNGh+x7XruswEUc5Ms6dEJ4tp3AWbtY0Ckn7RxZR+LnlIaQcd6PRuDFKqHZu jLSjnVJLbPxRe+9ixmoBrmPzhScHvSUs7Y8hPF2EdGIy0luFcX+jC0SZPi5xNUiuw+al 3MEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZwYF8clq; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a64si11898677pge.124.2018.12.11.03.26.41; Tue, 11 Dec 2018 03:26:41 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-pm-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=@linaro.org header.s=google header.b=ZwYF8clq; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726426AbeLKL0k (ORCPT + 11 others); Tue, 11 Dec 2018 06:26:40 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:40833 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726281AbeLKL0k (ORCPT ); Tue, 11 Dec 2018 06:26:40 -0500 Received: by mail-pl1-f195.google.com with SMTP id u18so6786552plq.7 for ; Tue, 11 Dec 2018 03:26:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=EZLJXHxTcd+FGSvGzSmPEZcFBlWXa9ssKRuIJpqqIhQ=; b=ZwYF8clqq1757VYOEH+GvmCLvcFR71xfv40qaRRvCoqdIX6LfR954dPh6u1aF5ux2I Bnyw/7aJgjOX283wNjb5qEGzE7J3Tk+r7buozpDVyzMy+x3MrTaFhk23OFn0EPawFRa2 WZqC+SrgRCj7MBMwQ/CdAkeUWbxF0NCqMi820= 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=EZLJXHxTcd+FGSvGzSmPEZcFBlWXa9ssKRuIJpqqIhQ=; b=fdMmXMkzhxescGVdSGyjTqXISRCpccVYOhQ09C/7zZ2GQW/A5nBlIaiptlBSatr77J c3X3zbmgAp5sFKhOMLoA9tnKvKiCCIzhxAYS+RGIZ946cMOZ2mDRZi70WTjd2biqEYSx tvSCpBEC4lygzpfhIP0gNH5xd48Y1namzFNrso8Z100ZRVL1df1UXAJkW84PQPM+W/kU YpWMlew1vdKiOd+l87LH9DXg2W/RHTwNO603Xon3PJ32NYrifJWl0Wn1ly/F1Fi89A5N zhunMcQf5oefiMTru588hEIXEHqrQZ7wLU0Fprn0P+PkJnxhIeUA2rm4+95Nf0bWJajq gomQ== X-Gm-Message-State: AA+aEWZoVIuJ1pJiAG3ILHNJt4mNWiZ+goMhQKFeC0arX4W8htGMaNdT fC0sS9EERDhHcFcLEeveILURHQ== X-Received: by 2002:a17:902:4a0c:: with SMTP id w12mr15880935pld.8.1544527599935; Tue, 11 Dec 2018 03:26:39 -0800 (PST) Received: from localhost ([122.172.23.29]) by smtp.gmail.com with ESMTPSA id v191sm31680073pgb.77.2018.12.11.03.26.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Dec 2018 03:26:39 -0800 (PST) From: Viresh Kumar To: Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Rafael Wysocki , Quentin Perret , linux-kernel@vger.kernel.org Subject: [PATCH 1/2] OPP: Use opp_table->regulators to verify no regulator case Date: Tue, 11 Dec 2018 16:56:28 +0530 Message-Id: <90e3577b5feb42bac1269e16bb3d2bdd8f6df40f.1544527580.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.19.1.568.g152ad8e3369a MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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 --- drivers/opp/core.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) -- 2.19.1.568.g152ad8e3369a diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 2c2df4e4fc14..2d3d0d1180ea 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; @@ -1049,6 +1049,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]; @@ -1333,7 +1336,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 */