From patchwork Wed Sep 19 22:20:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 147056 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp1233095ljw; Wed, 19 Sep 2018 15:21:02 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZZkSd8c0iOmYo7gE6rpjbq84xUK1AM8I6ba9GxmGH2GQ3kiyVmMhsGjn4FO4TDDNSVt0gI X-Received: by 2002:a63:4745:: with SMTP id w5-v6mr34759218pgk.140.1537395662430; Wed, 19 Sep 2018 15:21:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537395662; cv=none; d=google.com; s=arc-20160816; b=Se211ns1RSYBGDatco+jug0EK8XJIo2lmhAfldj/ryIkDJKAMbLGvuGM3XKvuiKAst /sJg4+vRp/Ln9v83Dfvc17/xjKGnY+gWtWyjvmdjiNQAYYstqgPJ03njjY20X4rlKY3O M+atjQLUMe7+7pYb8zK/uLmIPzN6Io/IhOt575945nXG0aIUx60VuhzunSlyrQU5U8mJ kyFRoNF4JFmg6ruz9rkGAo4I+CzfLsfMXzPnF7JtDIgmGju8G/L9wItEyuGZx3Fo4F2R xFYPfUdvkVnXd0pcFwjgNguSZrUPHJl5/Pc/9Ger2Djn/wh6R6X5oTq9eAzJzaYfXE5Z O+pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=lOCO4EDC8Q7oDBzPlggldAfccotE1FhuTN71HpuLTTI=; b=axErbjOGhS0WlGws2TAOM5D9KRmUBlmVfz0P1F5fF8eD5h0UtkXXLst3o6FTxP8eGT g80BObGolDAHSa0LTiMqO9cIUPRSgR9WQpI8ybG3V4s7lmVDMeAGAczbj13aY20d5/w6 e+MY7XNLpvvbGEIocy0Ik5g2R0Yz9vgzYd0r4kEzBAOlU7NkB1dMFuEbpbnbDjyEodPI j1cTEm65+zDb0W2Je0LwG60G8W5pxwFmkQw+C1Ar9cnhMrHucodyC8W3rtAV1neL/u7+ yUi92I6LL+DZ1+4mQFT6Kuj2jqy2K8KuiT81R6f9UsYLEC0sKvhyAaqoqhLsdUARwMxC es6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dxzQxtXO; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n8-v6si22034915pgl.101.2018.09.19.15.21.02; Wed, 19 Sep 2018 15:21:02 -0700 (PDT) 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=pass header.i=@linaro.org header.s=google header.b=dxzQxtXO; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732890AbeITEBB (ORCPT + 10 others); Thu, 20 Sep 2018 00:01:01 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:43302 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387458AbeITEA5 (ORCPT ); Thu, 20 Sep 2018 00:00:57 -0400 Received: by mail-pg1-f195.google.com with SMTP id q19-v6so2534151pgn.10 for ; Wed, 19 Sep 2018 15:20:57 -0700 (PDT) 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=lOCO4EDC8Q7oDBzPlggldAfccotE1FhuTN71HpuLTTI=; b=dxzQxtXOMt24gp9Kdm/pMZ4LveTazVeLqdhF0qSrKiMNHtcJ44NVLQzl9NBf+hGERr JhaKkEzKDIC4UUM4N51wTgrXmUhXBu5rFIbe7nDqq/HjP0dKHAXUBMbLAquaY8pySmiy itRyPU2Xdg6pKq0p+JcgiptMxGSHBVQbyWTsE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=lOCO4EDC8Q7oDBzPlggldAfccotE1FhuTN71HpuLTTI=; b=prZEF+Doog1ybaXc33x0a0cpSCcqUYVKshc80goxpXnjALF2l4B84NWrp7HxPA0aTO KzV3+TB/DCahoMktygZ7x5B+hEaZr12m46EKBI6fBH8rBxb/+N1JTwAnbUQHKJJ4QkZh qmCZP/uPDlWzvDIpi2EE8FCvbtuoEnxZbLSZV/lTTIIjU3dZPkBLTCKCaeNt6lo0P/RT tLB1IVQs5MyxAWQx0q7JCASPIGsARpjIynV+dvwhCp2cxsbMVp1tdjx9BfSgVBf0sPC3 g5RYzEJMM66SFvzUr5C8LPXInFiOYnhuMT0UReZXJn1VyHjB3Bwlg//D4jmsrcvsARsD HAVw== X-Gm-Message-State: APzg51AEWOI1Hr86GXJ5holdRbExE3wySG/zZgMVMT+kL7Ss5U5EdqUD U/40o014zWM7SZmgKFtZeztpkA== X-Received: by 2002:a62:225d:: with SMTP id i90-v6mr37923089pfi.246.1537395656692; Wed, 19 Sep 2018 15:20:56 -0700 (PDT) Received: from localhost ([209.121.128.187]) by smtp.gmail.com with ESMTPSA id f11-v6sm32580232pfa.131.2018.09.19.15.20.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 19 Sep 2018 15:20:56 -0700 (PDT) From: Viresh Kumar To: Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Viresh Kumar , Rafael Wysocki , linux-pm@vger.kernel.org, Vincent Guittot , Niklas Cassel , linux-kernel@vger.kernel.org Subject: [PATCH V2 09/12] OPP: Don't remove dynamic OPPs from _dev_pm_opp_remove_table() Date: Wed, 19 Sep 2018 15:20:28 -0700 Message-Id: <2a4eb7358aba6beff7fa23f028c733310756e525.1537394233.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.14.1 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 Only one platform was depending on this feature and it is already updated now. Stop removing dynamic OPPs from _dev_pm_opp_remove_table(). This simplifies lot of paths and removes unnecessary parameters. Tested-by: Niklas Cassel Signed-off-by: Viresh Kumar --- drivers/opp/core.c | 20 +++++--------------- drivers/opp/cpu.c | 9 +++------ drivers/opp/of.c | 12 ++++++------ drivers/opp/opp.h | 6 +++--- 4 files changed, 17 insertions(+), 30 deletions(-) -- 2.14.1 diff --git a/drivers/opp/core.c b/drivers/opp/core.c index b555121b878b..2319ad4a0177 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -1759,14 +1759,10 @@ int dev_pm_opp_unregister_notifier(struct device *dev, EXPORT_SYMBOL(dev_pm_opp_unregister_notifier); /* - * Free OPPs either created using static entries present in DT or even the - * dynamically added entries based on remove_all param. + * Free OPPs either created using static entries present in DT. */ -void _dev_pm_opp_remove_table(struct opp_table *opp_table, struct device *dev, - bool remove_all) +void _dev_pm_opp_remove_table(struct opp_table *opp_table, struct device *dev) { - struct dev_pm_opp *opp, *tmp; - /* Protect dev_list */ mutex_lock(&opp_table->lock); @@ -1775,12 +1771,6 @@ void _dev_pm_opp_remove_table(struct opp_table *opp_table, struct device *dev, /* Free static OPPs */ _put_opp_list_kref(opp_table); - /* Free dynamic OPPs */ - list_for_each_entry_safe(opp, tmp, &opp_table->opp_list, node) { - if (remove_all) - dev_pm_opp_put(opp); - } - /* * The OPP table is getting removed, drop the performance state * constraints. @@ -1795,7 +1785,7 @@ void _dev_pm_opp_remove_table(struct opp_table *opp_table, struct device *dev, mutex_unlock(&opp_table->lock); } -void _dev_pm_opp_find_and_remove_table(struct device *dev, bool remove_all) +void _dev_pm_opp_find_and_remove_table(struct device *dev) { struct opp_table *opp_table; @@ -1812,7 +1802,7 @@ void _dev_pm_opp_find_and_remove_table(struct device *dev, bool remove_all) return; } - _dev_pm_opp_remove_table(opp_table, dev, remove_all); + _dev_pm_opp_remove_table(opp_table, dev); dev_pm_opp_put_opp_table(opp_table); } @@ -1826,6 +1816,6 @@ void _dev_pm_opp_find_and_remove_table(struct device *dev, bool remove_all) */ void dev_pm_opp_remove_table(struct device *dev) { - _dev_pm_opp_find_and_remove_table(dev, true); + _dev_pm_opp_find_and_remove_table(dev); } EXPORT_SYMBOL_GPL(dev_pm_opp_remove_table); diff --git a/drivers/opp/cpu.c b/drivers/opp/cpu.c index 36586f66cd83..ab6d07e78945 100644 --- a/drivers/opp/cpu.c +++ b/drivers/opp/cpu.c @@ -108,7 +108,7 @@ void dev_pm_opp_free_cpufreq_table(struct device *dev, EXPORT_SYMBOL_GPL(dev_pm_opp_free_cpufreq_table); #endif /* CONFIG_CPU_FREQ */ -void _dev_pm_opp_cpumask_remove_table(const struct cpumask *cpumask, bool of, +void _dev_pm_opp_cpumask_remove_table(const struct cpumask *cpumask, int last_cpu) { struct device *cpu_dev; @@ -127,10 +127,7 @@ void _dev_pm_opp_cpumask_remove_table(const struct cpumask *cpumask, bool of, continue; } - if (of) - dev_pm_opp_of_remove_table(cpu_dev); - else - dev_pm_opp_remove_table(cpu_dev); + _dev_pm_opp_find_and_remove_table(cpu_dev); } } @@ -144,7 +141,7 @@ void _dev_pm_opp_cpumask_remove_table(const struct cpumask *cpumask, bool of, */ void dev_pm_opp_cpumask_remove_table(const struct cpumask *cpumask) { - _dev_pm_opp_cpumask_remove_table(cpumask, false, -1); + _dev_pm_opp_cpumask_remove_table(cpumask, -1); } EXPORT_SYMBOL_GPL(dev_pm_opp_cpumask_remove_table); diff --git a/drivers/opp/of.c b/drivers/opp/of.c index aaa4bab69846..861cc75de329 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c @@ -279,7 +279,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_find_and_remove_table(dev, false); + _dev_pm_opp_find_and_remove_table(dev); } EXPORT_SYMBOL_GPL(dev_pm_opp_of_remove_table); @@ -432,7 +432,7 @@ static int _of_add_opp_table_v2(struct device *dev, struct device_node *opp_np, if (ret) { dev_err(dev, "%s: Failed to add OPP, %d\n", __func__, ret); - _dev_pm_opp_remove_table(opp_table, dev, false); + _dev_pm_opp_remove_table(opp_table, dev); of_node_put(np); goto put_opp_table; } @@ -453,7 +453,7 @@ static int _of_add_opp_table_v2(struct device *dev, struct device_node *opp_np, dev_err(dev, "Not all nodes have performance state set (%d: %d)\n", count, pstate_count); ret = -ENOENT; - _dev_pm_opp_remove_table(opp_table, dev, false); + _dev_pm_opp_remove_table(opp_table, dev); goto put_opp_table; } @@ -507,7 +507,7 @@ static int _of_add_opp_table_v1(struct device *dev) if (ret) { dev_err(dev, "%s: Failed to add OPP %ld (%d)\n", __func__, freq, ret); - _dev_pm_opp_remove_table(opp_table, dev, false); + _dev_pm_opp_remove_table(opp_table, dev); break; } nr -= 2; @@ -618,7 +618,7 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_of_add_table_indexed); */ void dev_pm_opp_of_cpumask_remove_table(const struct cpumask *cpumask) { - _dev_pm_opp_cpumask_remove_table(cpumask, true, -1); + _dev_pm_opp_cpumask_remove_table(cpumask, -1); } EXPORT_SYMBOL_GPL(dev_pm_opp_of_cpumask_remove_table); @@ -653,7 +653,7 @@ int dev_pm_opp_of_cpumask_add_table(const struct cpumask *cpumask) __func__, cpu, ret); /* Free all other OPPs */ - _dev_pm_opp_cpumask_remove_table(cpumask, true, cpu); + _dev_pm_opp_cpumask_remove_table(cpumask, cpu); break; } } diff --git a/drivers/opp/opp.h b/drivers/opp/opp.h index 9274116c90e4..98dd7d39e1ad 100644 --- a/drivers/opp/opp.h +++ b/drivers/opp/opp.h @@ -194,13 +194,13 @@ void _get_opp_table_kref(struct opp_table *opp_table); int _get_opp_count(struct opp_table *opp_table); 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 opp_table *opp_table, struct device *dev, bool remove_all); -void _dev_pm_opp_find_and_remove_table(struct device *dev, bool remove_all); +void _dev_pm_opp_remove_table(struct opp_table *opp_table, struct device *dev); +void _dev_pm_opp_find_and_remove_table(struct device *dev); struct dev_pm_opp *_opp_allocate(struct opp_table *opp_table); void _opp_free(struct dev_pm_opp *opp); int _opp_add(struct device *dev, struct dev_pm_opp *new_opp, struct opp_table *opp_table, bool rate_not_available); int _opp_add_v1(struct opp_table *opp_table, struct device *dev, unsigned long freq, long u_volt, bool dynamic); -void _dev_pm_opp_cpumask_remove_table(const struct cpumask *cpumask, bool of, int last_cpu); +void _dev_pm_opp_cpumask_remove_table(const struct cpumask *cpumask, int last_cpu); struct opp_table *_add_opp_table(struct device *dev); void _put_opp_list_kref(struct opp_table *opp_table);