From patchwork Tue Dec 3 10:49:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 21954 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f72.google.com (mail-oa0-f72.google.com [209.85.219.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 97812202DA for ; Tue, 3 Dec 2013 10:49:31 +0000 (UTC) Received: by mail-oa0-f72.google.com with SMTP id o6sf47052971oag.7 for ; Tue, 03 Dec 2013 02:49:31 -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:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=dPW3nacrP1z94I78cnqIN5Z274xPNR13fp2eCKceiMs=; b=mxz7VfuubJaaGHnyX5eKlk275eI0v3/vmQnWSvK3D+3OJRZAs0a3byxB0XtnwXtDxi U4TeJhaXu2mCx1tf9fJZWjLIb1rfv6tq+3+1cEGH0f/Zr0g290eueov2aNeM9bxtihMC 2civFt95RiMCyOIiZ9gJ2pUT9D1wppD+hl0jlFhAGoPrsmr1nx7YnAiGjmiLmZ6jU8p6 qDWZKdf/LpHU+0uVL5rWCtV+pjaGPg+HBvriZRi/+DxC5YEttmjJoFGJJkB+FAUwQeqm OK6dlBUsZeX0HUsxtZjsJ9mQdIXDrUfzvB0aeBBfTDfez4NXqadvQeTQGh51JCLSonmQ WoGA== X-Gm-Message-State: ALoCoQl4BtWaQwI6EIo0kY6WL3epyKLl2cZcWfhWEgoLApmCCq2z+ABOZ9RfucK1fTs2si+irhBR X-Received: by 10.42.66.147 with SMTP id p19mr20408353ici.12.1386067770986; Tue, 03 Dec 2013 02:49:30 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.24.145 with SMTP id u17ls1298793qef.42.gmail; Tue, 03 Dec 2013 02:49:30 -0800 (PST) X-Received: by 10.220.101.199 with SMTP id d7mr1118149vco.42.1386067770865; Tue, 03 Dec 2013 02:49:30 -0800 (PST) Received: from mail-ve0-f170.google.com (mail-ve0-f170.google.com [209.85.128.170]) by mx.google.com with ESMTPS id k10si31126425vca.124.2013.12.03.02.49.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 03 Dec 2013 02:49:30 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.170; Received: by mail-ve0-f170.google.com with SMTP id oy12so10082481veb.15 for ; Tue, 03 Dec 2013 02:49:30 -0800 (PST) X-Received: by 10.220.74.69 with SMTP id t5mr40736027vcj.18.1386067770637; Tue, 03 Dec 2013 02:49:30 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp197284vcz; Tue, 3 Dec 2013 02:49:30 -0800 (PST) X-Received: by 10.112.151.42 with SMTP id un10mr658771lbb.7.1386067769583; Tue, 03 Dec 2013 02:49:29 -0800 (PST) Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com [209.85.217.173]) by mx.google.com with ESMTPS id m1si624941lbs.114.2013.12.03.02.49.29 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 03 Dec 2013 02:49:29 -0800 (PST) Received-SPF: neutral (google.com: 209.85.217.173 is neither permitted nor denied by best guess record for domain of ulf.hansson@linaro.org) client-ip=209.85.217.173; Received: by mail-lb0-f173.google.com with SMTP id u14so8951946lbd.32 for ; Tue, 03 Dec 2013 02:49:29 -0800 (PST) X-Received: by 10.112.201.197 with SMTP id kc5mr36068lbc.64.1386067768954; Tue, 03 Dec 2013 02:49:28 -0800 (PST) Received: from linaro-ulf.lan (90-231-160-185-no158.tbcn.telia.com. [90.231.160.185]) by mx.google.com with ESMTPSA id t9sm60735763lat.1.2013.12.03.02.49.27 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 03 Dec 2013 02:49:28 -0800 (PST) From: Ulf Hansson To: Russell King , linux-arm-kernel@lists.infradead.org Cc: Ulf Hansson Subject: [PATCH V2 5/6] amba: Convert to clk_prepare_enable and clk_disable_unprepare Date: Tue, 3 Dec 2013 11:49:24 +0100 Message-Id: <1386067764-25138-1-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ulf.hansson@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , To simplify code and error handling let's use clk_prepare_enable and clk_disable_unprepare. No functional change. Signed-off-by: Ulf Hansson --- drivers/amba/bus.c | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c index b90dc1e..ea1d835 100644 --- a/drivers/amba/bus.c +++ b/drivers/amba/bus.c @@ -151,36 +151,23 @@ postcore_initcall(amba_init); static int amba_get_enable_pclk(struct amba_device *pcdev) { - struct clk *pclk = clk_get(&pcdev->dev, "apb_pclk"); int ret; - pcdev->pclk = pclk; + pcdev->pclk = clk_get(&pcdev->dev, "apb_pclk"); + if (IS_ERR(pcdev->pclk)) + return PTR_ERR(pcdev->pclk); - if (IS_ERR(pclk)) - return PTR_ERR(pclk); - - ret = clk_prepare(pclk); - if (ret) { - clk_put(pclk); - return ret; - } - - ret = clk_enable(pclk); - if (ret) { - clk_unprepare(pclk); - clk_put(pclk); - } + ret = clk_prepare_enable(pcdev->pclk); + if (ret) + clk_put(pcdev->pclk); return ret; } static void amba_put_disable_pclk(struct amba_device *pcdev) { - struct clk *pclk = pcdev->pclk; - - clk_disable(pclk); - clk_unprepare(pclk); - clk_put(pclk); + clk_disable_unprepare(pcdev->pclk); + clk_put(pcdev->pclk); } /*