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

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/mac/mac.c
          +++ new/usr/src/uts/common/io/mac/mac.c
↓ open down ↓ 2247 lines elided ↑ open up ↑
2248 2248   * Allocate a minor number.
2249 2249   */
2250 2250  minor_t
2251 2251  mac_minor_hold(boolean_t sleep)
2252 2252  {
2253 2253          minor_t minor;
2254 2254  
2255 2255          /*
2256 2256           * Grab a value from the arena.
2257 2257           */
2258      -        atomic_add_32(&minor_count, 1);
     2258 +        atomic_inc_32(&minor_count);
2259 2259  
2260 2260          if (sleep)
2261 2261                  minor = (uint_t)id_alloc(minor_ids);
2262 2262          else
2263 2263                  minor = (uint_t)id_alloc_nosleep(minor_ids);
2264 2264  
2265 2265          if (minor == 0) {
2266      -                atomic_add_32(&minor_count, -1);
     2266 +                atomic_dec_32(&minor_count);
2267 2267                  return (0);
2268 2268          }
2269 2269  
2270 2270          return (minor);
2271 2271  }
2272 2272  
2273 2273  /*
2274 2274   * Release a previously allocated minor number.
2275 2275   */
2276 2276  void
2277 2277  mac_minor_rele(minor_t minor)
2278 2278  {
2279 2279          /*
2280 2280           * Return the value to the arena.
2281 2281           */
2282 2282          id_free(minor_ids, minor);
2283      -        atomic_add_32(&minor_count, -1);
     2283 +        atomic_dec_32(&minor_count);
2284 2284  }
2285 2285  
2286 2286  uint32_t
2287 2287  mac_no_notification(mac_handle_t mh)
2288 2288  {
2289 2289          mac_impl_t *mip = (mac_impl_t *)mh;
2290 2290  
2291 2291          return (((mip->mi_state_flags & MIS_LEGACY) != 0) ?
2292 2292              mip->mi_capab_legacy.ml_unsup_note : 0);
2293 2293  }
↓ open down ↓ 5596 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX