Re: [PATCH] introduce setup_timer() helper

From: Oleg Nesterov
Date: Sun Sep 18 2005 - 10:40:46 EST


Arjan van de Ven wrote:
>
> > unsigned long data)
> > +{
> > + timer->function = function;
> > + timer->data = data;
> > + init_timer(timer);
> > +}
>
> are you sure you want to do this in this order???
> I'd expect the init_timer to be first...

I think it does not matter from correctness point of view.

But if we have:

setup_timer(timer, expr1(), expr2())

it is better to initialize ->func and ->data first, otherwise
the compiler should save the results from expr{1,2}, then call
init_timer(), then copy these results to *timer.

Oleg.
-
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/