BNX2X: Fixes atomic_cmpxchg spatch

The spatch was wrong.  Linux returns the old value on success and appears to
return the current value on failure.  No sense spatching that.
diff --git a/kern/drivers/net/bnx2x/akaros_compat.h b/kern/drivers/net/bnx2x/akaros_compat.h
index d0c18a2..925d4cb 100644
--- a/kern/drivers/net/bnx2x/akaros_compat.h
+++ b/kern/drivers/net/bnx2x/akaros_compat.h
@@ -42,6 +42,16 @@
 #define RCU_INIT_POINTER(dst, src) rcu_assign_pointer(dst, src)
 #define synchronize_rcu()
 
+#define atomic_cmpxchg(_addr, _old, _new)                                      \
+({                                                                             \
+	typeof(_old) _ret;                                                         \
+	if (atomic_cas((_addr), (_old), (_new)))                                   \
+		_ret = _old;                                                           \
+	else                                                                       \
+		_ret = atomic_read(_addr);                                             \
+	_ret;                                                                      \
+})
+
 #define unlikely(x) (x)
 #define likely(x) (x)
 #define UINT_MAX UINT64_MAX
diff --git a/kern/drivers/net/bnx2x/bnx2x_sp.c b/kern/drivers/net/bnx2x/bnx2x_sp.c
index 0c941c1..6ef4834 100644
--- a/kern/drivers/net/bnx2x/bnx2x_sp.c
+++ b/kern/drivers/net/bnx2x/bnx2x_sp.c
@@ -3718,7 +3718,7 @@
 		if (unlikely(c + a >= u))
 			return false;
 
-		old = atomic_cas((v), c, c + a);
+		old = atomic_cmpxchg((v), c, c + a);
 		if (likely(old == c))
 			break;
 		c = old;
@@ -3746,7 +3746,7 @@
 		if (unlikely(c - a < u))
 			return false;
 
-		old = atomic_cas((v), c, c - a);
+		old = atomic_cmpxchg((v), c, c - a);
 		if (likely(old == c))
 			break;
 		c = old;
diff --git a/scripts/spatch/linux/sync.cocci b/scripts/spatch/linux/sync.cocci
index 09f1797..93efcae 100644
--- a/scripts/spatch/linux/sync.cocci
+++ b/scripts/spatch/linux/sync.cocci
@@ -50,11 +50,3 @@
 @@
 -atomic_add(AMT, VARP)
 +atomic_add(VARP, AMT)
-
-@@
-expression VARP;
-expression OLD;
-expression NEW;
-@@
--atomic_cmpxchg(VARP, OLD, NEW)
-+atomic_cas(VARP, OLD, NEW)