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

@@ -1136,19 +1136,19 @@
  * Endpoint reference management.
  */
 static void
 tl_refhold(tl_endpt_t *tep)
 {
-        atomic_add_32(&tep->te_refcnt, 1);
+        atomic_inc_32(&tep->te_refcnt);
 }
 
 static void
 tl_refrele(tl_endpt_t *tep)
 {
         ASSERT(tep->te_refcnt != 0);
 
-        if (atomic_add_32_nv(&tep->te_refcnt, -1) == 0)
+        if (atomic_dec_32_nv(&tep->te_refcnt) == 0)
                 tl_free(tep);
 }
 
 /*ARGSUSED*/
 static int

@@ -1262,17 +1262,17 @@
 }
 
 static void
 tl_serializer_refhold(tl_serializer_t *s)
 {
-        atomic_add_32(&s->ts_refcnt, 1);
+        atomic_inc_32(&s->ts_refcnt);
 }
 
 static void
 tl_serializer_refrele(tl_serializer_t *s)
 {
-        if (atomic_add_32_nv(&s->ts_refcnt, -1) == 0) {
+        if (atomic_dec_32_nv(&s->ts_refcnt) == 0) {
                 serializer_destroy(s->ts_serializer);
                 kmem_free(s, sizeof (tl_serializer_t));
         }
 }
 

@@ -5424,11 +5424,11 @@
                 }
                 /*
                  * Use default address.
                  */
                 bcopy(&tep->te_defaddr, tep->te_abuf, sizeof (uint32_t));
-                atomic_add_32(&tep->te_defaddr, 1);
+                atomic_inc_32(&tep->te_defaddr);
         }
 
         /*
          * Failed to find anything.
          */