Re: [patch 4/7] clockevents: Provide combined configure and registerfunction

From: Ingo Molnar
Date: Thu May 19 2011 - 14:10:37 EST


* Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:

> On Thu, 19 May 2011, Ingo Molnar wrote:
>
> >
> > * Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:
> >
> > > +extern void clockevents_config_and_register(struct clock_event_device *dev,
> > > + u32 freq, unsigned long min_delta,
> > > + unsigned long max_delta);
> >
> > might be worth collecting these fields into a clocksource_params structure:
> >
> > struct clocksource_params {
> > u32 freq;
> > unsigned long min_delta;
> > unsigned long max_delta;
> > };
> >
> > That way the initialization API looks even more streamlined:
> >
> > extern void
> > clockevents_config_and_register(struct clock_event_device *dev,
> > struct clocksource_params params);
> >
> > and could be extended in the future, without having to update every single
> > clocksource driver again.
>
> Though it's unlikely that we have more params int the foreseeable
> future and it's more code in the clock events registration sites as
> you have to do:
>
> struct param par;
>
> par.freq = f;
> par.min_delta = x;
> par.max_delta = y;
> clockevents_config_and_register(&dev, &p);
>
> instead of having a single line.

Indeed that looks uglish.

> When the need arises we still can do
>
> __clockevents_config_and_register(struct clock_event_device *dev,
> struct clocksource_params params);
>
> and have the current function as a wrapper around it.

Okay, you are right.

Thanks,

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/