From patchwork Sun Aug 26 16:01:03 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 1375601 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id B1B10DFABE for ; Sun, 26 Aug 2012 16:05:10 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1T5fHU-0004Qs-Bg; Sun, 26 Aug 2012 16:01:44 +0000 Received: from mail4-relais-sop.national.inria.fr ([192.134.164.105]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1T5fH8-0004Ny-3V for linux-arm-kernel@lists.infradead.org; Sun, 26 Aug 2012 16:01:23 +0000 X-IronPort-AV: E=Sophos;i="4.80,315,1344204000"; d="scan'208";a="153852299" Received: from palace.lip6.fr (HELO localhost.localdomain) ([132.227.105.202]) by mail4-relais-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 26 Aug 2012 18:01:13 +0200 From: Julia Lawall To: Andrew Victor Subject: [PATCH 11/13] arch/arm/mach-at91/gpio.c: use clk_prepare_enable and clk_disable_unprepare Date: Sun, 26 Aug 2012 18:01:03 +0200 Message-Id: <1345996865-32082-12-git-send-email-Julia.Lawall@lip6.fr> X-Mailer: git-send-email 1.7.8.6 In-Reply-To: <1345996865-32082-1-git-send-email-Julia.Lawall@lip6.fr> References: <1345996865-32082-1-git-send-email-Julia.Lawall@lip6.fr> X-Spam-Note: CRM114 invocation failed X-Spam-Score: -6.1 (------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-6.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [192.134.164.105 listed in list.dnswl.org] 0.8 SPF_NEUTRAL SPF: sender does not match SPF record (neutral) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Russell King , kernel-janitors@vger.kernel.org, Nicolas Ferre , linux-kernel@vger.kernel.org, Jean-Christophe Plagniol-Villard , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Julia Lawall Clk_prepare_enable and clk_disable_unprepare combine clk_prepare and clk_enable, and clk_disable and clk_unprepare. They make the code more concise, and ensure that clk_unprepare is called when clk_enable fails. A simplified version of the semantic patch that introduces calls to these functions is as follows: (http://coccinelle.lip6.fr/) // @@ expression e; @@ - clk_prepare(e); - clk_enable(e); + clk_prepare_enable(e); @@ expression e; @@ - clk_disable(e); - clk_unprepare(e); + clk_disable_unprepare(e); // Signed-off-by: Julia Lawall --- arch/arm/mach-at91/gpio.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/arch/arm/mach-at91/gpio.c b/arch/arm/mach-at91/gpio.c index be42cf0..7760f35 100644 --- a/arch/arm/mach-at91/gpio.c +++ b/arch/arm/mach-at91/gpio.c @@ -956,19 +956,14 @@ static int __init at91_gpio_setup_clk(int idx) goto err; } - if (clk_prepare(at91_gpio->clock)) - goto clk_prep_err; - /* enable PIO controller's clock */ - if (clk_enable(at91_gpio->clock)) { + if (clk_prepare_enable(at91_gpio->clock)) { pr_err("at91_gpio.%d, failed to enable clock, ignoring.\n", idx); - goto clk_err; + goto clk_prep_err; } return 0; -clk_err: - clk_unprepare(at91_gpio->clock); clk_prep_err: clk_put(at91_gpio->clock); err: