Skip to contentSkip to conversation

atomic_read()

PATCH New Mitchell Blank Jr 1 participant 1 message Sep 22, 2003 Atomic infrastructure

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 atomic_read()

A patch was recently accepted into the main 2.6 tree that makes skb_cloned() and skb_shared() take a "const" pointer. These functions call atomic_read() so it needs to take a const pointer too. After some discussion on netdev davem said that this should be safe (even in the pessimal case of a spinlock-implemented atomic_t we should be able to read its value outside the lock safely)

PA-RISC uses an inline fucntion for atomic_read() but it doesn't mark its argument as const, so without this patch you'll start seeing lots of new compile warnings.

Please apply. The patch is versus a week ago but the file hasn't changed so it should apply fine. It isn't compile tested but it shouldn't cause any problems.

-Mitch

include/asm-parisc/atomic.h +1 -1
@@ -154,7 +154,7 @@
 	SPIN_UNLOCK_IRQRESTORE(ATOMIC_HASH(v), flags);
 }
 
-static __inline__ int __atomic_read(atomic_t *v)
+static __inline__ int __atomic_read(const atomic_t *v)
 {
 	return v->counter;
 }