From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753428AbaETNga (ORCPT ); Tue, 20 May 2014 09:36:30 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:55154 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751760AbaETNg2 (ORCPT ); Tue, 20 May 2014 09:36:28 -0400 Message-ID: <537B5A4F.2040209@ti.com> Date: Tue, 20 May 2014 08:36:15 -0500 From: Nishanth Menon User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: Viresh Kumar 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 Subject: Re: [PATCH v3] PM / OPP: discard duplicate OPPs References: <1400230809-11401-1-git-send-email-chander.kashyap@linaro.org> <537A0247.1030503@ti.com> In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/20/2014 08:31 AM, Viresh Kumar wrote: > On 20 May 2014 17:35, Viresh Kumar wrote: >> Though after more thought into this I feel this must also be done: >> >> 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; > > Ahh, sorry gentlemen. I have screwed up yet again. > > I meant this instead: > >> + if (new_opp->u_volt != opp->u_volt) >> + ret = -EEXIST; > > Otherwise we are trying to add same OPP again and we can > return zero. > if it was added and disabled? I suggest: new_opp->u_volt != opp->u_volt || !opp->available I still dont like the idea that we are allowing folks to do: { {1GHz 1.1V} {1GHz 1.1V} {1.2GHz 1.2V} } if you already had an OPP added and are trying to add it again, you might want some debug ability. but anyways, with the mentioned check above, my opposition is lower. -- Regards, Nishanth Menon