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

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/os/devcfg.c
          +++ new/usr/src/uts/common/os/devcfg.c
↓ open down ↓ 1604 lines elided ↑ open up ↑
1605 1605                           * If node is retired and persistent, then prevent
1606 1606                           * attach. We can't do this for non-persistent nodes
1607 1607                           * as we would lose evidence that the node existed.
1608 1608                           */
1609 1609                          if (i_ddi_check_retire(dip) == 1 &&
1610 1610                              ndi_dev_is_persistent_node(dip) &&
1611 1611                              retire_prevents_attach == 1) {
1612 1612                                  rv = DDI_FAILURE;
1613 1613                                  break;
1614 1614                          }
1615      -                        atomic_add_long(&devinfo_attach_detach, 1);
     1615 +                        atomic_inc_ulong(&devinfo_attach_detach);
1616 1616                          if ((rv = attach_node(dip)) == DDI_SUCCESS)
1617 1617                                  i_ddi_set_node_state(dip, DS_ATTACHED);
1618      -                        atomic_add_long(&devinfo_attach_detach, -1);
     1618 +                        atomic_dec_ulong(&devinfo_attach_detach);
1619 1619                          break;
1620 1620                  case DS_ATTACHED:
1621 1621                          if ((rv = postattach_node(dip)) == DDI_SUCCESS)
1622 1622                                  i_ddi_set_node_state(dip, DS_READY);
1623 1623                          break;
1624 1624                  case DS_READY:
1625 1625                          break;
1626 1626                  default:
1627 1627                          /* should never reach here */
1628 1628                          ASSERT("unknown devinfo state");
↓ open down ↓ 45 lines elided ↑ open up ↑
1674 1674                          break;
1675 1675                  case DS_INITIALIZED:
1676 1676                          if ((rv = uninit_node(dip)) == DDI_SUCCESS)
1677 1677                                  i_ddi_set_node_state(dip, DS_BOUND);
1678 1678                          break;
1679 1679                  case DS_PROBED:
1680 1680                          if ((rv = unprobe_node(dip)) == DDI_SUCCESS)
1681 1681                                  i_ddi_set_node_state(dip, DS_INITIALIZED);
1682 1682                          break;
1683 1683                  case DS_ATTACHED:
1684      -                        atomic_add_long(&devinfo_attach_detach, 1);
     1684 +                        atomic_inc_ulong(&devinfo_attach_detach);
1685 1685  
1686 1686                          mutex_enter(&(DEVI(dip)->devi_lock));
1687 1687                          DEVI_SET_DETACHING(dip);
1688 1688                          mutex_exit(&(DEVI(dip)->devi_lock));
1689 1689  
1690 1690                          membar_enter(); /* ensure visibility for hold_devi */
1691 1691  
1692 1692                          if ((rv = detach_node(dip, flag)) == DDI_SUCCESS)
1693 1693                                  i_ddi_set_node_state(dip, DS_PROBED);
1694 1694  
1695 1695                          mutex_enter(&(DEVI(dip)->devi_lock));
1696 1696                          DEVI_CLR_DETACHING(dip);
1697 1697                          mutex_exit(&(DEVI(dip)->devi_lock));
1698 1698  
1699      -                        atomic_add_long(&devinfo_attach_detach, -1);
     1699 +                        atomic_dec_ulong(&devinfo_attach_detach);
1700 1700                          break;
1701 1701                  case DS_READY:
1702 1702                          if ((rv = predetach_node(dip, flag)) == DDI_SUCCESS)
1703 1703                                  i_ddi_set_node_state(dip, DS_ATTACHED);
1704 1704                          break;
1705 1705                  default:
1706 1706                          ASSERT("unknown devinfo state");
1707 1707                  }
1708 1708          }
1709 1709          da_log_enter(dip);
↓ open down ↓ 7486 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX