Commit 54f9a64a authored by Gavin Shan's avatar Gavin Shan Committed by Michael Ellerman

powerpc/eeh: atomic_dec_if_positive() to update passthru count

No need to have two atomic opertions (update and fetch/check) when
decreasing PE's number of passed devices as one atomic operation
is enough.
Signed-off-by: default avatarGavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 2e1a2556
...@@ -1412,8 +1412,7 @@ void eeh_dev_release(struct pci_dev *pdev) ...@@ -1412,8 +1412,7 @@ void eeh_dev_release(struct pci_dev *pdev)
goto out; goto out;
/* Decrease PE's pass through count */ /* Decrease PE's pass through count */
atomic_dec(&edev->pe->pass_dev_cnt); WARN_ON(atomic_dec_if_positive(&edev->pe->pass_dev_cnt) < 0);
WARN_ON(atomic_read(&edev->pe->pass_dev_cnt) < 0);
eeh_pe_change_owner(edev->pe); eeh_pe_change_owner(edev->pe);
out: out:
mutex_unlock(&eeh_dev_mutex); mutex_unlock(&eeh_dev_mutex);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment