From patchwork Tue Jan 27 08:36:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 43832 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3F4932409D for ; Tue, 27 Jan 2015 08:37:53 +0000 (UTC) Received: by mail-lb0-f197.google.com with SMTP id b6sf6826037lbj.0 for ; Tue, 27 Jan 2015 00:37:52 -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=nyJpgk6fPpgxGDhCKxd6YKJgrwfbmSEZZQjAjQXo4Ko=; b=UpFy+dP5umS8ZPBDRxD7A8xxZkjJmmaMvDxG3Q+OxWavodWwgJmmkcapiOPmbmSe+r EvZynAbpmQMCmnf/rk0Oi6c00vJcuU6UWkC1+iHKRlof9nuKXzQHE/pDZZdAkK1ikImP +QlX9aqF+PrLMgC6DpG1XTuzsWehK4fYELIcKDiQTyA6NX7d1T0sXf31O4CzlgyjbGv/ 07uwAKob7oC6k1qSJp6NK0fImKfVvMthQ15afpGW2KlK9cRP1QYoarlQvjGIZYIVUZrf TafaYiRCHgIH4swcwrbfa8m07TBi20bFbq+4n9X1dvfNQKue8LSP3BhOTadBx+FseLMa bE+A== X-Gm-Message-State: ALoCoQnb1z+BU1dP6S2VusLiVc1nLHW82PRUsruB/xU+FHqwq9MF8fTZLA7s1fpBWd9oxBD2GxiD X-Received: by 10.112.174.36 with SMTP id bp4mr26536lbc.15.1422347872223; Tue, 27 Jan 2015 00:37:52 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.5.35 with SMTP id p3ls4452lap.49.gmail; Tue, 27 Jan 2015 00:37:51 -0800 (PST) X-Received: by 10.112.51.44 with SMTP id h12mr121028lbo.5.1422347871874; Tue, 27 Jan 2015 00:37:51 -0800 (PST) Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com. [209.85.217.181]) by mx.google.com with ESMTPS id kl8si529728lbc.86.2015.01.27.00.37.51 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 27 Jan 2015 00:37:51 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.181 as permitted sender) client-ip=209.85.217.181; Received: by mail-lb0-f181.google.com with SMTP id u10so11839547lbd.12 for ; Tue, 27 Jan 2015 00:37:51 -0800 (PST) X-Received: by 10.112.188.227 with SMTP id gd3mr204785lbc.22.1422347871409; Tue, 27 Jan 2015 00:37:51 -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 h5csp1025644lbj; Tue, 27 Jan 2015 00:37:50 -0800 (PST) X-Received: by 10.68.130.66 with SMTP id oc2mr139413pbb.134.1422347864355; Tue, 27 Jan 2015 00:37:44 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g8si627522pdk.182.2015.01.27.00.37.43; Tue, 27 Jan 2015 00:37:44 -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 S1757926AbbA0Ihm (ORCPT + 11 others); Tue, 27 Jan 2015 03:37:42 -0500 Received: from mail-pd0-f175.google.com ([209.85.192.175]:54017 "EHLO mail-pd0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757922AbbA0Ihl (ORCPT ); Tue, 27 Jan 2015 03:37:41 -0500 Received: by mail-pd0-f175.google.com with SMTP id fl12so17606074pdb.6 for ; Tue, 27 Jan 2015 00:37:41 -0800 (PST) X-Received: by 10.70.42.208 with SMTP id q16mr260321pdl.56.1422347860963; Tue, 27 Jan 2015 00:37:40 -0800 (PST) Received: from localhost ([122.178.198.250]) by mx.google.com with ESMTPSA id ci17sm796817pdb.70.2015.01.27.00.37.39 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 27 Jan 2015 00:37:40 -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 16/18] cpufreq: Call cpufreq_policy_put_kobj() from cpufreq_policy_free() Date: Tue, 27 Jan 2015 14:06:22 +0530 Message-Id: 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.181 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: , Both cpufreq_policy_put_kobj() and cpufreq_policy_free() are always called together, cpufreq_policy_put_kobj() followed by cpufreq_policy_free(). cpufreq_policy_put_kobj() is actually part of freeing policy and so can be called from cpufreq_policy_free(). 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 4a97d7428d25..0e03ae1bc96a 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1140,8 +1140,9 @@ 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) { + cpufreq_policy_put_kobj(policy, notify); free_cpumask_var(policy->related_cpus); free_cpumask_var(policy->cpus); kfree(policy); @@ -1312,9 +1313,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); @@ -1445,10 +1444,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 @@ -1462,8 +1457,9 @@ static int __cpufreq_remove_dev_finish(struct device *dev, list_del(&policy->policy_list); write_unlock_irqrestore(&cpufreq_driver_lock, flags); + /* 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;