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);