Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758128AbYFEP1s (ORCPT ); Thu, 5 Jun 2008 11:27:48 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752391AbYFEP1l (ORCPT ); Thu, 5 Jun 2008 11:27:41 -0400 Received: from gw.goop.org ([64.81.55.164]:50805 "EHLO mail.goop.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751397AbYFEP1k (ORCPT ); Thu, 5 Jun 2008 11:27:40 -0400 Message-ID: <484805C4.7030809@goop.org> Date: Thu, 05 Jun 2008 16:27:00 +0100 From: Jeremy Fitzhardinge User-Agent: Thunderbird 2.0.0.14 (X11/20080501) MIME-Version: 1.0 To: Cliff Wickman CC: linux-kernel@vger.kernel.org, mingo@elte.hu Subject: Re: [PATCH 1/1] x86 atomic operations: atomic_or_long atomic_inc_short References: In-Reply-To: X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2170 Lines: 69 Cliff Wickman wrote: > From: Cliff Wickman > > Provide atomic operations for increment of a 16-bit integer and > logical OR into a 64-bit integer. > > [ This patch was split off of patch: > SGI UV: TLB shootdown using broadcast assist unit > and improved with advice from Jeremy Fitzhardinge ] > > Diffed against 2.6.26-rc4 > > Signed-off-by: Cliff Wickman > Reviewed-by: Jeremy Fitzhardinge > --- > include/asm-x86/atomic_64.h | 26 ++++++++++++++++++++++++++ > 1 file changed, 26 insertions(+) > > Index: linux/include/asm-x86/atomic_64.h > =================================================================== > --- linux.orig/include/asm-x86/atomic_64.h > +++ linux/include/asm-x86/atomic_64.h > @@ -431,6 +431,32 @@ static inline int atomic64_add_unless(at > return c != (u); > } > > +/** > + * atomic_inc_short - increment of a short integer > + * @v: pointer to type int > + * > + * Atomically adds 1 to @v > + * Returns the new value of @u > + */ > +static inline short int atomic_inc_short(short int *v) > +{ > + asm(LOCK_PREFIX "addw $1, %0" : "+m" (*v)); > + return *v; > +} > + > +/** > + * atomic_or_long - OR of two long integers > + * @v1: pointer to type unsigned long > + * @v2: pointer to type unsigned long > + * > + * Atomically ORs @v1 and @v2 > + * Returns the result of the OR > + */ > +static inline void atomic_or_long(unsigned long *v1, unsigned long v2) > +{ > + asm(LOCK_PREFIX "orq %1, %0" : "+m" (*v1) : "r" (v2)); > +} > + > #define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0) > > /* These are x86-specific, used by some header files */ > -- > 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/ > -- 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/