From patchwork Thu Apr 30 22:05:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 6307501 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4E814BEEE1 for ; Thu, 30 Apr 2015 22:09:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6F6BC201BB for ; Thu, 30 Apr 2015 22:09:11 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8F7E720165 for ; Thu, 30 Apr 2015 22:09:10 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Ynwb4-0005Yt-Ib; Thu, 30 Apr 2015 22:06:18 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Ynwaw-0005Te-VO for linux-arm-kernel@lists.infradead.org; Thu, 30 Apr 2015 22:06:11 +0000 Received: from smtp.codeaurora.org (localhost [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id B6828140CA9; Thu, 30 Apr 2015 22:05:49 +0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 486) id A3307140CB0; Thu, 30 Apr 2015 22:05:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from localhost (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: sboyd@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id F2222140CA9; Thu, 30 Apr 2015 22:05:48 +0000 (UTC) Date: Thu, 30 Apr 2015 15:05:48 -0700 From: Stephen Boyd To: Dong Aisheng , linux-clk@vger.kernel.org Subject: Re: [PATCH RFC v1 3/5] clk: remove unneeded __clk_enable and __clk_disable Message-ID: <20150430220548.GA31047@codeaurora.org> References: <1429107999-24413-1-git-send-email-aisheng.dong@freescale.com> <1429107999-24413-4-git-send-email-aisheng.dong@freescale.com> <55427DDE.4090907@codeaurora.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <55427DDE.4090907@codeaurora.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Virus-Scanned: ClamAV using ClamSMTP X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150430_150611_052555_825CEA5E X-CRM114-Status: GOOD ( 18.74 ) X-Spam-Score: -0.0 (/) Cc: Ranjani.Vaidyanathan@freescale.com, b20596@freescale.com, mturquette@linaro.org, linux-kernel@vger.kernel.org, r64343@freescale.com, b20788@freescale.com, shawn.guo@linaro.org, b29396@freescale.com, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 On 04/30, Stephen Boyd wrote: > On 04/15/15 07:26, Dong Aisheng wrote: > > The only thing __clk_enable/__clk_disable does is NULL pointer checking > > of clk except calling clk_core_{enable|disable} which is already handled > > by clk_core_{enable|disable}. > > So remove this unneeded function. > > > > Cc: Mike Turquette > > Cc: Stephen Boyd > > Signed-off-by: Dong Aisheng > > --- > > No. You can call clk_enable() and clk_disable() with NULL and it should > be a no-op. With this change it would cause a NULL pointer exception. > Here's the proper patch. I'll leave you as author. ---8<--- diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 0227ac3d5b1a..e45255226ffa 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -1023,14 +1023,6 @@ static void clk_core_disable(struct clk_core *core) clk_core_disable(core->parent); } -static void __clk_disable(struct clk *clk) -{ - if (!clk) - return; - - clk_core_disable(clk->core); -} - /** * clk_disable - gate a clock * @clk: the clk being gated @@ -1051,7 +1043,7 @@ void clk_disable(struct clk *clk) return; flags = clk_enable_lock(); - __clk_disable(clk); + clk_core_disable(clk->core); clk_enable_unlock(flags); } EXPORT_SYMBOL_GPL(clk_disable); @@ -1089,14 +1081,6 @@ static int clk_core_enable(struct clk_core *core) return 0; } -static int __clk_enable(struct clk *clk) -{ - if (!clk) - return 0; - - return clk_core_enable(clk->core); -} - /** * clk_enable - ungate a clock * @clk: the clk being ungated @@ -1115,8 +1099,11 @@ int clk_enable(struct clk *clk) unsigned long flags; int ret; + if (!clk) + return 0; + flags = clk_enable_lock(); - ret = __clk_enable(clk); + ret = clk_core_enable(clk->core); clk_enable_unlock(flags); return ret;