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: 107531 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp1381495qge; Wed, 12 Jul 2017 15:04:27 -0700 (PDT) X-Received: by 10.98.78.88 with SMTP id c85mr58711403pfb.17.1499897067197; Wed, 12 Jul 2017 15:04:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499897067; cv=none; d=google.com; s=arc-20160816; b=kN4B3YmdNITYcyR71VFta48ZpOvlA/XLPpk+LMx2S8bFvlvP+ZOYahDZKoDEKmsmvy 7QjmjZvkDqQ6qO9acsFonQqMQUIN/NUdcAzQloL+XtrSrIBlbZ7YBANf5Chy6QUGJiXT RndNO7xoF4/9oBtPK/DtLcit/MPuOkdJp5zjt2eijotaUZz2qqV+3rRRvwSiYHwjyTMn G7WW+Y+JVwtY+9QB2PXbTAUmv+T5PGs91mZx28gpbYeSVv7QlndH6fnutF0jFisKRbWV iHAXPX4bRM/mudIZXsxW6ywCsLFN25Itx/5Q6KHMjoALp+fNMZJjo11ZCcaTgOigXTKj JOFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=RACloJRdfd6R0cWWdVQe63U7bGOvlUGa96K+sY9jc38=; b=HJAZ7qeUvP3tuXYxU0aSCqpu8s1ChXNXHiw7OMPaftpAX3sptR1ccb8gw0cFSYjQ3m 98fT0g6Y55aTII+sZaYH0zxu8HSK0jsqZ2HyW2VB8Sxw4yvnipowYfqv5Jy1dQS2n4/K zv7VQUoSveZUAnPWPMR/IfmfQEvb9WaK4draXihJepzAo00lx9FBRxSlBhZe/45DfGIM xEIY89yuBUVowamm2c8zce5H2rRSrdDgHsVnb0n8jP7bna1qs/Bv7BUGxR1E+SMN7ums FkD34+nst6DQzNK41SX2eaNpFVm7W4fgUfjBSZ01PFTpjLiv9O1/y17FPSj4KGIh46Gx 73zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=CLKtAq9Y; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w4si2725977pfa.314.2017.07.12.15.04.26; Wed, 12 Jul 2017 15:04:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.b=CLKtAq9Y; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751153AbdGLWEY (ORCPT + 25 others); Wed, 12 Jul 2017 18:04:24 -0400 Received: from mail-pg0-f41.google.com ([74.125.83.41]:34980 "EHLO mail-pg0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752614AbdGLWEU (ORCPT ); Wed, 12 Jul 2017 18:04:20 -0400 Received: by mail-pg0-f41.google.com with SMTP id j186so19292947pge.2 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=NLoqS1yRfxHJ2NIzmzMAd4bQxbPlamnvW10KIgF80HvnOr1Ca2QGn11/1L9PKJYu7K G73ukwzeLyh3luF+pMiYp9L4DyEul3dj1rRUiQw6KSKhL9BAszrS4Ty1bg6GEa6deSpg wD9krz7mD8voINDHUg/XGC3bgDceN2RdLM974oRXA7YaR/qdoWGWElsQ/KwpVASfqxcs 3P/ZPcP/qrbbb/mBKRegSTzQS4NdjhyaGrLAbDin9VZAmUNVQgTZrjlRkbEMQCoaLdqS NDS0O+nQ8Pc3ystc9BzmAWfGwdHIde2s9koDZZckJr2OGRHlOAbB1HRVhZxXTKYhuDLs k6Zg== X-Gm-Message-State: AIVw110igafgEKSZeRF21BxY9rz1eewzTBHL2zu7WZrsxgdkyOshekve Kx6+4u0q+FZtkjS9 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(+) -- 2.12.0 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);