[RFC PATCH 1/3] clk: add clk_bulk_get accessories

Dong Aisheng dongas86 at gmail.com
Thu Apr 13 10:02:25 EDT 2017


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



More information about the linux-arm-kernel mailing list