From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753667AbdDMOCi (ORCPT ); Thu, 13 Apr 2017 10:02:38 -0400 Received: from mail-pg0-f65.google.com ([74.125.83.65]:33792 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750745AbdDMOCg (ORCPT ); Thu, 13 Apr 2017 10:02:36 -0400 Date: Thu, 13 Apr 2017 22:02:25 +0800 From: Dong Aisheng To: Leonard Crestez Cc: Dong Aisheng , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de, broonie@kernel.org, yibin.gong@nxp.com, rjw@rjwysocki.net, viresh.kumar@linaro.org, mturquette@baylibre.com, sboyd@codeaurora.org, shawnguo@kernel.org, fabio.estevam@nxp.com, anson.huang@nxp.com, ping.bai@nxp.com, octavian.purdila@nxp.com, linux-clk@vger.kernel.org Subject: Re: [RFC PATCH 1/3] clk: add clk_bulk_get accessories Message-ID: <20170413140225.GB24254@b29396-OptiPlex-7040> References: <1491969809-20154-1-git-send-email-aisheng.dong@nxp.com> <1491969809-20154-2-git-send-email-aisheng.dong@nxp.com> <1491931159.31718.16.camel@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1491931159.31718.16.camel@nxp.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 11, 2017 at 08:19:19PM +0300, Leonard Crestez wrote: > On Wed, 2017-04-12 at 12:03 +0800, Dong Aisheng wrote: > > +/** > > + * clk_bulk_enable - ungate a bulk of clocks > > + * @num_clks: the number of clk_bulk_data > > + * @clks: the clk_bulk_data table being ungated > > + * > > + * clk_bulk_enable must not sleep > > + * Returns 0 on success, -EERROR otherwise. > > + */ > > +int clk_bulk_enable(int num_clks, struct clk_bulk_data *clks) > > +{ > > +       int ret; > > +       int i; > > + > > +       for (i = 0; i < num_clks; i++) { > > +               ret = clk_enable(clks[i].clk); > > +               if (ret) { > > +                       pr_err("Failed to enable clk '%s': %d\n", > > +                               clks[i].id, ret); > > +                       goto err; > > +               } > > +       } > > + > > +       return 0; > > + > > +err: > > +       while (--i >= 0) > > +               clk_put(clks[i].clk); > > Shouldn't this be clk_disable? > Good catch! Will change in the formal version if Maintainer accepts this idea. > And you can probably use clk_bulk_disable(i, clks) instead Probably i'd prefer keep clk_disable to match with clk_enable to make things more clear. Thanks Regards Dong Aisheng From mboxrd@z Thu Jan 1 00:00:00 1970 From: dongas86@gmail.com (Dong Aisheng) Date: Thu, 13 Apr 2017 22:02:25 +0800 Subject: [RFC PATCH 1/3] clk: add clk_bulk_get accessories In-Reply-To: <1491931159.31718.16.camel@nxp.com> References: <1491969809-20154-1-git-send-email-aisheng.dong@nxp.com> <1491969809-20154-2-git-send-email-aisheng.dong@nxp.com> <1491931159.31718.16.camel@nxp.com> Message-ID: <20170413140225.GB24254@b29396-OptiPlex-7040> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Tue, Apr 11, 2017 at 08:19:19PM +0300, Leonard Crestez wrote: > On Wed, 2017-04-12 at 12:03 +0800, Dong Aisheng wrote: > > +/** > > + * clk_bulk_enable - ungate a bulk of clocks > > + * @num_clks: the number of clk_bulk_data > > + * @clks: the clk_bulk_data table being ungated > > + * > > + * clk_bulk_enable must not sleep > > + * Returns 0 on success, -EERROR otherwise. > > + */ > > +int clk_bulk_enable(int num_clks, struct clk_bulk_data *clks) > > +{ > > +???????int ret; > > +???????int i; > > + > > +???????for (i = 0; i < num_clks; i++) { > > +???????????????ret = clk_enable(clks[i].clk); > > +???????????????if (ret) { > > +???????????????????????pr_err("Failed to enable clk '%s': %d\n", > > +???????????????????????????????clks[i].id, ret); > > +???????????????????????goto err; > > +???????????????} > > +???????} > > + > > +???????return 0; > > + > > +err: > > +???????while (--i >= 0) > > +???????????????clk_put(clks[i].clk); > > Shouldn't this be clk_disable? > Good catch! Will change in the formal version if Maintainer accepts this idea. > And you can probably use clk_bulk_disable(i, clks) instead Probably i'd prefer keep clk_disable to match with clk_enable to make things more clear. Thanks Regards Dong Aisheng