Re: [PATCH 6/6] clk: Add initial WM831x clock driver

From: Mark Brown
Date: Fri Jul 15 2011 - 01:05:23 EST


On Thu, Jul 14, 2011 at 08:53:39PM -0600, Grant Likely wrote:
> On Mon, Jul 11, 2011 at 11:53:57AM +0900, Mark Brown wrote:

> > @@ -10,6 +10,7 @@ config GENERIC_CLK_BUILD_TEST
> > depends on EXPERIMENTAL && GENERIC_CLK
> > select GENERIC_CLK_FIXED
> > select GENERIC_CLK_GATE
> > + select GENERIC_CLK_WM831X if MFD_WM831X=y

> Hmmm, this could get unwieldy in a hurry.

It's not really any hassle, we've got a one of these in ASoC. The list
gets long but if you keep it sorted it's not an issue for merges and
otherwise it's just long not complicated. The ability to get build
coverage is *really* useful.

> > +static int wm831x_xtal_enable(struct clk_hw *hw)
> > +{
> > + struct wm831x_clk *clkdata = container_of(hw, struct wm831x_clk,
> > + xtal_hw);

> This container of is used 10 times. A static inline would be
> reasonable.

Not quite - it's used in three different variants (one for each of the
clocks).

> > + if (clkdata->xtal_ena)
> > + return 0;
> > + else
> > + return -EPERM;
> > +}

> Nit: return clkdata->xtal_ena ? 0 : -EPERM;

> Just makes for more concise code.

I have an extremely strong dislike of the ternery operator, I find it
does nothing for legibility.

> > + if (!clk_register(wm831x->dev, &wm831x_clkout_ops, &clkdata->clkout_hw,
> > + "clkout")) {
> > + ret = -EINVAL;
> > + goto err_fll;
> > + }

> How common will this pattern be? Is there need for a
> clk_register_many() variant?

I dunno, I think a lot of the SoCs may be doing one clk per device. But
equally well it's not like it'd be hard if someone starts working on the
API again.
--
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/