From owner-svn-src-projects@FreeBSD.ORG Thu Oct 14 01:48:52 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1F93A1065673; Thu, 14 Oct 2010 01:48:52 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0F3DB8FC18; Thu, 14 Oct 2010 01:48:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9E1mpjJ008546; Thu, 14 Oct 2010 01:48:51 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9E1mpJ9008543; Thu, 14 Oct 2010 01:48:51 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <201010140148.o9E1mpJ9008543@svn.freebsd.org> From: Jeff Roberson Date: Thu, 14 Oct 2010 01:48:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213822 - projects/ofed/head/sys/ofed/include/asm X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Oct 2010 01:48:52 -0000 Author: jeff Date: Thu Oct 14 01:48:51 2010 New Revision: 213822 URL: http://svn.freebsd.org/changeset/base/213822 Log: - Correct sign of return values from atomic functions. This was preventing atomic_add_negative() from detecting negative values. Sponsored by: Isilon Systems, iX Systems, and Panasas. Modified: projects/ofed/head/sys/ofed/include/asm/atomic-long.h projects/ofed/head/sys/ofed/include/asm/atomic.h Modified: projects/ofed/head/sys/ofed/include/asm/atomic-long.h ============================================================================== --- projects/ofed/head/sys/ofed/include/asm/atomic-long.h Thu Oct 14 01:47:47 2010 (r213821) +++ projects/ofed/head/sys/ofed/include/asm/atomic-long.h Thu Oct 14 01:48:51 2010 (r213822) @@ -39,7 +39,7 @@ typedef struct { #define atomic_long_add(i, v) atomic_long_add_return((i), (v)) #define atomic_long_inc_return(v) atomic_long_add_return(1, (v)) -static inline u_long +static inline long atomic_long_add_return(long i, atomic_long_t *v) { return i + atomic_fetchadd_long(&v->counter, i); Modified: projects/ofed/head/sys/ofed/include/asm/atomic.h ============================================================================== --- projects/ofed/head/sys/ofed/include/asm/atomic.h Thu Oct 14 01:47:47 2010 (r213821) +++ projects/ofed/head/sys/ofed/include/asm/atomic.h Thu Oct 14 01:48:51 2010 (r213822) @@ -46,13 +46,13 @@ typedef struct { #define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0) #define atomic_inc_and_test(v) (atomic_add_return(1, (v)) == 0) -static inline u_int +static inline int atomic_add_return(int i, atomic_t *v) { return i + atomic_fetchadd_int(&v->counter, i); } -static inline u_int +static inline int atomic_sub_return(int i, atomic_t *v) { return atomic_fetchadd_int(&v->counter, -i) - i;