[RFC, PATCH 6/7] arm/icst307: use common struct clk, unify realview and versatile clocks

Jeremy Kerr jeremy.kerr at canonical.com
Thu Jan 7 20:35:36 EST 2010


Hi Hartley,

> > +unsigned long clk_icst307_get_rate(struct clk *clk)
> > +{
> > +	return to_clk_icst307(clk)->rate;
> > +}
> > +
> > +long clk_icst307_round_rate(struct clk *clk, unsigned long rate)
> 
> I think the return value here should be 'unsigned long'

linux/clk.h defines clk_round_rate as returning 'long'.

> Could struct icst307_vco be part of struct clk_icst307?
> 
> If so, clk_icst307_set_rate could use clk_icst307_round_rate like this:
> 
> int clk_icst307_set_rate(struct clk *clk, unsigned long rate)
> {
> 	struct clk_icst307 *v_clk = to_clk_icst307(clk);
> 
> 	v_clk->rate = clk_icst307_round_rate(clk, rate);
> 	v_clk->setvco(v_clk);
> 
> 	return 0;
> }

If struct icst307_vco were a member of clk_icst307, then we'd only be using it 
to pass a value between two functions; it's not really a property of the clock 
itself.

But yes, set_rate should use round_rate, I'll update that.

Cheers,


Jeremy



More information about the linux-arm-kernel mailing list