From patchwork Tue May 20 12:05:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 30420 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ig0-f199.google.com (mail-ig0-f199.google.com [209.85.213.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B8753202FE for ; Tue, 20 May 2014 12:05:30 +0000 (UTC) Received: by mail-ig0-f199.google.com with SMTP id c1sf1959873igq.10 for ; Tue, 20 May 2014 05:05:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:mime-version:in-reply-to:references :date:message-id:subject:from:to:cc:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=dewoPmNDXdjBJqI2C0U4uY6qhCWkf7n1guLwGRrOz1U=; b=UaJXrt6giHDKFsNMhN8uTd9wU4Tb0i/cAeTlv3lgFaw6tywCUOOlEnR0CffXrrx/7C pLDLr2qRwP7nGqJzCFyQR6IttQ20PZsY3dJVAw4+ucg+izWCfFJrERiKfONOs7LZw89b G+e7OeLSNHNQ1VHV7VUM/h3fZuBTV/mNXvgXuEVvgnBhHGB1j3/Laio+LsZzShxa9elI DyTL5udikKRwX6B6/3QjXbFQq5wYbiiGKuMvAnJeeGguzPWkTra6w9OxP2LdW8ZJl8Xd v/8PVV3uYSRkD/KQAkZ6h68r9o1ng13BFkTL88sWvaTmVK+LIjF9G7HYvK1GmhfpMgtv bQfg== X-Gm-Message-State: ALoCoQlhBdTm76tmBeMTMUSahnLYm5OVHv/SSvxhrzFPEdpb2MvHexGSU0sYIa091JeibqsRUMY8 X-Received: by 10.42.187.198 with SMTP id cx6mr16222973icb.8.1400587530301; Tue, 20 May 2014 05:05:30 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.40.209 with SMTP id x75ls240023qgx.46.gmail; Tue, 20 May 2014 05:05:30 -0700 (PDT) X-Received: by 10.220.103.141 with SMTP id k13mr3243941vco.25.1400587530197; Tue, 20 May 2014 05:05:30 -0700 (PDT) Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170]) by mx.google.com with ESMTPS id o5si493589vcj.31.2014.05.20.05.05.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 20 May 2014 05:05:30 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.170 as permitted sender) client-ip=209.85.220.170; Received: by mail-vc0-f170.google.com with SMTP id lf12so440283vcb.15 for ; Tue, 20 May 2014 05:05:30 -0700 (PDT) X-Received: by 10.52.255.98 with SMTP id ap2mr2791983vdd.3.1400587529173; Tue, 20 May 2014 05:05:29 -0700 (PDT) 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.220.221.72 with SMTP id ib8csp24559vcb; Tue, 20 May 2014 05:05:28 -0700 (PDT) X-Received: by 10.66.121.131 with SMTP id lk3mr49574813pab.61.1400587528267; Tue, 20 May 2014 05:05:28 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qg1si24329158pac.75.2014.05.20.05.05.27; Tue, 20 May 2014 05:05:27 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-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 S1753334AbaETMFK (ORCPT + 27 others); Tue, 20 May 2014 08:05:10 -0400 Received: from mail-oa0-f46.google.com ([209.85.219.46]:61199 "EHLO mail-oa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751161AbaETMFF (ORCPT ); Tue, 20 May 2014 08:05:05 -0400 Received: by mail-oa0-f46.google.com with SMTP id i4so374986oah.5 for ; Tue, 20 May 2014 05:05:04 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.60.52.207 with SMTP id v15mr43064485oeo.19.1400587504668; Tue, 20 May 2014 05:05:04 -0700 (PDT) Received: by 10.182.40.225 with HTTP; Tue, 20 May 2014 05:05:04 -0700 (PDT) In-Reply-To: References: <1400230809-11401-1-git-send-email-chander.kashyap@linaro.org> <537A0247.1030503@ti.com> Date: Tue, 20 May 2014 17:35:04 +0530 Message-ID: Subject: Re: [PATCH v3] PM / OPP: discard duplicate OPPs From: Viresh Kumar To: Nishanth Menon Cc: Chander Kashyap , "linux-pm@vger.kernel.org" , Linux Kernel Mailing List , "Rafael J. Wysocki" , Pavel Machek , "Brown, Len" , Greg Kroah-Hartman , Chander Kashyap , Inderpal Singh Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@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.220.170 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: , On 20 May 2014 16:56, Viresh Kumar wrote: > But we aren't talking about failure here. Its not failure. The operation > we are trying to do is already done and nothing should break if the > OPP was already there or its added now. Its all the same. Though after more thought into this I feel this must also be done: list_add_rcu(&new_opp->node, head); --- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c index bdf09f5..3f540d8 100644 --- a/drivers/base/power/opp.c +++ b/drivers/base/power/opp.c @@ -453,9 +453,13 @@ int dev_pm_opp_add(struct device *dev, unsigned long freq, unsigned long u_volt) } if (new_opp->rate == opp->rate) { + int ret = 0; + + if (new_opp->u_volt == opp->u_volt) + ret = -EEXIST; mutex_unlock(&dev_opp_list_lock); kfree(new_opp); - return 0; + return ret; }