From patchwork Thu Feb 19 11:32:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 44831 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A90AA21554 for ; Thu, 19 Feb 2015 11:34:44 +0000 (UTC) Received: by mail-wi0-f200.google.com with SMTP id r20sf5194631wiv.3 for ; Thu, 19 Feb 2015 03:34:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:in-reply-to:references :sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=sLi7H0FzRwcw6d+g7B2IEaiM+Vv9PsH9CH/jQKz8QVk=; b=RxjsbIMzRbwalxhS3jSYbZkndxWlBnhCkTtbQSjpAgU1MsgWA9NmR8/Wo3PFWaWCMM slOkXeI/zifZGvMvihG7iFyL37DwMvtpvXweItBmp9pMg1znEv2S/X17T1F7UOF2KyRe 2suGM1APrWK38va4ZzZsm2i7/n9radh0wQizceYpzHpRo5Jzt2jH2UUto4ceLLC9MQu5 /tKhlixZsrBIJUpz5ZRlFnr1Eb5NbVa0VeKDhYeiQ0Z1KB9/5YdeuxLMAC4P+u0C/U2l I+GsmD3k17byvhEKQtRbUciztegnq7HLxTZUiiqY5eQyd1q4DGga47dc8ii9SQUQ0KYm hY0A== X-Gm-Message-State: ALoCoQlVcSAoMrARHP2gFHVlSKJgQJMyPRKXPLdZ2YnUaxcVYIyqGClbTzh4z3qezEoK8thGbKCR X-Received: by 10.194.142.174 with SMTP id rx14mr513347wjb.4.1424345684001; Thu, 19 Feb 2015 03:34:44 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.18.169 with SMTP id x9ls147613lad.72.gmail; Thu, 19 Feb 2015 03:34:43 -0800 (PST) X-Received: by 10.112.150.161 with SMTP id uj1mr3749217lbb.14.1424345683761; Thu, 19 Feb 2015 03:34:43 -0800 (PST) Received: from mail-lb0-f170.google.com (mail-lb0-f170.google.com. [209.85.217.170]) by mx.google.com with ESMTPS id uj9si14766240lbb.97.2015.02.19.03.34.43 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Feb 2015 03:34:43 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.170 as permitted sender) client-ip=209.85.217.170; Received: by lbjf15 with SMTP id f15so6754153lbj.13 for ; Thu, 19 Feb 2015 03:34:43 -0800 (PST) X-Received: by 10.152.5.167 with SMTP id t7mr3769533lat.32.1424345683668; Thu, 19 Feb 2015 03:34:43 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.35.133 with SMTP id h5csp432007lbj; Thu, 19 Feb 2015 03:34:42 -0800 (PST) X-Received: by 10.70.100.38 with SMTP id ev6mr6672040pdb.135.1424345681381; Thu, 19 Feb 2015 03:34:41 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bm5si944378pbd.217.2015.02.19.03.34.40; Thu, 19 Feb 2015 03:34:41 -0800 (PST) Received-SPF: none (google.com: linux-pm-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753418AbbBSLef (ORCPT + 11 others); Thu, 19 Feb 2015 06:34:35 -0500 Received: from mail-pa0-f44.google.com ([209.85.220.44]:40409 "EHLO mail-pa0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753483AbbBSLee (ORCPT ); Thu, 19 Feb 2015 06:34:34 -0500 Received: by paceu11 with SMTP id eu11so8850036pac.7 for ; Thu, 19 Feb 2015 03:34:33 -0800 (PST) X-Received: by 10.70.51.131 with SMTP id k3mr6552623pdo.155.1424345673418; Thu, 19 Feb 2015 03:34:33 -0800 (PST) Received: from localhost ([122.172.249.58]) by mx.google.com with ESMTPSA id di5sm23445286pbc.36.2015.02.19.03.34.32 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 19 Feb 2015 03:34:32 -0800 (PST) From: Viresh Kumar To: Rafael Wysocki Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, sboyd@codeaurora.org, prarit@redhat.com, skannan@codeaurora.org, Viresh Kumar Subject: [PATCH V2 18/20] cpufreq: Call cpufreq_policy_put_kobj() from cpufreq_policy_free() Date: Thu, 19 Feb 2015 17:02:20 +0530 Message-Id: <65c0b236942cb4710e0dbdff3efef906b9625f08.1424345053.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.3.0.rc0.44.ga94655d In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.170 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , cpufreq_policy_put_kobj() is actually part of freeing the policy and can be called from cpufreq_policy_free() directly instead of a separate call. Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 4fb5041ebfab..b6d5d94a0d3b 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1197,7 +1197,7 @@ static void cpufreq_policy_put_kobj(struct cpufreq_policy *policy, bool notify) pr_debug("wait complete\n"); } -static void cpufreq_policy_free(struct cpufreq_policy *policy) +static void cpufreq_policy_free(struct cpufreq_policy *policy, bool notify) { unsigned long flags; int cpu; @@ -1210,6 +1210,7 @@ static void cpufreq_policy_free(struct cpufreq_policy *policy) per_cpu(cpufreq_cpu_data, cpu) = NULL; write_unlock_irqrestore(&cpufreq_driver_lock, flags); + cpufreq_policy_put_kobj(policy, notify); free_cpumask_var(policy->related_cpus); free_cpumask_var(policy->cpus); kfree(policy); @@ -1383,9 +1384,7 @@ static int cpufreq_add_dev(struct device *dev, struct subsys_interface *sif) if (cpufreq_driver->exit) cpufreq_driver->exit(policy); err_set_policy_cpu: - cpufreq_policy_put_kobj(policy, recover_policy); - cpufreq_policy_free(policy); - + cpufreq_policy_free(policy, recover_policy); nomem_out: up_read(&cpufreq_rwsem); @@ -1480,10 +1479,6 @@ static int __cpufreq_remove_dev_finish(struct device *dev, } } - /* Free the policy kobjects only if the driver is getting removed. */ - if (sif) - cpufreq_policy_put_kobj(policy, true); - /* * Perform the ->exit() even during light-weight tear-down, * since this is a core component, and is essential for the @@ -1492,8 +1487,9 @@ static int __cpufreq_remove_dev_finish(struct device *dev, if (cpufreq_driver->exit) cpufreq_driver->exit(policy); + /* Free the policy only if the driver is getting removed. */ if (sif) - cpufreq_policy_free(policy); + cpufreq_policy_free(policy, true); else policy->governor = NULL;