From patchwork Wed Jul 12 22:04:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 9837463 X-Patchwork-Delegate: sboyd@codeaurora.org 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 0C8B4602A0 for ; Wed, 12 Jul 2017 22:04:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 002C0286A1 for ; Wed, 12 Jul 2017 22:04:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E7AE7286B7; Wed, 12 Jul 2017 22:04:24 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5134D286A1 for ; Wed, 12 Jul 2017 22:04:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750722AbdGLWEX (ORCPT ); Wed, 12 Jul 2017 18:04:23 -0400 Received: from mail-pg0-f53.google.com ([74.125.83.53]:33279 "EHLO mail-pg0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752021AbdGLWEU (ORCPT ); Wed, 12 Jul 2017 18:04:20 -0400 Received: by mail-pg0-f53.google.com with SMTP id k14so19419046pgr.0 for ; Wed, 12 Jul 2017 15:04:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=RACloJRdfd6R0cWWdVQe63U7bGOvlUGa96K+sY9jc38=; b=CLKtAq9YlQI8V4Ba6u21W3K/JbjVeiLWXv297rKU0Oi2akcQ1+QyT1aYSxR+pwMqu8 9wWk18KltF67Ju9rDHcQmnlRjTXPeacmEHRMAAFSWRWalesvhlGanDV22BHelqHfNJ1Z uEsvhq+/+X3K8MjlfC8LXGY7dFKGMEQWA7ypc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=RACloJRdfd6R0cWWdVQe63U7bGOvlUGa96K+sY9jc38=; b=gsUOiRbpQUWB0g1RedLmhB8QLTN+CybN6b4X3fh8ixsf9WGvVg50FianN2O0pW0q3K 8r4mufSu5JbHTXb1jdHDtYyj8o7ws/AYdK4FayQ387kr2Ofv9BVHYQ1DoHbxhHyG58qs CM+VvsyLSJtC+lZiS5zNSZ7DFEEhYZzUY3ksQ0aGYsF3PVZJ59ncdoergvV9mAMg22xG +msu8JN4bP1Nn1kkqfv6jFAhORXu0lmsWZHij1H0KH0QI5oZW3prf2Ho87cMFYXEuN/I vIV28ppYg5+GQR4M8tcwJzQ8rq6aMdFJfZrwcS2DG3usY0qI9qnNjDxd2y6k582vAsmy VL3g== X-Gm-Message-State: AIVw113IqpBofKpR222ogtzPH/hyWbAudyRWBH83IzgIxV6y/gznMBhq pKQel1Zb+zv9N7E7tRmJyA== X-Received: by 10.84.231.193 with SMTP id g1mr6514010pln.264.1499897059903; Wed, 12 Jul 2017 15:04:19 -0700 (PDT) Received: from localhost.localdomain (ip68-111-217-79.sd.sd.cox.net. [68.111.217.79]) by smtp.gmail.com with ESMTPSA id o13sm6620486pgr.40.2017.07.12.15.04.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Jul 2017 15:04:19 -0700 (PDT) From: Bjorn Andersson To: Stephen Boyd , Russell King , Michael Turquette Cc: Dong Aisheng , linux-clk@vger.kernel.org (open list:CLK API), linux-kernel@vger.kernel.org (open list) Subject: [PATCH] clk: Provide bulk prepare_enable disable_unprepare variants Date: Wed, 12 Jul 2017 15:04:16 -0700 Message-Id: <20170712220416.31785-1-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.12.0 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This extends the existing set of bulk helpers with prepare_enable and disable_unprepare variants. Signed-off-by: Bjorn Andersson --- include/linux/clk.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/include/linux/clk.h b/include/linux/clk.h index 91bd464f4c9b..12c96d94d1fa 100644 --- a/include/linux/clk.h +++ b/include/linux/clk.h @@ -657,6 +657,28 @@ static inline void clk_disable_unprepare(struct clk *clk) clk_unprepare(clk); } +static inline int clk_bulk_prepare_enable(int num_clks, + struct clk_bulk_data *clks) +{ + int ret; + + ret = clk_bulk_prepare(num_clks, clks); + if (ret) + return ret; + ret = clk_bulk_enable(num_clks, clks); + if (ret) + clk_bulk_unprepare(num_clks, clks); + + return ret; +} + +static inline void clk_bulk_disable_unprepare(int num_clks, + struct clk_bulk_data *clks) +{ + clk_bulk_disable(num_clks, clks); + clk_bulk_unprepare(num_clks, clks); +} + #if defined(CONFIG_OF) && defined(CONFIG_COMMON_CLK) struct clk *of_clk_get(struct device_node *np, int index); struct clk *of_clk_get_by_name(struct device_node *np, const char *name);