Re: [PATCH] Module rewrite 2/20: bigrefs

Rusty Russell (rusty@rustcorp.com.au)
Wed, 25 Sep 2002 15:59:15 +1000


In message <15761.12992.408142.964391@notabene.cse.unsw.edu.au> you write:
> On Wednesday September 25, rusty@rustcorp.com.au wrote:
> > +static inline void bigref_init(struct bigref *ref, int value)
> > +{
> > + unsigned int i;
> > + atomic_set(&ref->ref[0].counter, value);
> > + for (i = 1; i < NR_CPUS; i++)
> -----------------^
> > + atomic_set(&ref->ref[i].counter, 0);
> > + ref->waiter = NULL; /* To trap bugs */
> > +}
>
> Should this be '0', or should there be a comment explaining why it
> one?

No, if it were 0, it would overwrite the atomic_set() immediately
above it. I didn't think a comment was required since this is the
most obvious way to initialize a per-cpu counter to a total value.

I could add:
/* Set one to the value, the others to zero */

If you missed it, others probably will, too.
Rusty.

--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/