From patchwork Mon Jun 8 12:55:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 49617 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8E4B321419 for ; Mon, 8 Jun 2015 12:56:47 +0000 (UTC) Received: by lbcak1 with SMTP id ak1sf33412288lbc.2 for ; Mon, 08 Jun 2015 05:56:46 -0700 (PDT) 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=w8ppOb9/KvaHIzDSaTFSHkzlCCbJ78sphiJJMYOYOr0=; b=MYG64i8gHt0xhpKaIWPVsSakqoWUCi7jDMR0rTbDxQgcQFq5wt6Ki7kG0fKxtLkndS HDvL1HTvH5NmG36i1itlWl40+AAFbDsDbNAq9Nmk78ezUd9haWpt24SU5iOE1Xdi/Wiz IfPDtMKFRmtehSI81HNI4KVGzs48ErUrfpS9dmP5KxKQSq0YlARXwo45peTiIZj+RM3Z yhVYFAeLCn52GkuLeZGzIxfVDVad0KaqLusndrzln1Yvsk+Eb8tpRT3xbqkP9Fj1gOV9 oZ7HY6mFtMZcd9+sRfuNHqlUAcb9tNywSVCZE8O/GAhJGyDbtYD+uaHUBj0LHEfj7lJO udvw== X-Gm-Message-State: ALoCoQkc3DLPJRDeE1vJLJ6vxKaZs+8bqtZKMULP3NP68L+94+8+0smxiAX7qqcwgux6vzKnGVlt X-Received: by 10.194.47.179 with SMTP id e19mr17032321wjn.4.1433768206569; Mon, 08 Jun 2015 05:56:46 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.120.9 with SMTP id ky9ls553876lab.98.gmail; Mon, 08 Jun 2015 05:56:46 -0700 (PDT) X-Received: by 10.152.18.163 with SMTP id x3mr16480267lad.70.1433768206406; Mon, 08 Jun 2015 05:56:46 -0700 (PDT) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com. [209.85.217.169]) by mx.google.com with ESMTPS id g1si2635853laf.139.2015.06.08.05.56.46 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Jun 2015 05:56:46 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) client-ip=209.85.217.169; Received: by lbbqq2 with SMTP id qq2so80044046lbb.3 for ; Mon, 08 Jun 2015 05:56:46 -0700 (PDT) X-Received: by 10.152.29.34 with SMTP id g2mr16657701lah.73.1433768206309; Mon, 08 Jun 2015 05:56:46 -0700 (PDT) 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.108.230 with SMTP id hn6csp1845195lbb; Mon, 8 Jun 2015 05:56:45 -0700 (PDT) X-Received: by 10.68.178.229 with SMTP id db5mr29609135pbc.17.1433768201523; Mon, 08 Jun 2015 05:56:41 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id df1si4029496pad.84.2015.06.08.05.56.40; Mon, 08 Jun 2015 05:56:41 -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; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753148AbbFHM4j (ORCPT + 11 others); Mon, 8 Jun 2015 08:56:39 -0400 Received: from mail-pd0-f171.google.com ([209.85.192.171]:36234 "EHLO mail-pd0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752216AbbFHM4G (ORCPT ); Mon, 8 Jun 2015 08:56:06 -0400 Received: by pdjm12 with SMTP id m12so104116182pdj.3 for ; Mon, 08 Jun 2015 05:56:06 -0700 (PDT) X-Received: by 10.70.109.199 with SMTP id hu7mr29474987pdb.71.1433768166036; Mon, 08 Jun 2015 05:56:06 -0700 (PDT) Received: from localhost ([122.167.219.251]) by mx.google.com with ESMTPSA id j10sm2588403pdk.48.2015.06.08.05.56.04 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 08 Jun 2015 05:56:05 -0700 (PDT) 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, Srivatsa Bhat , Viresh Kumar Subject: [PATCH V7 4/6] cpufreq: Call cpufreq_policy_put_kobj() from cpufreq_policy_free() Date: Mon, 8 Jun 2015 18:25:30 +0530 Message-Id: <174a053d67dd11bcd7a3ff6ae4226a5b088116d7.1433767914.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.4.0 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.169 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 | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index d890804d561f..d3bd85263643 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1203,7 +1203,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; @@ -1216,6 +1216,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); @@ -1420,9 +1421,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); @@ -1514,10 +1513,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 @@ -1526,8 +1521,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); return 0; } @@ -1566,8 +1562,7 @@ static int cpufreq_remove_dev(struct device *dev, struct subsys_interface *sif) return 0; } - cpufreq_policy_put_kobj(policy, true); - cpufreq_policy_free(policy); + cpufreq_policy_free(policy, true); return 0; }