From patchwork Tue May 23 04:02:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 100349 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp138054qge; Mon, 22 May 2017 21:02:33 -0700 (PDT) X-Received: by 10.84.191.228 with SMTP id a91mr33512577pld.62.1495512153042; Mon, 22 May 2017 21:02:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495512153; cv=none; d=google.com; s=arc-20160816; b=DvnKbkNx6e6YdZZ0VPYFThxwN+Il8XpaFOqcVKx4T05VeaZfiII7yggrxk4W7xztwR dRpbLE7Zq5OvK1VKlii2JGvQYTQ85k0/kjTLNZCOHKgMJD69BMoxe1AaZ5P47Ype21dt oNDl55mo3uQ85/wcijmC4bymj5IzLBX0+y3gCWEEvGQPJjtmmNN+HJW5QCX++qc6G7BK tsRyJz2njM7t14c5mG+svKvCkHcdeIFStntMzr9Ect65pYfsbJYTxrGT+A+4C+GaJCNv RK94cTz2k8mOY5iKJHG5kZ5SkXCd4naTJ4UKvIJQnoCuhphfbM7mBbBy6+AqjyjfjGDJ sRjQ== 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=NYqLBWYkKYxEez+qnX9K54pJBlTLyZyNqdpG/BrrJPg=; b=Jhx6o6po/abkd+ElSTE5PPLj7bQ4oXzke8oBhBA8gn1wMh8wUeOu1M+gX0Stch9Z8Q idtMz36km641/z+rzDDQeDkTkLp18edI4FpWJgVubzhndNcn3Hzgs9QsZCa/XGkyqP00 0778DKYH8HE2X46iFj5gYt/WKfAumpzv9VNe+nkjd4gNcHNS57EvrxIf+7sCe22Txsue CKOBPJZW4rK+YW7AcSKwykUp/NvWY1Ri/NuP8XXiABb3Kd1HMKcGnIRD+HZvbGonnjMo dTfGdUF3m+iDnO03xi91S/RxQ+IgN1ugkXJZZ5paVxm5SwmojcD5UirUtQnUVFsmU7iN DCwA== 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 a5si15961203pfb.227.2017.05.22.21.02.32; Mon, 22 May 2017 21:02:33 -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 S1751696AbdEWECY (ORCPT + 14 others); Tue, 23 May 2017 00:02:24 -0400 Received: from mail-pf0-f181.google.com ([209.85.192.181]:35209 "EHLO mail-pf0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751648AbdEWECW (ORCPT ); Tue, 23 May 2017 00:02:22 -0400 Received: by mail-pf0-f181.google.com with SMTP id n23so101217527pfb.2 for ; Mon, 22 May 2017 21:02:21 -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=NYqLBWYkKYxEez+qnX9K54pJBlTLyZyNqdpG/BrrJPg=; b=Iqs6HeFsullktAr2PMqP6tYRSYeIMJPGP88bWgegQAZZjKTmTIzsrc7v699ctM6SRq Wqj2VbJLWowg1IQmxZPkrx96rSDSpsLZA4RCw9UuHIjkqYXmslYqwk8UnJ9XEF+5AznD 1sbja524Blbinb3yxA/GQE6YuGVewATSHYD9o= 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=NYqLBWYkKYxEez+qnX9K54pJBlTLyZyNqdpG/BrrJPg=; b=hIkl6idktMCVJe2yQ37kAkeh+TU+1UT3YtkxA1pUGOfLMKwn9QyyEwbdJaWr5k3etK eUU07/ld1U5EmL010ljoNALeg9KFhRjWzwYFFgKAoymVUlR5j/PavLVflWrCK+5Ic85D efiyjSOEoflhKNnEe6i8KTUcKX30WhZNwhETexPNTuPprrUmHSlp+Qw3A4VH/dIO7wwA 5ZQy2sPjj32Q0Eoaqa2+Mjz8RGPPj6noREWK/a3aTXH9018d4ZZ3176oh4zPvCKEB5Nh io93abjx/jtJ8dFZ5PVFiJA7d+yDFKF4t4WeyP5oQ2W2AOmJYSaR4a+i/aUvgtTj/Bq0 2JLQ== X-Gm-Message-State: AODbwcCDSDqdG7JnqHRTPnFoAFLsGE1rulITOKyb4PrsVwGvGThcHlOQ uPp7u5//DgiYOMor X-Received: by 10.84.224.77 with SMTP id a13mr33699767plt.132.1495512141310; Mon, 22 May 2017 21:02:21 -0700 (PDT) Received: from localhost ([122.167.143.58]) by smtp.gmail.com with ESMTPSA id b195sm27523234pfb.29.2017.05.22.21.02.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 May 2017 21:02:20 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Viresh Kumar , linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Vincent Guittot Subject: [PATCH V2 2/4] PM / OPP: Don't create copy of regulators unnecessarily Date: Tue, 23 May 2017 09:32:11 +0530 Message-Id: X-Mailer: git-send-email 2.13.0.70.g6367777092d9 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 Reviewed-by: Stephen Boyd --- drivers/base/power/opp/core.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) -- 2.13.0.70.g6367777092d9 diff --git a/drivers/base/power/opp/core.c b/drivers/base/power/opp/core.c index c4590fc017ba..5ee7aadf0abf 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);