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

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/dld/dld_str.c
          +++ new/usr/src/uts/common/io/dld/dld_str.c
↓ open down ↓ 596 lines elided ↑ open up ↑
 597  597   */
 598  598  dld_str_t *
 599  599  dld_str_create(queue_t *rq, uint_t type, major_t major, t_uscalar_t style)
 600  600  {
 601  601          dld_str_t       *dsp;
 602  602          int             err;
 603  603  
 604  604          /*
 605  605           * Allocate an object from the cache.
 606  606           */
 607      -        atomic_add_32(&str_count, 1);
      607 +        atomic_inc_32(&str_count);
 608  608          dsp = kmem_cache_alloc(str_cachep, KM_SLEEP);
 609  609  
 610  610          /*
 611  611           * Allocate the dummy mblk for flow-control.
 612  612           */
 613  613          dsp->ds_tx_flow_mp = allocb(1, BPRI_HI);
 614  614          if (dsp->ds_tx_flow_mp == NULL) {
 615  615                  kmem_cache_free(str_cachep, dsp);
 616      -                atomic_add_32(&str_count, -1);
      616 +                atomic_dec_32(&str_count);
 617  617                  return (NULL);
 618  618          }
 619  619          dsp->ds_type = type;
 620  620          dsp->ds_major = major;
 621  621          dsp->ds_style = style;
 622  622  
 623  623          /*
 624  624           * Initialize the queue pointers.
 625  625           */
 626  626          ASSERT(RD(rq) == rq);
↓ open down ↓ 76 lines elided ↑ open up ↑
 703  703                  dsp->ds_tx_flow_mp = NULL;
 704  704          }
 705  705  
 706  706          (void) mod_hash_remove(str_hashp, STR_HASH_KEY(dsp->ds_minor), &val);
 707  707          ASSERT(dsp == (dld_str_t *)val);
 708  708  
 709  709          /*
 710  710           * Free the object back to the cache.
 711  711           */
 712  712          kmem_cache_free(str_cachep, dsp);
 713      -        atomic_add_32(&str_count, -1);
      713 +        atomic_dec_32(&str_count);
 714  714  }
 715  715  
 716  716  /*
 717  717   * kmem_cache contructor function: see kmem_cache_create(9f).
 718  718   */
 719  719  /*ARGSUSED*/
 720  720  static int
 721  721  str_constructor(void *buf, void *cdrarg, int kmflags)
 722  722  {
 723  723          dld_str_t       *dsp = buf;
↓ open down ↓ 1559 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX