Skip to content

Commit

Permalink
PCI: Use atomic_inc_return() rather than atomic_add_return()
Browse files Browse the repository at this point in the history
No functional change; just use atomic_inc_return() rather than the
general-purpose atomic_add_return().

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
  • Loading branch information
Bjorn Helgaas committed Feb 12, 2013
1 parent fd6dcea commit cc7ba39
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/pci/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -1174,7 +1174,7 @@ static int __pci_enable_device_flags(struct pci_dev *dev,
dev->current_state = (pmcsr & PCI_PM_CTRL_STATE_MASK);
}

if (atomic_add_return(1, &dev->enable_cnt) > 1)
if (atomic_inc_return(&dev->enable_cnt) > 1)
return 0; /* already enabled */

/* only skip sriov related */
Expand Down Expand Up @@ -1404,7 +1404,7 @@ pci_disable_device(struct pci_dev *dev)
dev_WARN_ONCE(&dev->dev, atomic_read(&dev->enable_cnt) <= 0,
"disabling already-disabled device");

if (atomic_sub_return(1, &dev->enable_cnt) != 0)
if (atomic_dec_return(&dev->enable_cnt) != 0)
return;

do_pci_disable_device(dev);
Expand Down

0 comments on commit cc7ba39

Please sign in to comment.