From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752354AbdDNQPJ (ORCPT ); Fri, 14 Apr 2017 12:15:09 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:35373 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751350AbdDNQPG (ORCPT ); Fri, 14 Apr 2017 12:15:06 -0400 Date: Sat, 15 Apr 2017 00:14:55 +0800 From: Dong Aisheng To: Geert Uytterhoeven Cc: Dong Aisheng , linux-clk , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , Sascha Hauer , Mark Brown , yibin.gong@nxp.com, "Rafael J. Wysocki" , Viresh Kumar , Michael Turquette , Stephen Boyd , Shawn Guo , Fabio Estevam , anson.huang@nxp.com, ping.bai@nxp.com, leonard.crestez@nxp.com, octavian.purdila@nxp.com Subject: Re: [RFC PATCH 1/3] clk: add clk_bulk_get accessories Message-ID: <20170414161455.GE1792@b29396-OptiPlex-7040> References: <1491969809-20154-1-git-send-email-aisheng.dong@nxp.com> <1491969809-20154-2-git-send-email-aisheng.dong@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Hi Geert, On Thu, Apr 13, 2017 at 09:56:31PM +0200, Geert Uytterhoeven wrote: > On Wed, Apr 12, 2017 at 6:03 AM, Dong Aisheng wrote: > > --- a/drivers/clk/clk.c > > +++ b/drivers/clk/clk.c > > @@ -520,6 +520,23 @@ void clk_unprepare(struct clk *clk) > > } > > EXPORT_SYMBOL_GPL(clk_unprepare); > > > > +/** > > + * clk_bulk_unprepare - undo preparation of a bulk of clock sources > > + * @num_clks: the number of clk_bulk_data > > + * @clks: the clk_bulk_data table being ungated > > + * > > + * clk_bulk_unprepare may sleep, which differentiates it from clk_bulk_disable. > > + * Returns 0 on success, -EERROR otherwise. > > + */ > > +void clk_bulk_unprepare(int num_clks, struct clk_bulk_data *clks) > > unsigned int num_clks (everywhere) > > > +{ > > + int i; > > unsigned int i (everywhere) Any special purpose? Looks like 'int i' for a loop is widely used in kernel. Would you please help clarify more? > > + > > + for (i = 0; i < num_clks; i++) > > + clk_unprepare(clks[i].clk); > > +} > > +EXPORT_SYMBOL_GPL(clk_bulk_unprepare); > > This does mean you have to change your "while (--i >= 0)" loops. Is that really necessary as i thought the clk_bulk_get/put does not guarantee any clk operation orders within the bulk? Should we need add that support? And currently this does the same thing as bulk regulator. Regards Dong Aisheng From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Return-Path: Date: Sat, 15 Apr 2017 00:14:55 +0800 From: Dong Aisheng To: Geert Uytterhoeven Cc: Dong Aisheng , linux-clk , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , Sascha Hauer , Mark Brown , yibin.gong@nxp.com, "Rafael J. Wysocki" , Viresh Kumar , Michael Turquette , Stephen Boyd , Shawn Guo , Fabio Estevam , anson.huang@nxp.com, ping.bai@nxp.com, leonard.crestez@nxp.com, octavian.purdila@nxp.com Subject: Re: [RFC PATCH 1/3] clk: add clk_bulk_get accessories Message-ID: <20170414161455.GE1792@b29396-OptiPlex-7040> References: <1491969809-20154-1-git-send-email-aisheng.dong@nxp.com> <1491969809-20154-2-git-send-email-aisheng.dong@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: List-ID: Hi Geert, On Thu, Apr 13, 2017 at 09:56:31PM +0200, Geert Uytterhoeven wrote: > On Wed, Apr 12, 2017 at 6:03 AM, Dong Aisheng wrote: > > --- a/drivers/clk/clk.c > > +++ b/drivers/clk/clk.c > > @@ -520,6 +520,23 @@ void clk_unprepare(struct clk *clk) > > } > > EXPORT_SYMBOL_GPL(clk_unprepare); > > > > +/** > > + * clk_bulk_unprepare - undo preparation of a bulk of clock sources > > + * @num_clks: the number of clk_bulk_data > > + * @clks: the clk_bulk_data table being ungated > > + * > > + * clk_bulk_unprepare may sleep, which differentiates it from clk_bulk_disable. > > + * Returns 0 on success, -EERROR otherwise. > > + */ > > +void clk_bulk_unprepare(int num_clks, struct clk_bulk_data *clks) > > unsigned int num_clks (everywhere) > > > +{ > > + int i; > > unsigned int i (everywhere) Any special purpose? Looks like 'int i' for a loop is widely used in kernel. Would you please help clarify more? > > + > > + for (i = 0; i < num_clks; i++) > > + clk_unprepare(clks[i].clk); > > +} > > +EXPORT_SYMBOL_GPL(clk_bulk_unprepare); > > This does mean you have to change your "while (--i >= 0)" loops. Is that really necessary as i thought the clk_bulk_get/put does not guarantee any clk operation orders within the bulk? Should we need add that support? And currently this does the same thing as bulk regulator. Regards Dong Aisheng From mboxrd@z Thu Jan 1 00:00:00 1970 From: dongas86@gmail.com (Dong Aisheng) Date: Sat, 15 Apr 2017 00:14:55 +0800 Subject: [RFC PATCH 1/3] clk: add clk_bulk_get accessories In-Reply-To: References: <1491969809-20154-1-git-send-email-aisheng.dong@nxp.com> <1491969809-20154-2-git-send-email-aisheng.dong@nxp.com> Message-ID: <20170414161455.GE1792@b29396-OptiPlex-7040> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Hi Geert, On Thu, Apr 13, 2017 at 09:56:31PM +0200, Geert Uytterhoeven wrote: > On Wed, Apr 12, 2017 at 6:03 AM, Dong Aisheng wrote: > > --- a/drivers/clk/clk.c > > +++ b/drivers/clk/clk.c > > @@ -520,6 +520,23 @@ void clk_unprepare(struct clk *clk) > > } > > EXPORT_SYMBOL_GPL(clk_unprepare); > > > > +/** > > + * clk_bulk_unprepare - undo preparation of a bulk of clock sources > > + * @num_clks: the number of clk_bulk_data > > + * @clks: the clk_bulk_data table being ungated > > + * > > + * clk_bulk_unprepare may sleep, which differentiates it from clk_bulk_disable. > > + * Returns 0 on success, -EERROR otherwise. > > + */ > > +void clk_bulk_unprepare(int num_clks, struct clk_bulk_data *clks) > > unsigned int num_clks (everywhere) > > > +{ > > + int i; > > unsigned int i (everywhere) Any special purpose? Looks like 'int i' for a loop is widely used in kernel. Would you please help clarify more? > > + > > + for (i = 0; i < num_clks; i++) > > + clk_unprepare(clks[i].clk); > > +} > > +EXPORT_SYMBOL_GPL(clk_bulk_unprepare); > > This does mean you have to change your "while (--i >= 0)" loops. Is that really necessary as i thought the clk_bulk_get/put does not guarantee any clk operation orders within the bulk? Should we need add that support? And currently this does the same thing as bulk regulator. Regards Dong Aisheng