From patchwork Tue Dec 6 09:15:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 86717 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp1917141qgi; Tue, 6 Dec 2016 01:17:01 -0800 (PST) X-Received: by 10.84.216.21 with SMTP id m21mr134121727pli.119.1481015821278; Tue, 06 Dec 2016 01:17:01 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 33si18742786plo.92.2016.12.06.01.17.01; Tue, 06 Dec 2016 01:17:01 -0800 (PST) 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=neutral (body hash did not verify) 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=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752183AbcLFJRA (ORCPT + 13 others); Tue, 6 Dec 2016 04:17:00 -0500 Received: from mail-pg0-f53.google.com ([74.125.83.53]:33592 "EHLO mail-pg0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752315AbcLFJQv (ORCPT ); Tue, 6 Dec 2016 04:16:51 -0500 Received: by mail-pg0-f53.google.com with SMTP id 3so147457296pgd.0 for ; Tue, 06 Dec 2016 01:16:33 -0800 (PST) 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=PnFpDAnzRAtcEYwOOyKExwjOIqUoUhNT9brIxeQWAd4=; b=M5Kpu0ap7l3BH+TyiH33N6ZpNBtSWTVWzGHNE67av5zjtlaUuRim/MS1ovrQBRDGTv mPzf8sUxSC81qZTMTUMrK5InZOTA2ghLHYzCOhsq3CACFXkW9rrkICyHXu+MxkX3Jiqa a9n4C0GT2cfnMmLBCxFnrVOvf4kg2tbUjkyPk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=PnFpDAnzRAtcEYwOOyKExwjOIqUoUhNT9brIxeQWAd4=; b=fcNSmj19BvKVPmOcehY7UrppVPYuOsDRV91P1ZnHmi2t8dTS41oVOazX6A8mDPgpRi gJjvXlk897XJvcwEku9PnhVnRxR8C2eL8WJmdJXgl26UYIsneD8Uzwim9hTzYqpbKJPs QVa2vCenJn8weroZWIpRIE3JKcrmTTUiihz3wqXah4i6bp+ffoBQ0DP/D5wPB53P+N/4 VzjcHyj+uTouFAkq9L69u9iZERQsTWn5pvGX9gfk3MGfDFjRDqaet7WaeGEA5xpI6Boq bpdM6RMeJ6ZWxEy0aAFSVOnHi9lBoXAKy3FsyGsY4hYwVbenriwTIrtL81/EY0bszyl8 vurA== X-Gm-Message-State: AKaTC02EWUPma1ktWjEGdwhkDUaz8x+NdaXrspYL1Pk0ufv79cpYqwF+oAqqnMcZiu0AgmrJ X-Received: by 10.98.155.146 with SMTP id e18mr62391085pfk.45.1481015793159; Tue, 06 Dec 2016 01:16:33 -0800 (PST) Received: from localhost ([122.172.43.83]) by smtp.gmail.com with ESMTPSA id x90sm33097725pfk.73.2016.12.06.01.16.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Dec 2016 01:16:32 -0800 (PST) From: Viresh Kumar To: Rafael Wysocki , Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, Vincent Guittot , Viresh Kumar Subject: [PATCH 06/10] PM / OPP: Rename and split _dev_pm_opp_remove_table() Date: Tue, 6 Dec 2016 14:45:58 +0530 Message-Id: <36344ecefaa4870ad1789339014d41a5f207a9dd.1481015522.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.7.1.410.g6faf27b 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 Later patches would want to remove OPP table (and its OPPs) using the opp_table pointer instead of 'dev'. In order to prepare for that, rename _dev_pm_opp_remove_table() as _dev_pm_opp_find_and_remove_table() split out part of it. Signed-off-by: Viresh Kumar --- drivers/base/power/opp/core.c | 33 ++++++++++++++++++++------------- drivers/base/power/opp/of.c | 2 +- drivers/base/power/opp/opp.h | 2 +- 3 files changed, 22 insertions(+), 15 deletions(-) -- 2.7.1.410.g6faf27b -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/base/power/opp/core.c b/drivers/base/power/opp/core.c index ee5fbbd6da93..ef114cf9edcd 100644 --- a/drivers/base/power/opp/core.c +++ b/drivers/base/power/opp/core.c @@ -1897,11 +1897,27 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_get_notifier); * Free OPPs either created using static entries present in DT or even the * dynamically added entries based on remove_all param. */ -void _dev_pm_opp_remove_table(struct device *dev, bool remove_all) +static void _dev_pm_opp_remove_table(struct opp_table *opp_table, + struct device *dev, bool remove_all) { - struct opp_table *opp_table; struct dev_pm_opp *opp, *tmp; + /* Find if opp_table manages a single device */ + if (list_is_singular(&opp_table->dev_list)) { + /* Free static OPPs */ + list_for_each_entry_safe(opp, tmp, &opp_table->opp_list, node) { + if (remove_all || !opp->dynamic) + _opp_remove(opp_table, opp); + } + } else { + _remove_opp_dev(_find_opp_dev(dev, opp_table), opp_table); + } +} + +void _dev_pm_opp_find_and_remove_table(struct device *dev, bool remove_all) +{ + struct opp_table *opp_table; + /* Hold our table modification lock here */ mutex_lock(&opp_table_lock); @@ -1918,16 +1934,7 @@ void _dev_pm_opp_remove_table(struct device *dev, bool remove_all) goto unlock; } - /* Find if opp_table manages a single device */ - if (list_is_singular(&opp_table->dev_list)) { - /* Free static OPPs */ - list_for_each_entry_safe(opp, tmp, &opp_table->opp_list, node) { - if (remove_all || !opp->dynamic) - _opp_remove(opp_table, opp); - } - } else { - _remove_opp_dev(_find_opp_dev(dev, opp_table), opp_table); - } + _dev_pm_opp_remove_table(opp_table, dev, remove_all); unlock: mutex_unlock(&opp_table_lock); @@ -1948,6 +1955,6 @@ void _dev_pm_opp_remove_table(struct device *dev, bool remove_all) */ void dev_pm_opp_remove_table(struct device *dev) { - _dev_pm_opp_remove_table(dev, true); + _dev_pm_opp_find_and_remove_table(dev, true); } EXPORT_SYMBOL_GPL(dev_pm_opp_remove_table); diff --git a/drivers/base/power/opp/of.c b/drivers/base/power/opp/of.c index 67c9eeded4e1..442fa46c4f5c 100644 --- a/drivers/base/power/opp/of.c +++ b/drivers/base/power/opp/of.c @@ -238,7 +238,7 @@ static int opp_parse_supplies(struct dev_pm_opp *opp, struct device *dev, */ void dev_pm_opp_of_remove_table(struct device *dev) { - _dev_pm_opp_remove_table(dev, false); + _dev_pm_opp_find_and_remove_table(dev, false); } EXPORT_SYMBOL_GPL(dev_pm_opp_of_remove_table); diff --git a/drivers/base/power/opp/opp.h b/drivers/base/power/opp/opp.h index 334f7570df32..c4b539a8533a 100644 --- a/drivers/base/power/opp/opp.h +++ b/drivers/base/power/opp/opp.h @@ -192,7 +192,7 @@ struct opp_table { /* Routines internal to opp core */ struct opp_table *_find_opp_table(struct device *dev); struct opp_device *_add_opp_dev(const struct device *dev, struct opp_table *opp_table); -void _dev_pm_opp_remove_table(struct device *dev, bool remove_all); +void _dev_pm_opp_find_and_remove_table(struct device *dev, bool remove_all); struct dev_pm_opp *_opp_allocate(struct device *dev, struct opp_table **opp_table); void _opp_free(struct dev_pm_opp *opp, struct opp_table *opp_table); int _opp_add(struct device *dev, struct dev_pm_opp *new_opp, struct opp_table *opp_table);