Print this page
5045 use atomic_{inc,dec}_* instead of atomic_add_*

@@ -21,12 +21,10 @@
 /*
  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
-#pragma ident   "%Z%%M% %I%     %E% SMI"
-
 #include <sys/proc.h>
 #include <sys/systm.h>
 #include <sys/param.h>
 #include <sys/atomic.h>
 #include <sys/kmem.h>

@@ -103,17 +101,17 @@
 }
 
 void
 corectl_content_hold(corectl_content_t *ccp)
 {
-        atomic_add_32(&ccp->ccc_refcnt, 1);
+        atomic_inc_32(&ccp->ccc_refcnt);
 }
 
 void
 corectl_content_rele(corectl_content_t *ccp)
 {
-        if (atomic_add_32_nv(&ccp->ccc_refcnt, -1) == 0)
+        if (atomic_dec_32_nv(&ccp->ccc_refcnt) == 0)
                 kmem_free(ccp, sizeof (corectl_content_t));
 }
 
 
 static corectl_path_t *

@@ -152,17 +150,17 @@
 }
 
 void
 corectl_path_hold(corectl_path_t *ccp)
 {
-        atomic_add_32(&ccp->ccp_refcnt, 1);
+        atomic_inc_32(&ccp->ccp_refcnt);
 }
 
 void
 corectl_path_rele(corectl_path_t *ccp)
 {
-        if (atomic_add_32_nv(&ccp->ccp_refcnt, -1) == 0) {
+        if (atomic_dec_32_nv(&ccp->ccp_refcnt) == 0) {
                 refstr_rele(ccp->ccp_path);
                 kmem_free(ccp, sizeof (corectl_path_t));
         }
 }