Re: [RFC PATCH 1/3] clk: add clk_bulk_get accessories
From: Leonard Crestez
Date: Tue Apr 11 2017 - 13:19:41 EST
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?
And you can probably use clk_bulk_disable(i, clks) instead