Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Gavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

authored by

Gavin Shan and committed by
Michael Ellerman
54f9a64a 2e1a2556

+1 -2
+1 -2
arch/powerpc/kernel/eeh.c
··· 1412 1412 goto out; 1413 1413 1414 1414 /* Decrease PE's pass through count */ 1415 - atomic_dec(&edev->pe->pass_dev_cnt); 1416 - WARN_ON(atomic_read(&edev->pe->pass_dev_cnt) < 0); 1415 + WARN_ON(atomic_dec_if_positive(&edev->pe->pass_dev_cnt) < 0); 1417 1416 eeh_pe_change_owner(edev->pe); 1418 1417 out: 1419 1418 mutex_unlock(&eeh_dev_mutex);