From patchwork Mon May 18 05:13:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 48680 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id ABC5421411 for ; Mon, 18 May 2015 05:16:40 +0000 (UTC) Received: by wgyu3 with SMTP id u3sf26409252wgy.3 for ; Sun, 17 May 2015 22:16:39 -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=KSIgyDdbjDSivZptniu3M79pCbZIK+fK/db8PkXQRFY=; b=MtQWqxRPguzkZk21ckYcJxZ9Xwc5jlT/83ELpkSsT2YsDjXpIbVsgSBA6OgbYZrIkF 45k/mbKPCITs/CJsCoPAffsNL9pYj/2fHlylDRQBwblXLWJg+8ggK9tBI2SFvgE9cucF reuxh4rMdOpx3FSn7dEFcv1J9S/qaF2De3Ohzyxj7oiOX4Uhux98hJUzhDYtn0p0soot x1yczVTN/mLru1SgHeFYlFTWGduKmFeZyKqlsVE3rh08KfG/x16KcAo52hiUYg1GLy/k Uqhk6YObHLza6Voj6jfrJpJhlZdIagzO2AlMKeDVgPekgBcch+Spe/VZNDJQvJX5572j BjXA== X-Gm-Message-State: ALoCoQnXfOKSSyVAPy8H03oFlWjF/rvuct46rmcedwJZVtXdQkrEc5xqgUSqfiymTyrVp54Bzb9n X-Received: by 10.180.106.10 with SMTP id gq10mr8638999wib.0.1431926199794; Sun, 17 May 2015 22:16:39 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.6.73 with SMTP id y9ls722016lay.1.gmail; Sun, 17 May 2015 22:16:39 -0700 (PDT) X-Received: by 10.112.211.134 with SMTP id nc6mr15992480lbc.52.1431926199641; Sun, 17 May 2015 22:16:39 -0700 (PDT) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com. [209.85.215.43]) by mx.google.com with ESMTPS id lb7si5954403lac.89.2015.05.17.22.16.39 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 17 May 2015 22:16:39 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43; Received: by laat2 with SMTP id t2so201854139laa.1 for ; Sun, 17 May 2015 22:16:39 -0700 (PDT) X-Received: by 10.152.7.7 with SMTP id f7mr6750859laa.106.1431926199513; Sun, 17 May 2015 22:16:39 -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 hn6csp3712392lbb; Sun, 17 May 2015 22:16:37 -0700 (PDT) X-Received: by 10.66.119.174 with SMTP id kv14mr40419801pab.5.1431926196575; Sun, 17 May 2015 22:16:36 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id iu9si2678127pbc.77.2015.05.17.22.16.06; Sun, 17 May 2015 22:16:36 -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 S1751857AbbERFOk (ORCPT + 11 others); Mon, 18 May 2015 01:14:40 -0400 Received: from mail-pa0-f43.google.com ([209.85.220.43]:34584 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751183AbbERFOk (ORCPT ); Mon, 18 May 2015 01:14:40 -0400 Received: by pabru16 with SMTP id ru16so136140004pab.1 for ; Sun, 17 May 2015 22:14:40 -0700 (PDT) X-Received: by 10.66.232.134 with SMTP id to6mr40050063pac.96.1431926080109; Sun, 17 May 2015 22:14:40 -0700 (PDT) Received: from localhost ([122.167.226.34]) by mx.google.com with ESMTPSA id dp4sm8577398pbb.82.2015.05.17.22.14.38 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 17 May 2015 22:14:39 -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 V5 13/14] cpufreq: Call cpufreq_policy_put_kobj() from cpufreq_policy_free() Date: Mon, 18 May 2015 10:43:36 +0530 Message-Id: <9203cdc11b5d3bb62c6a01d12f75cf92bc6a0f00.1431924457.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.215.43 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 1137e7942278..b030432cbfad 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1189,7 +1189,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; @@ -1202,6 +1202,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); @@ -1387,9 +1388,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); @@ -1484,10 +1483,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 @@ -1496,8 +1491,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; } @@ -1534,8 +1530,7 @@ static int cpufreq_remove_dev(struct device *dev, struct subsys_interface *sif) if (cpumask_intersects(&mask, cpu_present_mask)) return add_remove_cpu_dev_symlink(policy, cpu, false); - cpufreq_policy_put_kobj(policy, true); - cpufreq_policy_free(policy); + cpufreq_policy_free(policy, true); return 0; }