On 2013年12月03日 20:27, Linus Walleij wrote:
On Tue, Dec 3, 2013 at 12:15 PM, Hanjun Guo hanjun.guo@linaro.org wrote:
/* if can't be initialised from DT, try ACPI way */
if (!arch_timer_get_rate())
arch_timer_acpi_init();
arch_timer_rate = arch_timer_get_rate();
This looks a bit fragile. Having a call like arch_timer_get_rate() to check whether there is a DT node for the timer doesn't seem right, can you refactor the code to provide some has_arch_timer_node() or similar call instead, so it's a bit easier to understand & maintain at least?
Good point, thanks for the guidance. I will introduce has_arch_timer_node() as you said and use it as follows:
if (has_arch_timer_node()) clocksource_of_init(); esle arch_timer_acpi_init(); /* try ACPI way */
Is this make sense to you?
Thanks Hanjun