Re: [PATCH 2.6.9-rc1-mm4] [m32r] atomic_inc_return for m32r (Re: atomic_inc_return)

From: Hugh Dickins
Date: Fri Sep 10 2004 - 08:21:30 EST


On Fri, 10 Sep 2004, Hirokazu Takata wrote:
>
> Here's a patch for m32r atomic.h against 2.6.9-rc1-mm4.
> Please apply this.
>
> * include/asm-m32r/atomic.h:
> - Add atomic_inc_return(), atomic_dec_return(), atomic_add_return(),
> atomic_sub_return() and atomic_clear_mask().
>
> - Change atomic_sub_and_test(), atomic_inc_and_test() and
> atomic_dec_and_test() from functions to macros.
>
> - Update comments, etc.
>
> Signed-off-by: Hirokazu Takata <takata@xxxxxxxxxxxxxx>

Thanks a lot for doing this.

I don't know your architecture and asm so cannot properly comment on it.

There does seem to be a lot of code duplication in there. I can imagine
it may be optimal to have a separate atomic_inc and atomic_dec, the
most common operations. But do you really need atomic_add, atomic_sub,
atomic_add_return, atomic_sub_return, atomic_inc_return, atomic_dec_return
all with their own code blocks? Maybe, but looks excessive to an outsider.

Perhaps "and return it" rather than just "and return"
in those function comments?

Hugh

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