From patchwork Tue Nov 25 10:34:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 41453 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f70.google.com (mail-ee0-f70.google.com [74.125.83.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CE54325E18 for ; Tue, 25 Nov 2014 10:35:24 +0000 (UTC) Received: by mail-ee0-f70.google.com with SMTP id b57sf384314eek.1 for ; Tue, 25 Nov 2014 02:35:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:in-reply-to:references :sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=CKUzpVHXrVMZdMIU/KXXcTkBtV1vBbu5U2XPEOQahqY=; b=S2MRdtU5XwZ8MGEZe0fX5+3JkQHaNrMFr5OQJYoCCFci6u5bDHqPi9lcFWUX/dtw2y xXownOuaQwEanuvGJeKVznNnts+fbB5iz4MWV3RrxbGQzSW00KEIyM+DcAhHiH5Owmos lVuYnBp7/A7NZeknNbYCc5pkQvv9QzinE+JqJsst+olhhBRWocpPivmx49CDGkKbsGPK dx+0uHb4n++vQN1E3B+jhta64wIWzMG63RYmfSD0hZQf+OOLjfcS870ynsOTjD0OO7lb +iV8gsp1WIt7j8c4baB0/dlpUYYuGti/FFerKw7GEJ0WE/LRP7lrYw0HKrQ6ddK1YGYW pOuw== X-Gm-Message-State: ALoCoQlZpfrA6eGWxZono5SovkiBXkeUG+XlZAXcoZx+hpf3FRJ9BeAnOGoHBxs1F4+/fqNFB4IS X-Received: by 10.180.106.67 with SMTP id gs3mr5333897wib.3.1416911724111; Tue, 25 Nov 2014 02:35:24 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.23.130 with SMTP id m2ls523080laf.63.gmail; Tue, 25 Nov 2014 02:35:23 -0800 (PST) X-Received: by 10.152.115.230 with SMTP id jr6mr25432631lab.2.1416911723747; Tue, 25 Nov 2014 02:35:23 -0800 (PST) Received: from mail-la0-f44.google.com (mail-la0-f44.google.com. [209.85.215.44]) by mx.google.com with ESMTPS id ml2si935176lbc.7.2014.11.25.02.35.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 25 Nov 2014 02:35:23 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) client-ip=209.85.215.44; Received: by mail-la0-f44.google.com with SMTP id ge10so255338lab.17 for ; Tue, 25 Nov 2014 02:35:23 -0800 (PST) X-Received: by 10.152.6.228 with SMTP id e4mr25280056laa.71.1416911723646; Tue, 25 Nov 2014 02:35:23 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.184.201 with SMTP id ew9csp410681lbc; Tue, 25 Nov 2014 02:35:22 -0800 (PST) X-Received: by 10.68.132.198 with SMTP id ow6mr41711749pbb.61.1416911722094; Tue, 25 Nov 2014 02:35:22 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id mk8si1367241pdb.23.2014.11.25.02.35.21 for ; Tue, 25 Nov 2014 02:35:22 -0800 (PST) Received-SPF: none (google.com: linux-pm-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752234AbaKYKfU (ORCPT + 12 others); Tue, 25 Nov 2014 05:35:20 -0500 Received: from mail-pd0-f179.google.com ([209.85.192.179]:33523 "EHLO mail-pd0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752163AbaKYKfT (ORCPT ); Tue, 25 Nov 2014 05:35:19 -0500 Received: by mail-pd0-f179.google.com with SMTP id w10so334326pde.10 for ; Tue, 25 Nov 2014 02:35:18 -0800 (PST) X-Received: by 10.68.69.37 with SMTP id b5mr40867239pbu.102.1416911718646; Tue, 25 Nov 2014 02:35:18 -0800 (PST) Received: from localhost ([122.167.111.40]) by mx.google.com with ESMTPSA id qn1sm1110330pdb.42.2014.11.25.02.35.16 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 25 Nov 2014 02:35:18 -0800 (PST) From: Viresh Kumar To: Rafael Wysocki Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, stefan.wahren@i2se.com, nm@ti.com, linux-arm-kernel@lists.infradead.org, sudeep.holla@arm.com, Viresh Kumar Subject: [PATCH 2/8] opp: don't match for existing OPPs when list is empty Date: Tue, 25 Nov 2014 16:04:17 +0530 Message-Id: X-Mailer: git-send-email 2.0.3.693.g996b0fd In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , OPP list is guaranteed to be empty when 'dev_opp' is created. And so we don't need to run the comparison loop with existing OPPs. Signed-off-by: Viresh Kumar --- drivers/base/power/opp.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c index 76ae6fd..a333e2ef 100644 --- a/drivers/base/power/opp.c +++ b/drivers/base/power/opp.c @@ -417,6 +417,12 @@ int dev_pm_opp_add(struct device *dev, unsigned long freq, unsigned long u_volt) /* Hold our list modification lock here */ mutex_lock(&dev_opp_list_lock); + /* populate the opp table */ + new_opp->dev_opp = dev_opp; + new_opp->rate = freq; + new_opp->u_volt = u_volt; + new_opp->available = true; + /* Check for existing list for 'dev' */ dev_opp = find_device_opp(dev); if (IS_ERR(dev_opp)) { @@ -441,14 +447,10 @@ int dev_pm_opp_add(struct device *dev, unsigned long freq, unsigned long u_volt) /* Secure the device list modification */ list_add_rcu(&dev_opp->node, &dev_opp_list); + head = &dev_opp->opp_list; + goto list_add; } - /* populate the opp table */ - new_opp->dev_opp = dev_opp; - new_opp->rate = freq; - new_opp->u_volt = u_volt; - new_opp->available = true; - /* * Insert new OPP in order of increasing frequency * and discard if already present @@ -474,6 +476,7 @@ int dev_pm_opp_add(struct device *dev, unsigned long freq, unsigned long u_volt) return ret; } +list_add: list_add_rcu(&new_opp->node, head); mutex_unlock(&dev_opp_list_lock);