From patchwork Fri Nov 11 10:50:24 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Zhao X-Patchwork-Id: 5069 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 66AB923E0F for ; Fri, 11 Nov 2011 10:51:29 +0000 (UTC) Received: from mail-fx0-f52.google.com (mail-fx0-f52.google.com [209.85.161.52]) by fiordland.canonical.com (Postfix) with ESMTP id 408C6A183E7 for ; Fri, 11 Nov 2011 10:51:29 +0000 (UTC) Received: by mail-fx0-f52.google.com with SMTP id n26so5533536faa.11 for ; Fri, 11 Nov 2011 02:51:29 -0800 (PST) Received: by 10.152.104.1 with SMTP id ga1mr6373342lab.40.1321008689047; Fri, 11 Nov 2011 02:51:29 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.152.40.7 with SMTP id t7cs43144lak; Fri, 11 Nov 2011 02:51:28 -0800 (PST) Received: by 10.229.3.141 with SMTP id 13mr1670830qcn.147.1321008672919; Fri, 11 Nov 2011 02:51:12 -0800 (PST) Received: from TX2EHSOBE003.bigfish.com (tx2ehsobe002.messaging.microsoft.com. [65.55.88.12]) by mx.google.com with ESMTPS id o24si10223605yhm.11.2011.11.11.02.51.12 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 11 Nov 2011 02:51:12 -0800 (PST) Received-SPF: neutral (google.com: 65.55.88.12 is neither permitted nor denied by best guess record for domain of richard.zhao@linaro.org) client-ip=65.55.88.12; Authentication-Results: mx.google.com; spf=neutral (google.com: 65.55.88.12 is neither permitted nor denied by best guess record for domain of richard.zhao@linaro.org) smtp.mail=richard.zhao@linaro.org Received: from mail62-tx2-R.bigfish.com (10.9.14.251) by TX2EHSOBE003.bigfish.com (10.9.40.23) with Microsoft SMTP Server id 14.1.225.22; Fri, 11 Nov 2011 10:50:46 +0000 Received: from mail62-tx2 (localhost.localdomain [127.0.0.1]) by mail62-tx2-R.bigfish.com (Postfix) with ESMTP id 6C67E1558421; Fri, 11 Nov 2011 10:51:00 +0000 (UTC) X-SpamScore: 0 X-BigFish: VS0(zzzz1202hzz8275dhz2dh87h2a8h668h839h61h) X-Spam-TCS-SCL: 0:0 X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPVD:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-FB-SS: 0, X-FB-DOMAIN-IP-MATCH: fail Received: from mail62-tx2 (localhost.localdomain [127.0.0.1]) by mail62-tx2 (MessageSwitch) id 1321008637912878_11039; Fri, 11 Nov 2011 10:50:37 +0000 (UTC) Received: from TX2EHSMHS033.bigfish.com (unknown [10.9.14.246]) by mail62-tx2.bigfish.com (Postfix) with ESMTP id D764F15E004C; Fri, 11 Nov 2011 10:50:37 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by TX2EHSMHS033.bigfish.com (10.9.99.133) with Microsoft SMTP Server (TLS) id 14.1.225.22; Fri, 11 Nov 2011 10:50:48 +0000 Received: from az33smr01.freescale.net (10.64.34.199) by 039-SN1MMR1-003.039d.mgd.msft.net (10.84.1.16) with Microsoft SMTP Server id 14.1.339.2; Fri, 11 Nov 2011 04:50:48 -0600 Received: from b20223-02.ap.freescale.net (b20223-02-010192242124.ap.freescale.net [10.192.242.124]) by az33smr01.freescale.net (8.13.1/8.13.0) with ESMTP id pABAoecL000610; Fri, 11 Nov 2011 04:50:45 -0600 (CST) From: Richard Zhao To: , , , , CC: , , , , , , , Richard Zhao Subject: [PATCH V3 01/14] clk: add helper functions clk_prepare_enable and clk_disable_unprepare Date: Fri, 11 Nov 2011 18:50:24 +0800 Message-ID: <1321008637-19999-2-git-send-email-richard.zhao@linaro.org> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1321008637-19999-1-git-send-email-richard.zhao@linaro.org> References: <1321008637-19999-1-git-send-email-richard.zhao@linaro.org> MIME-Version: 1.0 X-OriginatorOrg: sigmatel.com Signed-off-by: Richard Zhao --- include/linux/clk.h | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+), 0 deletions(-) diff --git a/include/linux/clk.h b/include/linux/clk.h index 7213b52..a7dc00d 100644 --- a/include/linux/clk.h +++ b/include/linux/clk.h @@ -107,6 +107,26 @@ static inline void clk_unprepare(struct clk *clk) } #endif +static inline int clk_prepare_enable(struct clk *clk) +{ + int ret; + + ret = clk_prepare(clk); + if (ret) + return ret; + ret = clk_enable(clk); + if (ret) + clk_unprepare(clk); + + return ret; +} + +static inline void clk_disable_unprepare(struct clk *clk) +{ + clk_disable(clk); + clk_unprepare(clk); +} + /** * clk_get_rate - obtain the current clock rate (in Hz) for a clock source. * This is only valid once the clock source has been enabled.