[PATCH 08/10] OMAP: split plat-omap/common.c

Varadarajan, Charulatha charu at ti.com
Mon Oct 4 04:28:21 EDT 2010


Paul,

<<snip>>

> 
> > > +static int __init omap_init_clocksource_32k(void)
> > > +{
> > > +	static char err[] __initdata = KERN_ERR
> > > +			"%s: can't register clocksource!\n";
> > > +
> > > +	if (cpu_is_omap16xx() || cpu_class_is_omap2()) {
> > > +		struct clk *sync_32k_ick;
> > > +
> > > +		if (cpu_is_omap16xx())
> >
> > Avoid cpu_is* checks in plat-omap.
> 
> OK, I'll bite.  Why?

I think this is being looked for all the new code introduced
in plat-omap layer for the following reasons:
Adding cpu-is-* checks makes code unmaintainable going fwd.
plat-omap layer needs to handle common code for all omap platforms.

This was raised for GPIO driver because of which, there was a
requirement to clean-up the gpio driver.

Is this stand changed? Are cpu_is* checks allowed in plat-omap?

> > > +			clocksource_32k.read = omap16xx_32k_read;
> > > +		else if (cpu_is_omap2420())
> > > +			clocksource_32k.read = omap2420_32k_read;
> > > +		else if (cpu_is_omap2430())
> > > +			clocksource_32k.read = omap2430_32k_read;
> > > +		else if (cpu_is_omap34xx())
> > > +			clocksource_32k.read = omap34xx_32k_read;
> > > +		else if (cpu_is_omap44xx())
> > > +			clocksource_32k.read = omap44xx_32k_read;
> > > +		else
> > > +			return -ENODEV;
> > > +
> > > +		sync_32k_ick = clk_get(NULL, "omap_32ksync_ick");
> > > +		if (sync_32k_ick)
> > > +			clk_enable(sync_32k_ick);
> > > +
> > > +		clocksource_32k.mult = clocksource_hz2mult(32768,
> > > +					    clocksource_32k.shift);
> > > +
> > > +		offset_32k = clocksource_32k.read(&clocksource_32k);
> > > +
> > > +		if (clocksource_register(&clocksource_32k))
> > > +			printk(err, clocksource_32k.name);
> > > +	}
> > > +	return 0;
> > > +}
> > > +arch_initcall(omap_init_clocksource_32k);
> > > +


-V Charulatha



More information about the linux-arm-kernel mailing list