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

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/sys/crypto/impl.h
          +++ new/usr/src/uts/common/sys/crypto/impl.h
↓ open down ↓ 388 lines elided ↑ open up ↑
 389  389          uint_t                  pd_disabled_count;
 390  390          crypto_mech_name_t      *pd_disabled_mechs;
 391  391  } kcf_policy_desc_t;
 392  392  
 393  393  /*
 394  394   * If a component has a reference to a kcf_policy_desc_t,
 395  395   * it REFHOLD()s. A new policy descriptor which is referenced only
 396  396   * by the policy table has a reference count of one.
 397  397   */
 398  398  #define KCF_POLICY_REFHOLD(desc) {              \
 399      -        atomic_add_32(&(desc)->pd_refcnt, 1);   \
      399 +        atomic_inc_32(&(desc)->pd_refcnt);      \
 400  400          ASSERT((desc)->pd_refcnt != 0);         \
 401  401  }
 402  402  
 403  403  /*
 404  404   * Releases a reference to a policy descriptor. When the last
 405  405   * reference is released, the descriptor is freed.
 406  406   */
 407  407  #define KCF_POLICY_REFRELE(desc) {                              \
 408  408          ASSERT((desc)->pd_refcnt != 0);                         \
 409  409          membar_exit();                                          \
 410      -        if (atomic_add_32_nv(&(desc)->pd_refcnt, -1) == 0)      \
      410 +        if (atomic_dec_32_nv(&(desc)->pd_refcnt) == 0)  \
 411  411                  kcf_policy_free_desc(desc);                     \
 412  412  }
 413  413  
 414  414  /*
 415  415   * This entry stores the name of a software module and its
 416  416   * mechanisms.  The mechanisms are 'hints' that are used to
 417  417   * trigger loading of the module.
 418  418   */
 419  419  typedef struct kcf_soft_conf_entry {
 420  420          struct kcf_soft_conf_entry      *ce_next;
↓ open down ↓ 990 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX