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/types.h>
#include <sys/param.h>
#include <sys/modctl.h>
#include <sys/sysmacros.h>
#include <sys/kmem.h>
@@ -1376,11 +1374,11 @@
* out a destroy operation between the action
* state being checked and the packet count
* being incremented.
*/
- atomic_add_32(&(ap->ippa_packets), 1);
+ atomic_inc_32(&(ap->ippa_packets));
imp = ap->ippa_mod;
ASSERT(imp != NULL);
UNLOCK_ACTION(ap);
@@ -1418,11 +1416,11 @@
/*
* Decrement the packet count.
*/
- atomic_add_32(&(ap->ippa_packets), -1);
+ atomic_dec_32(&(ap->ippa_packets));
/*
* If the class' action id is the same now as it was
* before then clearly no 'next action' has been set.
* This is a protocol error.
@@ -2377,11 +2375,11 @@
/*
* Increment the hold count to prevent the structure from being
* freed.
*/
- atomic_add_32(&(imp->ippm_hold_count), 1);
+ atomic_inc_32(&(imp->ippm_hold_count));
rw_exit(ipp_mod_byid_lock);
return (imp);
}
#undef __FN__
@@ -2395,11 +2393,11 @@
* This call means we're done with the pointer so we can drop the
* hold count.
*/
ASSERT(imp->ippm_hold_count != 0);
- atomic_add_32(&(imp->ippm_hold_count), -1);
+ atomic_dec_32(&(imp->ippm_hold_count));
/*
* If the structure has 'destruct pending' set then we tried to free
* it but couldn't, so do it now.
*/
@@ -3069,11 +3067,11 @@
/*
* Increment the hold count to prevent the structure from being
* freed.
*/
- atomic_add_32(&(ap->ippa_hold_count), 1);
+ atomic_inc_32(&(ap->ippa_hold_count));
rw_exit(ipp_action_byid_lock);
return (ap);
}
#undef __FN__
@@ -3087,11 +3085,11 @@
* This call means we're done with the pointer so we can drop the
* hold count.
*/
ASSERT(ap->ippa_hold_count != 0);
- atomic_add_32(&(ap->ippa_hold_count), -1);
+ atomic_dec_32(&(ap->ippa_hold_count));
/*
* If the structure has 'destruct pending' set then we tried to free
* it but couldn't, so do it now.
*/