From patchwork Tue Nov 25 10:34:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 41459 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 046A925E18 for ; Tue, 25 Nov 2014 10:36:12 +0000 (UTC) Received: by mail-lb0-f197.google.com with SMTP id n15sf222834lbi.4 for ; Tue, 25 Nov 2014 02:36:11 -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=xHLRtDAzVcT27lezOpon+B47905+WWFVoYLNJYmmbYc=; b=OjtfVkcIdmhtfnOamya1GE22rKhRm6eoNsiRL2A3HQpfPeRCw7MDmk3+H7M+TMBfW9 kEl5MgCONJKgJPx988aGkrLdS06y/Y+8fU2j5wGnOFQ2PAAcfjNmuMTTsIK8gcrqg7Yj P0TQlotYoY+DfyZbyMDcdcJ44GLg69gLyc4aZH+Z5Bp479R511IyRuGL7+Y76cvXF3DN YADrJ0/nwriQkwnR7jPfrRy9aXKwmn8P/5Pe9pdcUJ62mK66bRr7soXvMkkLdz9TBBJD m2p5qDkOWMLhCE3hZREg3iGA0emf6rO3Y+f998HMQq/5Cs8fz9ugc/fr1HNUoL4rVrLk KbVw== X-Gm-Message-State: ALoCoQlGDxr9TaItw5W5zcqruVyva6Hj4vZsIQDXAnyc3lAuuBk/GCdO+XEq69IG1Rjf4m+VIWKk X-Received: by 10.180.19.42 with SMTP id b10mr6907029wie.0.1416911770994; Tue, 25 Nov 2014 02:36:10 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.27.129 with SMTP id t1ls579283lag.53.gmail; Tue, 25 Nov 2014 02:36:10 -0800 (PST) X-Received: by 10.152.36.4 with SMTP id m4mr22045982laj.95.1416911770674; Tue, 25 Nov 2014 02:36:10 -0800 (PST) Received: from mail-la0-f44.google.com (mail-la0-f44.google.com. [209.85.215.44]) by mx.google.com with ESMTPS id aq3si878557lbc.78.2014.11.25.02.36.10 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 25 Nov 2014 02:36:10 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) client-ip=209.85.215.44; Received: by mail-la0-f44.google.com with SMTP id ge10so256447lab.17 for ; Tue, 25 Nov 2014 02:36:10 -0800 (PST) X-Received: by 10.112.52.37 with SMTP id q5mr25000581lbo.32.1416911770577; Tue, 25 Nov 2014 02:36:10 -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.184.201 with SMTP id ew9csp410780lbc; Tue, 25 Nov 2014 02:36:09 -0800 (PST) X-Received: by 10.66.220.34 with SMTP id pt2mr41469115pac.142.1416911768893; Tue, 25 Nov 2014 02:36:08 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id mk8si1367241pdb.23.2014.11.25.02.36.08 for ; Tue, 25 Nov 2014 02:36:08 -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 S1752516AbaKYKgH (ORCPT + 12 others); Tue, 25 Nov 2014 05:36:07 -0500 Received: from mail-pd0-f176.google.com ([209.85.192.176]:39422 "EHLO mail-pd0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752414AbaKYKgG (ORCPT ); Tue, 25 Nov 2014 05:36:06 -0500 Received: by mail-pd0-f176.google.com with SMTP id y10so314620pdj.35 for ; Tue, 25 Nov 2014 02:36:06 -0800 (PST) X-Received: by 10.70.118.1 with SMTP id ki1mr42073343pdb.69.1416911766236; Tue, 25 Nov 2014 02:36:06 -0800 (PST) Received: from localhost ([122.167.111.40]) by mx.google.com with ESMTPSA id dp3sm1109102pdb.46.2014.11.25.02.36.04 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 25 Nov 2014 02:36:05 -0800 (PST) From: Viresh Kumar To: Rafael Wysocki Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, stefan.wahren@i2se.com, nm@ti.com, linux-arm-kernel@lists.infradead.org, sudeep.holla@arm.com, Viresh Kumar Subject: [PATCH 8/8] imx6q: free OPP table created during ->init() Date: Tue, 25 Nov 2014 16:04:23 +0530 Message-Id: <7c9805644464c2aa84e75478ac2854b06317bd21.1416910766.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.0.3.693.g996b0fd 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.44 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: , OPP layer now supports freeing of OPPs and we should free them once they aren't useful anymore. Signed-off-by: Viresh Kumar --- drivers/cpufreq/imx6q-cpufreq.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c index c2d3076..5da1d13 100644 --- a/drivers/cpufreq/imx6q-cpufreq.c +++ b/drivers/cpufreq/imx6q-cpufreq.c @@ -31,6 +31,7 @@ static struct clk *step_clk; static struct clk *pll2_pfd2_396m_clk; static struct device *cpu_dev; +static bool free_opp; static struct cpufreq_frequency_table *freq_table; static unsigned int transition_latency; @@ -207,11 +208,14 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev) goto put_reg; } + /* Because we have added the OPPs here, we must free them */ + free_opp = true; + num = dev_pm_opp_get_opp_count(cpu_dev); if (num < 0) { ret = num; dev_err(cpu_dev, "no OPP table is found: %d\n", ret); - goto put_reg; + goto out_free_opp; } } @@ -306,6 +310,9 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev) free_freq_table: dev_pm_opp_free_cpufreq_table(cpu_dev, &freq_table); +out_free_opp: + if (free_opp) + of_free_opp_table(cpu_dev); put_reg: if (!IS_ERR(arm_reg)) regulator_put(arm_reg); @@ -332,6 +339,8 @@ static int imx6q_cpufreq_remove(struct platform_device *pdev) { cpufreq_unregister_driver(&imx6q_cpufreq_driver); dev_pm_opp_free_cpufreq_table(cpu_dev, &freq_table); + if (free_opp) + of_free_opp_table(cpu_dev); regulator_put(arm_reg); if (!IS_ERR(pu_reg)) regulator_put(pu_reg);