From patchwork Thu Dec 7 13:56:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory CLEMENT X-Patchwork-Id: 10099161 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D7B5F602BF for ; Thu, 7 Dec 2017 13:57:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C9A662A1EC for ; Thu, 7 Dec 2017 13:57:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BE1E02A35D; Thu, 7 Dec 2017 13:57:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 74E992A1EC for ; Thu, 7 Dec 2017 13:57:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754584AbdLGN5N (ORCPT ); Thu, 7 Dec 2017 08:57:13 -0500 Received: from mail.free-electrons.com ([62.4.15.54]:33729 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754311AbdLGN5G (ORCPT ); Thu, 7 Dec 2017 08:57:06 -0500 Received: by mail.free-electrons.com (Postfix, from userid 110) id 1FA6B20C3C; Thu, 7 Dec 2017 14:57:05 +0100 (CET) Received: from localhost (unknown [84.199.255.188]) by mail.free-electrons.com (Postfix) with ESMTPSA id E51F7206E0; Thu, 7 Dec 2017 14:57:04 +0100 (CET) From: Gregory CLEMENT To: "Rafael J. Wysocki" , Viresh Kumar , linux-pm@vger.kernel.org Cc: Jason Cooper , Andrew Lunn , Sebastian Hesselbarth , Gregory CLEMENT , Rob Herring , devicetree@vger.kernel.org, Thomas Petazzoni , linux-arm-kernel@lists.infradead.org, Antoine Tenart , =?UTF-8?q?Miqu=C3=A8l=20Raynal?= , Nadav Haklai , Victor Gu , Marcin Wojtas , Wilson Ding , Hua Jing , Neta Zur Hershkovits , Evan Wang , Andre Heider Subject: [PATCH v2 4/7] cpufreq: mvebu: Use dev_pm_opp_remove() Date: Thu, 7 Dec 2017 14:56:13 +0100 Message-Id: <20171207135616.23670-5-gregory.clement@free-electrons.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171207135616.23670-1-gregory.clement@free-electrons.com> References: <20171207135616.23670-1-gregory.clement@free-electrons.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Since the introduction of this driver, the dev_pm_opp_remove() was added. So stop claiming we can't remove opp and use it in case of failure. Signed-off-by: Gregory CLEMENT Acked-by: Viresh Kumar --- drivers/cpufreq/mvebu-cpufreq.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/cpufreq/mvebu-cpufreq.c b/drivers/cpufreq/mvebu-cpufreq.c index ed915ee85dd9..419c2b01a44c 100644 --- a/drivers/cpufreq/mvebu-cpufreq.c +++ b/drivers/cpufreq/mvebu-cpufreq.c @@ -76,12 +76,6 @@ static int __init armada_xp_pmsu_cpufreq_init(void) return PTR_ERR(clk); } - /* - * In case of a failure of dev_pm_opp_add(), we don't - * bother with cleaning up the registered OPP (there's - * no function to do so), and simply cancel the - * registration of the cpufreq device. - */ ret = dev_pm_opp_add(cpu_dev, clk_get_rate(clk), 0); if (ret) { clk_put(clk); @@ -90,6 +84,11 @@ static int __init armada_xp_pmsu_cpufreq_init(void) ret = dev_pm_opp_add(cpu_dev, clk_get_rate(clk) / 2, 0); if (ret) { + /* + * The second opp failed to be added, remove + * the first one before exiting. + */ + dev_pm_opp_remove(cpu_dev, clk_get_rate(clk)); clk_put(clk); return ret; }