[PATCH] powerpc/eeh: atomic_dec_if_positive() to update passthru count

Subsystems: linux for powerpc (32-bit and 64-bit), pci enhanced error handling (eeh) for powerpc, the rest

STALE3955d

2 messages, 2 authors, 2015-10-15 · open the first message on its own page

[PATCH] powerpc/eeh: atomic_dec_if_positive() to update passthru count

From: Gavin Shan <hidden>
Date: 2015-08-27 05:59:29

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 <redacted>
---
 arch/powerpc/kernel/eeh.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c
index af9b597..08a5b70 100644
--- a/arch/powerpc/kernel/eeh.c
+++ b/arch/powerpc/kernel/eeh.c
@@ -1396,8 +1396,7 @@ void eeh_dev_release(struct pci_dev *pdev)
 		goto out;
 
 	/* Decrease PE's pass through count */
-	atomic_dec(&edev->pe->pass_dev_cnt);
-	WARN_ON(atomic_read(&edev->pe->pass_dev_cnt) < 0);
+	WARN_ON(atomic_dec_if_positive(&edev->pe->pass_dev_cnt) < 0);
 	eeh_pe_change_owner(edev->pe);
 out:
 	mutex_unlock(&eeh_dev_mutex);
-- 
2.1.0

Re: powerpc/eeh: atomic_dec_if_positive() to update passthru count

From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2015-10-15 11:10:55

On Thu, 2015-27-08 at 05:58:27 UTC, Gavin Shan wrote:
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 <redacted>
Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/54f9a64a36e4fc041721a954

cheers
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help