]> rtime.felk.cvut.cz Git - lincan.git/blobdiff - lincan/include/can_queue.h
Makefile.rules and atomic CMPXCHG handling update to support 2.6.33 kernel.
[lincan.git] / lincan / include / can_queue.h
index 00ac94c5960775a30dcdf584be524fb543ce7734..bf9486d01ca79769f8776db835f37d40591a1fd2 100644 (file)
@@ -646,11 +646,13 @@ void canque_edge_decref(struct canque_edge_t *edge)
                if(x<=1)
                        return __canque_edge_decref(edge);
                y=x;
+           #ifdef CAN_HAVE_ATOMIC_CMPXCHG
+               atomic_cmpxchg(&edge->edge_used, x, x-1);
+           #else /* workaround for case that atomic_cmpxchg is not defined */
                /* This code strongly depends on the definition of atomic_t !!!! */
-               /* x=cmpxchg(&edge->edge_used, x, x-1); */
-               /* Next alternative could be more portable */
                x=__cmpxchg(&edge->edge_used, x, x-1, sizeof(atomic_t));
                /* If even this does not help, comment out CAN_HAVE_ARCH_CMPXCHG in can_sysdep.h */
+           #endif
        } while(x!=y);
 }
 #endif