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

@@ -33,12 +33,10 @@
 /*
  * Solaris Multithreaded STREAMS Chelsio PCI Ethernet Driver.
  * Interface code
  */
 
-#pragma ident   "%Z%%M% %I%     %E% SMI"
-
 #include <sys/types.h>
 #include <sys/systm.h>
 #include <sys/cmn_err.h>
 #include <sys/ddi.h>
 #include <sys/sunddi.h>

@@ -1388,11 +1386,11 @@
                 /*
                  * decrement count of receive buffers freed by callback
                  * We decrement here so anyone trying to do fini will
                  * only remove the driver once the counts go to 0.
                  */
-                atomic_add_32(&buffers_in_use[i], -1);
+                atomic_dec_32(&buffers_in_use[i]);
 
                 return;
         }
 
         mutex_enter(&sa->ch_small_esbl);

@@ -1401,11 +1399,11 @@
         mutex_exit(&sa->ch_small_esbl);
 
         /*
          * decrement count of receive buffers freed by callback
          */
-        atomic_add_32(&buffers_in_use[rbp->cs_index], -1);
+        atomic_dec_32(&buffers_in_use[rbp->cs_index]);
 }
 
 /*
  * callback function from freeb() when esballoced mblk freed.
  */

@@ -1431,11 +1429,11 @@
                 /*
                  * decrement count of receive buffers freed by callback
                  * We decrement here so anyone trying to do fini will
                  * only remove the driver once the counts go to 0.
                  */
-                atomic_add_32(&buffers_in_use[i], -1);
+                atomic_dec_32(&buffers_in_use[i]);
 
                 return;
         }
 
         mutex_enter(&sa->ch_big_esbl);

@@ -1444,11 +1442,11 @@
         mutex_exit(&sa->ch_big_esbl);
 
         /*
          * decrement count of receive buffers freed by callback
          */
-        atomic_add_32(&buffers_in_use[rbp->cs_index], -1);
+        atomic_dec_32(&buffers_in_use[rbp->cs_index]);
 }
 
 /*
  * get a pre-allocated, pre-mapped receive buffer from free list.
  * (used sge.c)