Re: [PATCH] MIPS: cevt-r4k: Enable intimer for Loongson64 CPUs with extimer

From: Thomas Bogendoerfer
Date: Sun Oct 04 2020 - 16:13:44 EST


On Sat, Oct 03, 2020 at 02:25:42PM +0800, Jiaxun Yang wrote:
>
>
> 于 2020年10月2日 GMT+08:00 下午9:27:21, Thomas Bogendoerfer <tsbogend@xxxxxxxxxxxxxxxx> 写到:
> >On Wed, Sep 23, 2020 at 07:02:54PM +0800, Jiaxun Yang wrote:
> >>
> >> +#ifdef CONFIG_CPU_LOONGSON64
> >> +static int c0_compare_int_enable(struct clock_event_device *cd)
> >> +{
> >> + if (cpu_has_extimer)
> >> + set_c0_config6(LOONGSON_CONF6_INTIMER);
> >
> >why are you not simply do this in loognson64 board setup code and avoid
> >the whole cluttering of #ifdef CONFIG_CPU_LOONGSON64 over common code ?
>
> Because I'm going to add extimer support later that require dynamic
> switch of cevt-r4k.

another case of misdesigned hardware or why does this need to be
dynamic ?

> This callback is required.

please find a solution without #ifdef CONFIG_CPU_LOONGSON64. I dislike
the pollution of common code with all kinds of #ifdefs and in this case
there are better options.

Thomas.

--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]