Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754203AbdDMOhl (ORCPT ); Thu, 13 Apr 2017 10:37:41 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:36795 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752379AbdDMOhi (ORCPT ); Thu, 13 Apr 2017 10:37:38 -0400 Date: Thu, 13 Apr 2017 22:37:27 +0800 From: Dong Aisheng To: Dong Aisheng Cc: linux-clk@vger.kernel.org, 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, leonard.crestez@nxp.com, octavian.purdila@nxp.com Subject: Re: [RFC PATCH 2/3] clk: add managed version of clk_bulk_get Message-ID: <20170413143727.GE24254@b29396-OptiPlex-7040> References: <1491969809-20154-1-git-send-email-aisheng.dong@nxp.com> <1491969809-20154-3-git-send-email-aisheng.dong@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1491969809-20154-3-git-send-email-aisheng.dong@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 Content-Length: 2622 Lines: 76 On Wed, Apr 12, 2017 at 12:03:28PM +0800, Dong Aisheng wrote: > This patch introduces the managed version of clk_bulk_get. > > Cc: Michael Turquette > Cc: Stephen Boyd > Cc: "Rafael J. Wysocki" > Cc: Viresh Kumar > Cc: Mark Brown > Cc: Shawn Guo > Cc: Fabio Estevam > Cc: Sascha Hauer > Cc: Anson Huang > Cc: Robin Gong > Cc: Bai Ping > Cc: Leonard Crestez > Cc: Octavian Purdila > Signed-off-by: Dong Aisheng > --- > drivers/clk/clk-devres.c | 36 ++++++++++++++++++++++++++++++++++++ > include/linux/clk.h | 22 +++++++++++++++++++++- > 2 files changed, 57 insertions(+), 1 deletion(-) > > diff --git a/drivers/clk/clk-devres.c b/drivers/clk/clk-devres.c > index 3a218c3..c7fb31d 100644 > --- a/drivers/clk/clk-devres.c > +++ b/drivers/clk/clk-devres.c > @@ -34,6 +34,42 @@ struct clk *devm_clk_get(struct device *dev, const char *id) > } > EXPORT_SYMBOL(devm_clk_get); > > +struct clk_bulk_devres { > + struct clk_bulk_data *clks; > + int num_clks; > +}; > + > +static void devm_clk_bulk_release(struct device *dev, void *res) > +{ > + struct clk_bulk_devres *devres = res; > + > + clk_bulk_put(devres->num_clks, devres->clks); > +} > + > +int devm_clk_bulk_get(struct device *dev, int num_clks, > + struct clk_bulk_data *clks) > +{ > + struct clk_bulk_devres *devres; > + int ret; > + > + devres = devres_alloc(devm_clk_bulk_release, > + sizeof(*devres), GFP_KERNEL); > + if (!devres) > + return -ENOMEM; > + > + ret = clk_bulk_get(dev, num_clks, clks); Another catch by 0day robot. drivers/built-in.o: In function `devm_clk_bulk_get': >> (.text+0x1930e): undefined reference to `clk_bulk_get' drivers/built-in.o: In function `devm_clk_bulk_release': >> clk-devres.c:(.text+0x19370): undefined reference to `clk_bulk_put' clk_bulk_get is defined in clkdev.c which depends on CONFIG_CLKDEV_LOOKUP. However, some platforms like m68k may not select CLKDEV_LOOKUP but select HAVE_CLK. Thus compiling devm_clk_bulk_get may cause a undefined reference to 'clk_bulk_get'. Since clk_bulk_get is built upon the platform specific clk_get api, clk_bulk_get can also be used by that platform accordingly. Then we probably could move clk_bulk_get into clk-devres.c as well which is controlled by common CONFIG_HAVE_CLK to benifit all platforms. Regards Dong Aisheng