[PATCH v2 05/14] ARM: integrator: use clocksource_of_init for sp804

Arnd Bergmann arnd at arndb.de
Wed Mar 13 04:43:18 EDT 2013


On Wednesday 13 March 2013, Haojian Zhuang wrote:
> match table:
> {.compatible = "arm,sp804", .data = SP804_TIMER, },
> {.compaitlbe = "arm,integrator-timer", .data = INTEGRATOR_TIMER, },
> 
> sp804_get_clock_rate():
>     char dev_id_buf[ID_BUF_SIZE];
>     if (match->data)
>         snprintf(dev_id_buf, ID_BUF_SIZE, "ap_timer");
>     else
>         snprintf(dev_id_buf, ID_BUF_SIZE, "sp804");
>     clk = clk_get_sys(dev_id_buf, name);
> 
> sp804_dt_init_clk():
>     char dev_id_buf[ID_BUF_SIZE];
>     if (match->data)
>         snprintf(dev_id_buf, ID_BUF_SIZE, "ap_timer");
>     else
>         snprintf(dev_id_buf, ID_BUF_SIZE, "sp804");
>     lookup = clkdev_alloc(clk, name, dev_id_buf);
> 
> I think it won't break out code any more. Since most code are same, we
> could handle it in the same driver.
> 

The data member of struct of_device_id is a pointer, you could
point that directly to a const string containing the name, if that
is the only difference, or to another structure that describes
the other parameters.

	Arnd



More information about the linux-arm-kernel mailing list