[PATCH 05/14] ARM: AT91: Always provide clk_set_rate stub

Sascha Hauer s.hauer at pengutronix.de
Sun Nov 30 03:01:48 PST 2014


On Fri, Nov 28, 2014 at 04:23:26PM +0100, Lucas Stach wrote:
> Am Freitag, den 28.11.2014, 15:28 +0100 schrieb Sascha Hauer:
> > Some drivers need clk_set_rate. To be able to link with these
> > drivers enabled provide a clk_set_rate stub.
> > 
> This commit seem to do something different than what the changelog says.

No, look again. The clock_set_rate/clock_set_parent functions are
already there, but #ifdeffed out. This patch replaces the #ifdef
with IS_ENABLED() and thus provides the desired functions.

Sascha

> 
> > Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
> > ---
> >  arch/arm/mach-at91/clock.c | 15 +++++++--------
> >  1 file changed, 7 insertions(+), 8 deletions(-)
> > 
> > diff --git a/arch/arm/mach-at91/clock.c b/arch/arm/mach-at91/clock.c
> > index a7051c3..125d169 100644
> > --- a/arch/arm/mach-at91/clock.c
> > +++ b/arch/arm/mach-at91/clock.c
> > @@ -336,8 +336,6 @@ EXPORT_SYMBOL(clk_get_rate);
> >  
> >  /*------------------------------------------------------------------------*/
> >  
> > -#ifdef CONFIG_AT91_PROGRAMMABLE_CLOCKS
> > -
> >  /*
> >   * For now, only the programmable clocks support reparenting (MCK could
> >   * do this too, with care) or rate changing (the PLLs could do this too,
> > @@ -379,6 +377,9 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
> >  	unsigned long	prescale_offset, css_mask;
> >  	unsigned long	actual;
> >  
> > +	if (!IS_ENABLED(CONFIG_PROGRAMMABLE_CLOCKS))
> > +		return 0;
> > +
> >  	if (!clk_is_programmable(clk))
> >  		return -EINVAL;
> >  	if (clk->users)
> > @@ -419,6 +420,9 @@ EXPORT_SYMBOL(clk_get_parent);
> >  
> >  int clk_set_parent(struct clk *clk, struct clk *parent)
> >  {
> > +	if (!IS_ENABLED(CONFIG_PROGRAMMABLE_CLOCKS))
> > +		return -ENOSYS;
> > +
> >  	if (clk->users)
> >  		return -EBUSY;
> >  	if (!clk_is_primary(parent) || !clk_is_programmable(clk))
> > @@ -453,8 +457,6 @@ static void init_programmable_clock(struct clk *clk)
> >  	clk->rate_hz = parent->rate_hz / pmc_prescaler_divider(pckr);
> >  }
> >  
> > -#endif	/* CONFIG_AT91_PROGRAMMABLE_CLOCKS */
> > -
> >  /*------------------------------------------------------------------------*/
> >  
> >  /* Register a new clock */
> > @@ -483,13 +485,10 @@ int clk_register(struct clk *clk)
> >  	else if (clk_is_sys(clk)) {
> >  		clk->parent = &mck;
> >  		clk->mode = pmc_sys_mode;
> > -	}
> > -#ifdef CONFIG_AT91_PROGRAMMABLE_CLOCKS
> > -	else if (clk_is_programmable(clk)) {
> > +	} else if (IS_ENABLED(CONFIG_PROGRAMMABLE_CLOCKS) && clk_is_programmable(clk)) {
> >  		clk->mode = pmc_sys_mode;
> >  		init_programmable_clock(clk);
> >  	}
> > -#endif
> >  
> >  	at91_clk_add(clk);
> >  
> 
> -- 
> Pengutronix e.K.             | Lucas Stach                 |
> Industrial Linux Solutions   | http://www.pengutronix.de/  |
> 
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list