From patchwork Wed Jul 22 02:09:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 6839031 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E62109F38B for ; Wed, 22 Jul 2015 01:42:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 756E5206D0 for ; Wed, 22 Jul 2015 01:42:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3C168205D8 for ; Wed, 22 Jul 2015 01:42:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753084AbbGVBmY (ORCPT ); Tue, 21 Jul 2015 21:42:24 -0400 Received: from v094114.home.net.pl ([79.96.170.134]:48059 "HELO v094114.home.net.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1750872AbbGVBmX (ORCPT ); Tue, 21 Jul 2015 21:42:23 -0400 Received: from aerr155.neoplus.adsl.tpnet.pl (79.191.199.155) (HELO vostro.rjw.lan) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer v0.80) id 3fa299622b1f44ef; Wed, 22 Jul 2015 03:42:21 +0200 From: "Rafael J. Wysocki" To: Linux PM list , Viresh Kumar Cc: Linux Kernel Mailing List Subject: [PATCH] cpufreq: Drop unnecessary arguments from two functions Date: Wed, 22 Jul 2015 04:09:08 +0200 Message-ID: <1710735.NHMxY7dJsV@vostro.rjw.lan> User-Agent: KMail/4.11.5 (Linux/4.1.0-rc5+; KDE/4.11.5; x86_64; ; ) MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Rafael J. Wysocki The second sif argument of __cpufreq_remove_dev_prepare() is never used by it, so drop it. The second sif argument of __cpufreq_remove_dev_finish() is only used for one check that is not necessary if the policy is freed by cpufreq_remove_dev() itself, so make cpufreq_remove_dev() free the policy and drop the __cpufreq_remove_dev_finish()'s second argument too. Signed-off-by: Rafael J. Wysocki --- drivers/cpufreq/cpufreq.c | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) -- 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 Index: linux-pm/drivers/cpufreq/cpufreq.c =================================================================== --- linux-pm.orig/drivers/cpufreq/cpufreq.c +++ linux-pm/drivers/cpufreq/cpufreq.c @@ -1421,8 +1421,7 @@ out_release_rwsem: return ret; } -static int __cpufreq_remove_dev_prepare(struct device *dev, - struct subsys_interface *sif) +static int __cpufreq_remove_dev_prepare(struct device *dev) { unsigned int cpu = dev->id; int ret = 0; @@ -1474,8 +1473,7 @@ static int __cpufreq_remove_dev_prepare( return ret; } -static int __cpufreq_remove_dev_finish(struct device *dev, - struct subsys_interface *sif) +static int __cpufreq_remove_dev_finish(struct device *dev) { unsigned int cpu = dev->id; int ret; @@ -1507,10 +1505,6 @@ static int __cpufreq_remove_dev_finish(s if (cpufreq_driver->exit) cpufreq_driver->exit(policy); - /* Free the policy only if the driver is getting removed. */ - if (sif) - cpufreq_policy_free(policy, true); - return 0; } @@ -1522,6 +1516,7 @@ static int __cpufreq_remove_dev_finish(s static int cpufreq_remove_dev(struct device *dev, struct subsys_interface *sif) { unsigned int cpu = dev->id; + struct cpufreq_policy *policy = per_cpu(cpufreq_cpu_data, cpu); int ret; /* @@ -1530,7 +1525,6 @@ static int cpufreq_remove_dev(struct dev * link or free policy here. */ if (cpu_is_offline(cpu)) { - struct cpufreq_policy *policy = per_cpu(cpufreq_cpu_data, cpu); struct cpumask mask; if (!policy) @@ -1547,17 +1541,18 @@ static int cpufreq_remove_dev(struct dev remove_cpu_dev_symlink(policy, cpu); return 0; } + } else { + ret = __cpufreq_remove_dev_prepare(dev); + if (!ret) + ret = __cpufreq_remove_dev_finish(dev); - cpufreq_policy_free(policy, true); - return 0; + /* The CPU is online, so the policy cannot be inactive here. */ + if (ret) + return ret; } - ret = __cpufreq_remove_dev_prepare(dev, sif); - - if (!ret) - ret = __cpufreq_remove_dev_finish(dev, sif); - - return ret; + cpufreq_policy_free(policy, true); + return 0; } static void handle_update(struct work_struct *work) @@ -2396,11 +2391,11 @@ static int cpufreq_cpu_callback(struct n break; case CPU_DOWN_PREPARE: - __cpufreq_remove_dev_prepare(dev, NULL); + __cpufreq_remove_dev_prepare(dev); break; case CPU_POST_DEAD: - __cpufreq_remove_dev_finish(dev, NULL); + __cpufreq_remove_dev_finish(dev); break; case CPU_DOWN_FAILED: