Print this page
5045 use atomic_{inc,dec}_* instead of atomic_add_*
@@ -22,12 +22,10 @@
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/types.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/conf.h>
#include <sys/stream.h>
@@ -282,11 +280,11 @@
try_again:
rw_enter(&fmodsw_lock, RW_READER);
if (i_fmodsw_hash_find(name, &fp) == 0) {
if (flags & FMODSW_HOLD) {
- atomic_add_32(&(fp->f_ref), 1); /* lock must be held */
+ atomic_inc_32(&(fp->f_ref)); /* lock must be held */
ASSERT(fp->f_ref > 0);
}
rw_exit(&fmodsw_lock);
return (fp);
@@ -306,7 +304,7 @@
void
fmodsw_rele(fmodsw_impl_t *fp)
{
ASSERT(fp->f_ref > 0);
- atomic_add_32(&(fp->f_ref), -1);
+ atomic_dec_32(&(fp->f_ref));
}