PM / OPP: discard duplicate OPPs
authorChander Kashyap <k.chander@samsung.com>
Thu, 22 May 2014 05:06:26 +0000 (10:36 +0530)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 26 May 2014 22:50:26 +0000 (00:50 +0200)
commit64ce854578de82e9e16280298562721ced971668
tree29c2b8582a71ecdcfc2b2fe64fb26eb61608408a
parent049d595a4db3b3a20fc252298010f0545ef659a3
PM / OPP: discard duplicate OPPs

We don't have any protection against addition of duplicate OPPs currently and in
case some code tries to add them, it will end up corrupting OPP tables.

We need to handle some duplication cases separately as returning error might not
be the right thing always. The new list of return values for dev_pm_opp_add()
are:

 0:         On success OR
            Duplicate OPPs (both freq and volt are same) and opp->available
 -EEXIST:   Freq are same and volt are different OR
            Duplicate OPPs (both freq and volt are same) and !opp->available
 -ENOMEM:   Memory allocation failure

Acked-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Chander Kashyap <k.chander@samsung.com>
Signed-off-by: Inderpal Singh <inderpal.s@samsung.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/base/power/opp.c