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: 10099177 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 54624602BF for ; Thu, 7 Dec 2017 13:58:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 436352A359 for ; Thu, 7 Dec 2017 13:58:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 361B22A3D6; Thu, 7 Dec 2017 13:58:33 +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=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C570A2A359 for ; Thu, 7 Dec 2017 13:58:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=97cX1D7GDg78fzo/O/QKjj/80qaFGFV1BoLDKUj2Si8=; b=TJqbc1f+1cSvH/PuD6sNTSyDFC iDcVfFi4pOJKEqIWuyx+SG4P7HTQmVjAI9JmloRnGTGuLQmfE6hKCcWqcDSaw0AE9SiHcQ5eIoX5B TsYljtrvo1S4WKg5zC/trfEN/tv6KI6LdEuCMpaXVnJd7809z3QzMPFcWq4bDVVgkC1hJu4whPWmn 55N+1k39D/ztjV5BFAiJep6IT/Yc1Btjc/rbPW8Ro3fikUu46aHcqUKZw9J62MedX1qMFhVpDXqG/ HdPpEgEdJexhORVzXTxcfjJKqsjdBwWSm0MG+2PySuD/07F2pgIrT/AGcjDIRlSpaTsroGJDOpm7W BQoLC8Iw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eMwh5-0005Tw-Vp; Thu, 07 Dec 2017 13:58:32 +0000 Received: from mail.free-electrons.com ([62.4.15.54]) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eMwg2-00043g-Qw for linux-arm-kernel@lists.infradead.org; Thu, 07 Dec 2017 13:57:31 +0000 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171207_055727_054100_9714580F X-CRM114-Status: GOOD ( 11.90 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Petazzoni , Andrew Lunn , Hua Jing , Jason Cooper , devicetree@vger.kernel.org, Antoine Tenart , Andre Heider , Evan Wang , Nadav Haklai , Rob Herring , Neta Zur Hershkovits , =?UTF-8?q?Miqu=C3=A8l=20Raynal?= , Gregory CLEMENT , Victor Gu , Marcin Wojtas , Wilson Ding , linux-arm-kernel@lists.infradead.org, Sebastian Hesselbarth MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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; }