All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arjan van de Ven <arjanv@redhat.com>
To: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Andrew Morton <akpm@osdl.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] introduce setup_timer() helper
Date: Sun, 18 Sep 2005 17:43:01 +0200	[thread overview]
Message-ID: <20050918154301.GA9088@devserv.devel.redhat.com> (raw)
In-Reply-To: <432D8CF8.C14C48A0@tv-sign.ru>


On Sun, Sep 18, 2005 at 07:51:20PM +0400, Oleg Nesterov wrote:
> 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.

right now.. it probably doesn't.
However I think conceptually, touching a timer before init_timer() is just
wrong. For one... it would prevent init_timer() from being able to use
memset() on the timer. Which it doesn't today but it's the kind of thing
that you don't want to prevent happening in the future.

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

I don't see how that is different.... 

  reply	other threads:[~2005-09-18 15:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-18 13:51 [PATCH] introduce setup_timer() helper Oleg Nesterov
2005-09-18 15:12 ` Arjan van de Ven
2005-09-18 15:51   ` Oleg Nesterov
2005-09-18 15:43     ` Arjan van de Ven [this message]
2005-09-18 16:22       ` Oleg Nesterov
2005-09-18 20:06         ` Andrew Morton
2005-09-19 15:11           ` Oleg Nesterov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050918154301.GA9088@devserv.devel.redhat.com \
    --to=arjanv@redhat.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@tv-sign.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.