From patchwork Wed May 17 04:40:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 99903 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp63575qge; Tue, 16 May 2017 21:42:07 -0700 (PDT) X-Received: by 10.84.232.206 with SMTP id x14mr1926071plm.90.1494996127519; Tue, 16 May 2017 21:42:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1494996127; cv=none; d=google.com; s=arc-20160816; b=gJbgDpYHeFrHuz0rkgLD8GMtz+w+ve0Gn5yL+XoV7xRO3In1RnCDsIbPE3c+MugbRj 5QbPm7hqvK8s6QWjPaG1PEXC+VUAYrsFfmgpqB1y1l9J+gxpSmLDaHGs6PNBjDDiUMGQ ykQz7rufFrLP04WS5eomXOvmh0HaMJoDy21rl1At3nY3B4IHeKuhjO9kUvcKNIF/NZlI ZhlbKdRoVY49o0S+9LN0xl232vtM0MBLpdiGpyegOjo2B158SNUAOXGyRpkCxQ5PCQgQ BVdc2wF5ToaSHTPiIuJTx9IJPw3QMVfwy2YunyTbOohDqK/Tr05lSF7p1CJ+9gPLM1Ha XzAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=mXYJ3oPtL1zBFV86/JLVk+IAgkMbN+slRVQESYlgMjk=; b=t0pvAW91Ngkm8i9vc3cyWnqF1+pq3t6QzXq355dSShAJmG8Aq2k+Tac0cJHNeh8XqL eLnwiCKYfPCM0DKVXOo6gi0G5MQsl/FeKq6Q+CSfcZapuJ8sRSv3SZS1V3rzOXAo8OvG kpqgZZaKU+RCdaO6sj3O10dty+r4GbmlYaa9/nWiBzsWdLeSgSUUTfGyGixCWyDoDbVB QEo18ARMLvxzmjVVkL4WA/1nxAYPt+me+UCQDkPB4N+yHytYkLdBuJiKfLVCxwG7EO8h VmcPiDtA1xtcLwaxbx1PiMEvOWnoF3AK7r0j1xTkuwHCgBeywiijEPQz8bjQ1hsdwuq6 j8MQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org; 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 h83si965680pfj.282.2017.05.16.21.42.07; Tue, 16 May 2017 21:42:07 -0700 (PDT) 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; 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 S1753361AbdEQEmB (ORCPT + 14 others); Wed, 17 May 2017 00:42:01 -0400 Received: from mail-pg0-f42.google.com ([74.125.83.42]:34909 "EHLO mail-pg0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752150AbdEQEk7 (ORCPT ); Wed, 17 May 2017 00:40:59 -0400 Received: by mail-pg0-f42.google.com with SMTP id q125so987184pgq.2 for ; Tue, 16 May 2017 21:40:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=mXYJ3oPtL1zBFV86/JLVk+IAgkMbN+slRVQESYlgMjk=; b=eU9UP+ks93tXNIpEA4iUdy9wg5XmqEYsWAQl6xYIuCtpIHPpJimZ2oUHnTSg5o+G9o cYfK1GVb+7ar5O4RYAklsOj2dWO1d6+pkgUGmgqX2Eg1azFnyVzYQCEgm8qML+ErBRbj Uh/XA2WfDKIe1yVXWVq1qD4qO4PZ4nt7BLqEM= 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:in-reply-to :references:in-reply-to:references; bh=mXYJ3oPtL1zBFV86/JLVk+IAgkMbN+slRVQESYlgMjk=; b=mKCmFpRMh+VIWH+Oq4CnstX3S9c26rbAQqkDLCfB3MuNEqCoWS/s6itEk8cUcYC3ec 44iVVtqNddU+2pfpJzEWY/TAN5qM7oY6XY0GVynwpcFYiv7kX5NFTgn1VB8nFTyuyaUM QmPntKrdHZGRkpPkvRgohQLf8L7H0Ed5ujHpNLVkX2MUu2ftq0MB8Ot7U+nwrnpdh5hu GFI05zp7jGWnjgCMxwWVd5LLO3EvO+3eUH94kSF05BwbArV8+5Q+AkkR9eJ2SL89adws 1Rrambrka0StddHgyPFnANsQga3ixRwqkuYNTySnmlUUr0bbzd7kIg1MLDnUibgYX1Yv G0Cg== X-Gm-Message-State: AODbwcBcomjo+ua/kqGnOAxDuRMzmyGUtboV9qb7Vmc00GWSqs6LyUrb B85S2xbdTXhUuI5R X-Received: by 10.99.178.11 with SMTP id x11mr1722386pge.68.1494996058349; Tue, 16 May 2017 21:40:58 -0700 (PDT) Received: from localhost ([122.172.129.253]) by smtp.gmail.com with ESMTPSA id q68sm1015354pga.57.2017.05.16.21.40.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 May 2017 21:40:57 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Vincent Guittot , Viresh Kumar Subject: [PATCH 2/4] PM / OPP: Don't create copy of regulators unnecessarily Date: Wed, 17 May 2017 10:10:33 +0530 Message-Id: <7e185f9780252587f58efdff9b1d3079120a4246.1494995911.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.13.0.303.g4ebf3021692d In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org This code was required while the OPP core was managed with help of RCUs, but not anymore. Get rid of unnecessary alloc/memcpy operations. Signed-off-by: Viresh Kumar --- drivers/base/power/opp/core.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) -- 2.13.0.303.g4ebf3021692d diff --git a/drivers/base/power/opp/core.c b/drivers/base/power/opp/core.c index 402b9e86d77c..898f19ea0f60 100644 --- a/drivers/base/power/opp/core.c +++ b/drivers/base/power/opp/core.c @@ -180,7 +180,7 @@ unsigned long dev_pm_opp_get_max_volt_latency(struct device *dev) { struct opp_table *opp_table; struct dev_pm_opp *opp; - struct regulator *reg, **regulators; + struct regulator *reg; unsigned long latency_ns = 0; int ret, i, count; struct { @@ -198,15 +198,9 @@ unsigned long dev_pm_opp_get_max_volt_latency(struct device *dev) if (!count) goto put_opp_table; - regulators = kmalloc_array(count, sizeof(*regulators), GFP_KERNEL); - if (!regulators) - goto put_opp_table; - uV = kmalloc_array(count, sizeof(*uV), GFP_KERNEL); if (!uV) - goto free_regulators; - - memcpy(regulators, opp_table->regulators, count * sizeof(*regulators)); + goto put_opp_table; mutex_lock(&opp_table->lock); @@ -232,15 +226,13 @@ unsigned long dev_pm_opp_get_max_volt_latency(struct device *dev) * isn't freed, while we are executing this routine. */ for (i = 0; i < count; i++) { - reg = regulators[i]; + reg = opp_table->regulators[i]; ret = regulator_set_voltage_time(reg, uV[i].min, uV[i].max); if (ret > 0) latency_ns += ret * 1000; } kfree(uV); -free_regulators: - kfree(regulators); put_opp_table: dev_pm_opp_put_opp_table(opp_table); From patchwork Wed May 17 04:40:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 99901 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp63377qge; Tue, 16 May 2017 21:41:13 -0700 (PDT) X-Received: by 10.98.212.66 with SMTP id u2mr1649132pfl.73.1494996073652; Tue, 16 May 2017 21:41:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1494996073; cv=none; d=google.com; s=arc-20160816; b=WYepCqIseHTPAQgSRFqd3oCl+gHxDbGkeKxbsKuvFIhKnR0JM8sH7VncS7beBNPs1x 0gkV+R4WNX9yW/wVE4UdKE+PK5XlZOnQCywzDzSHIBZkS2hKaFT+tVcUHxiohfNBQg/g HhDTorMtBar1AFGzSaZt16qM+lVJwSfLHwWCwxLlOvLJ+sostSSBx+u0aW14Frh3U80W ZjupErgSSO3fJVyAA5mjv4B7jVBRzRzv4jxeoq0K6mNWTFJoeqIruSOoUiA23o6R0H08 eIAZKn0ltHuH5RP43XOjuao9eRR2CSagb+3g3AbfjWbw072A1dx5t4HQ2KVfKtVoKt6B 4Mmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=6uynZQWlquv90tpsM7Nn9S80BVBUw3QLtpIa4UYzsVE=; b=TRRFNE8I0Vd688SYI/krvaIQx7qBnj54GAP0i9KBxVeE7n+46xeTWHj57IEUYiA/Dp 5HrOES2W0gJdUdDwXRQLkFCU1NrE+XXbAJj/ymJqj39RxKlcSyd8rPWU2bFED4yybNNu tiqhLzSIXDUkCOpltMxHkgteEIcMHePR/X2DrXuB+tZdQ8DW3I5yQX8NJgkcwEomcHJp FnaXrZUZDiD9Y1VOZkkV1KGhedbu2JRxVsJg6tBWmA1pAUm42AxBxuX6cqneM1NmXgO0 Tu5vVcAL40sQEcFrLkBtrUpXliTd9glM5HnmW7plpYySpaLlwAZkc44fwrkOYbTVxZU5 rFXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org; 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 h79si976926pfh.1.2017.05.16.21.41.13; Tue, 16 May 2017 21:41:13 -0700 (PDT) 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; 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 S1751566AbdEQElF (ORCPT + 14 others); Wed, 17 May 2017 00:41:05 -0400 Received: from mail-pg0-f43.google.com ([74.125.83.43]:34392 "EHLO mail-pg0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752750AbdEQElC (ORCPT ); Wed, 17 May 2017 00:41:02 -0400 Received: by mail-pg0-f43.google.com with SMTP id u28so1006520pgn.1 for ; Tue, 16 May 2017 21:41:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=6uynZQWlquv90tpsM7Nn9S80BVBUw3QLtpIa4UYzsVE=; b=EYIKltB4tOC0GcOI6i0S6kTLEtup88buFAADVItnvnfqQQNHwWdEGOjt4aBOR1s2DE IGdQVW0bvHPoeKbB1Xio7AEhXKXYvcTLhbp1k6jWsE9EP/sjtqC3tNOrWsu6mnryKZhe IXOCoFwecWQmZBvpbP8ZRBfbKS8EQsrVSoPuU= 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:in-reply-to :references:in-reply-to:references; bh=6uynZQWlquv90tpsM7Nn9S80BVBUw3QLtpIa4UYzsVE=; b=SGYmVhO0S3IH/fkElSoDS9Q2xpDl+YQjV/yG6IqdK1syWRdhl46p183BIIBAGca6rc q1ugleefnAyGa0C5ETHcZIza+Z3zV9QnGeKZ40W4QJpLSSfLvsaEehWShlpbPfL88BE5 A47L8W+SW2/3iF+cSG9aXXrqTqRkG2mBCGz7+STwO7rt7N+xCI3j+/Nev+IUHdETzubi SNIbhv6TAGgi9e/DU6Jy9Do4jkj2mBjhtE8NDbodTBkLJ37JUWPAh04hFPKPh1iaPhG9 Za6epVGx3Brshv+qp212+PYvxk0X6nDCwjtJoIpgqTtriCZ29g2V9XoIrfL+efN88pzO E//A== X-Gm-Message-State: AODbwcCF/JT8BIigPlmTZhRxgHRPGw9ZdgXjC9V5/uYNvfhpvCsLdeD9 wLCP10an69XToryd X-Received: by 10.98.97.4 with SMTP id v4mr1673720pfb.23.1494996061725; Tue, 16 May 2017 21:41:01 -0700 (PDT) Received: from localhost ([122.172.129.253]) by smtp.gmail.com with ESMTPSA id a24sm1008145pfl.70.2017.05.16.21.41.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 May 2017 21:41:00 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Vincent Guittot , Viresh Kumar Subject: [PATCH 3/4] PM / OPP: opp-microvolt is not optional if regulators are set Date: Wed, 17 May 2017 10:10:34 +0530 Message-Id: <0e9ac75f0e94d7b0bff9a398b501e2fe4f409051.1494995911.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.13.0.303.g4ebf3021692d In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org If dev_pm_opp_set_regulators() is called for a device and its regulators are set in the OPP core, the OPP nodes for the device must contain the "opp-microvolt" property, otherwise there is something wrong and we better error out. Signed-off-by: Viresh Kumar --- drivers/base/power/opp/of.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) -- 2.13.0.303.g4ebf3021692d diff --git a/drivers/base/power/opp/of.c b/drivers/base/power/opp/of.c index 779428676f63..c6fc8cbad10d 100644 --- a/drivers/base/power/opp/of.c +++ b/drivers/base/power/opp/of.c @@ -131,8 +131,15 @@ static int opp_parse_supplies(struct dev_pm_opp *opp, struct device *dev, prop = of_find_property(opp->np, name, NULL); /* Missing property isn't a problem, but an invalid entry is */ - if (!prop) - return 0; + if (!prop) { + /* The regulator-count must be zero here */ + if (!opp_table->regulator_count) + return 0; + + dev_err(dev, "%s: opp-microvolt missing even if regulators are available\n", + __func__); + return -EINVAL; + } } vcount = of_property_count_u32_elems(opp->np, name); From patchwork Wed May 17 04:40:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 99902 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp63379qge; Tue, 16 May 2017 21:41:14 -0700 (PDT) X-Received: by 10.98.224.136 with SMTP id d8mr1709924pfm.140.1494996073996; Tue, 16 May 2017 21:41:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1494996073; cv=none; d=google.com; s=arc-20160816; b=cpNeAgh9+eOTKQ0yCq/6lrn6BsNDBR2EsAfJVQS3FOnfOnqDRKiaq4dZyX9O/gqFDC zOjVuck1RanjnchKj2614pdK5QK/C9OK1Y7AY/EgEH+oofGpQqd1B2ncRbZ2i18QkQAP XF9fPPCRYqyRkTb2AV0nDvuMHa8m7dlLBedJs1tZ5q/JFzLahsm0ENQtBtaIq9n3lf/d MkHF+OJDA2kb//0V0+AktJeA42yK1yFTVZBxQUvRDKK2FXXki2HSU/fKn0S8mQyQEeNj Z7P5aBe7U5QtNbvOtYD9oTwbUPW2PwiaaSrpLnbShg+hAOUl/+O8mVp/xMI3HUsn5h5X 7YoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=8iBRjsNQkZRSvOzxngvayTBEhaU5b4EZvQnjJ3UT28w=; b=szvkFb61am76VlOTyCypfZfDTTIad/i6XdSkZfecFvxRujLsNTcIc+fGEpvypXi/Q3 +QmlOqNgSQSPiV7XmejTvmgDqQqJ1QjbPxvsziynTcLgNKuG70rSCWDHDb0NYYJ08d69 rfXIY++bJoge5C0IBzs5RI54sDJonl26pqT5yhymZ8x7e+Y9DOjMlxDH/H3tBir4aL+6 I44q5U0pxmvv/iXh9DnQyKUXdfHOT0+2WvXlk55OkH418YxPiDha/prl8vA0dmYk4BoX w7HfPYe4ED4lMHBkG5U8S9kNIaSk9UinIBXFzB/K5W+9RtSIrg/Mzd/s2Qe+UBOMABsy d6vA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org; 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 h79si976926pfh.1.2017.05.16.21.41.13; Tue, 16 May 2017 21:41:13 -0700 (PDT) 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; 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 S1752954AbdEQElK (ORCPT + 14 others); Wed, 17 May 2017 00:41:10 -0400 Received: from mail-pf0-f172.google.com ([209.85.192.172]:33702 "EHLO mail-pf0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751464AbdEQElF (ORCPT ); Wed, 17 May 2017 00:41:05 -0400 Received: by mail-pf0-f172.google.com with SMTP id e193so1071635pfh.0 for ; Tue, 16 May 2017 21:41:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=8iBRjsNQkZRSvOzxngvayTBEhaU5b4EZvQnjJ3UT28w=; b=gb85wuT/G0O7Kk7uabLeZsTVm/x1QTgHViiJLh1z1h5sDsu2eFItCAZ7fXeU+hG05c JxKSn0IgowWZZVLxu/XVd0xC2cQe+t+b3miRopxWdQn+EYW6r/CGRjTWwwn3oXViSAlB SPVdlDTvhWlJIN07+uUIHdiOw0xf3nYNDnJJk= 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:in-reply-to :references:in-reply-to:references; bh=8iBRjsNQkZRSvOzxngvayTBEhaU5b4EZvQnjJ3UT28w=; b=JREai4GQHT7vzoFQasjKAFFqHn4JrceSu10ZjtNge5e3c6+6bTBwmGvVwI55e1jboY MUtk3pTTaC8HoDVFLHSFvSMljoImuF590+V0sq6rbOapFbGMUGfWA5rbc3OFeW8Q7B0e zTupWrqzyEQPwUUfBwztCVocvIQ9gMrbWO8xqdzHAaCoYo9AEPzLNxCwoLYlP0ZSAsIX O2iFeYQ73MKZd9ZcUtz2l9rqHjK/P0hmUccA3RFq4NpaDcHytOpFu07cEQR2K1C02w3d 1H3YrHEq/vsP2nfirQh8X2QaQsu+EsMRN7f8FrOv8qlh48uRMKBaOjoGyRQLlhEUwkvD mGDQ== X-Gm-Message-State: AODbwcBFkgJRztwMsV+jbhS6i0aQKYxbGLCX4dtY21pRwV0dK00gsSP6 ph9ZNrcc86f3/bt1 X-Received: by 10.84.218.133 with SMTP id r5mr1944852pli.19.1494996064649; Tue, 16 May 2017 21:41:04 -0700 (PDT) Received: from localhost ([122.172.129.253]) by smtp.gmail.com with ESMTPSA id h15sm1028581pfk.120.2017.05.16.21.41.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 May 2017 21:41:04 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Vincent Guittot , Viresh Kumar Subject: [PATCH 4/4] PM / OPP: Don't create debugfs "supply-0" directory unnecessarily Date: Wed, 17 May 2017 10:10:35 +0530 Message-Id: <4365d55b97974c12a51e32b35c2832d664b928b6.1494995911.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.13.0.303.g4ebf3021692d In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org We create "supply-0" debugfs directory even if the device doesn't do voltage scaling. That looks confusing, as if the regulator is found but we never managed to get voltage levels for it. Avoid creating such a directory unnecessarily. Signed-off-by: Viresh Kumar --- drivers/base/power/opp/debugfs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 2.13.0.303.g4ebf3021692d diff --git a/drivers/base/power/opp/debugfs.c b/drivers/base/power/opp/debugfs.c index 95f433db4ac7..ce6f4832946b 100644 --- a/drivers/base/power/opp/debugfs.c +++ b/drivers/base/power/opp/debugfs.c @@ -40,11 +40,11 @@ static bool opp_debug_create_supplies(struct dev_pm_opp *opp, struct dentry *pdentry) { struct dentry *d; - int i = 0; + int i = -1; char *name; /* Always create at least supply-0 directory */ - do { + while (++i < opp_table->regulator_count) { name = kasprintf(GFP_KERNEL, "supply-%d", i); /* Create per-opp directory */ @@ -70,7 +70,7 @@ static bool opp_debug_create_supplies(struct dev_pm_opp *opp, if (!debugfs_create_ulong("u_amp", S_IRUGO, d, &opp->supplies[i].u_amp)) return false; - } while (++i < opp_table->regulator_count); + } return true; }