Re: [RFC] clk: Make clk API return per-user struct clk instances

From: Russell King - ARM Linux
Date: Tue Sep 30 2014 - 05:14:55 EST


On Mon, Sep 29, 2014 at 08:17:23PM +0200, Tomeu Vizoso wrote:
> diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c
> index da4bda8..ab22460 100644
> --- a/drivers/clk/clkdev.c
> +++ b/drivers/clk/clkdev.c
> @@ -168,14 +168,20 @@ static struct clk_lookup *clk_find(const char *dev_id, const char *con_id)
> struct clk *clk_get_sys(const char *dev_id, const char *con_id)
> {
> struct clk_lookup *cl;
> + struct clk *clk = NULL;
>
> mutex_lock(&clocks_mutex);
> cl = clk_find(dev_id, con_id);
> - if (cl && !__clk_get(cl->clk))
> - cl = NULL;
> + if (cl) {
> + clk = __clk_create_clk(cl->clk);
> + if (clk && !__clk_get(clk)) {
> + __clk_free_clk(clk);
> + clk = NULL;
> + }
> + }
> mutex_unlock(&clocks_mutex);
>
> - return cl ? cl->clk : ERR_PTR(-ENOENT);
> + return clk ? clk : ERR_PTR(-ENOENT);

NAK. We have places where we explicitly expect clk_get* to return NULL.

--
FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up
according to speedtest.net.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/