From patchwork Fri May 8 06:23:55 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 48156 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 F2EC02121F for ; Fri, 8 May 2015 06:25:23 +0000 (UTC) Received: by wicmx19 with SMTP id mx19sf4244885wic.3 for ; Thu, 07 May 2015 23:25:23 -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=kN48z+dggg2Ek/PEu33+nHUoOuiiAz+ZP+w7mz2LriY=; b=OehxokOYs9+ndzvunCFu8/e4HG4RflIQFb2HBxPtEzLEvCpwLC3cEKgskOuBcBWEqN ObmryZLfzeB7I9Rm6s33b/YyEB9TBGo4a8YETP9lVh93PLue4RE2Y87/yM6YcO3cE+n6 kA6N/mE4uTn9B66riB32P6v39azCVchEMzuzaSLG3kXg7UH6FcNT23c/LocIIhosn23R nV5RVcLk7K/XZzsO6jIxCvQY9mlYfg76f5sMLDba7Tvg8XLeDmGKbYT+MAiAU0jtbsfu b3nvRd4vyUjxFFRqjCNN+2OxDV9iDFiad/q3E9avGJJKpoyVYiV22vqFAxdmidIYsvpx 4DPA== X-Gm-Message-State: ALoCoQlqoZseJbIz8W/UEmzyac0Adt85P8h8FNQaHXyEZXf2/uoD7IsGu5r2TvZNIfIN0KwHpylT X-Received: by 10.152.43.116 with SMTP id v20mr1225911lal.3.1431066323289; Thu, 07 May 2015 23:25:23 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.229.129 with SMTP id sq1ls320801lac.4.gmail; Thu, 07 May 2015 23:25:23 -0700 (PDT) X-Received: by 10.152.8.231 with SMTP id u7mr1630402laa.37.1431066323152; Thu, 07 May 2015 23:25:23 -0700 (PDT) Received: from mail-la0-f46.google.com (mail-la0-f46.google.com. [209.85.215.46]) by mx.google.com with ESMTPS id ps10si2690428lbb.26.2015.05.07.23.25.22 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 May 2015 23:25:22 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) client-ip=209.85.215.46; Received: by laat2 with SMTP id t2so45993106laa.1 for ; Thu, 07 May 2015 23:25:22 -0700 (PDT) X-Received: by 10.152.27.98 with SMTP id s2mr1697632lag.106.1431066322724; Thu, 07 May 2015 23:25:22 -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 hn6csp269392lbb; Thu, 7 May 2015 23:25:21 -0700 (PDT) X-Received: by 10.70.25.37 with SMTP id z5mr4050388pdf.36.1431066320994; Thu, 07 May 2015 23:25:20 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t17si5783046pdi.227.2015.05.07.23.25.20; Thu, 07 May 2015 23:25:20 -0700 (PDT) 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 S1751418AbbEHGZT (ORCPT + 11 others); Fri, 8 May 2015 02:25:19 -0400 Received: from mail-pd0-f178.google.com ([209.85.192.178]:33732 "EHLO mail-pd0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751474AbbEHGZS (ORCPT ); Fri, 8 May 2015 02:25:18 -0400 Received: by pdbnk13 with SMTP id nk13so66966989pdb.0 for ; Thu, 07 May 2015 23:25:18 -0700 (PDT) X-Received: by 10.66.161.102 with SMTP id xr6mr4091781pab.8.1431066300140; Thu, 07 May 2015 23:25:00 -0700 (PDT) Received: from localhost ([122.172.243.237]) by mx.google.com with ESMTPSA id mb4sm3988493pdb.63.2015.05.07.23.24.58 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 07 May 2015 23:24:59 -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 V3 12/14] cpufreq: Call cpufreq_policy_put_kobj() from cpufreq_policy_free() Date: Fri, 8 May 2015 11:53:55 +0530 Message-Id: <43a0644d3ac3b03bebf59d2c46f25543ce0e03f2.1431065963.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.46 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 e7f16c4bd041..6f08b70de21f 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1198,7 +1198,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; @@ -1211,6 +1211,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); @@ -1384,9 +1385,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); @@ -1481,10 +1480,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 @@ -1493,8 +1488,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; }