]> Pileus Git - ~andy/linux/blobdiff - include/linux/percpu_counter.h
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-next-2.6
[~andy/linux] / include / linux / percpu_counter.h
index 99de7a31bab8c25673f3870959f016f5fa69a324..794662b2be5df175e81ad86840ede63bdf244370 100644 (file)
@@ -26,8 +26,16 @@ struct percpu_counter {
 
 extern int percpu_counter_batch;
 
-int percpu_counter_init(struct percpu_counter *fbc, s64 amount);
-int percpu_counter_init_irq(struct percpu_counter *fbc, s64 amount);
+int __percpu_counter_init(struct percpu_counter *fbc, s64 amount,
+                         struct lock_class_key *key);
+
+#define percpu_counter_init(fbc, value)                                        \
+       ({                                                              \
+               static struct lock_class_key __key;                     \
+                                                                       \
+               __percpu_counter_init(fbc, value, &__key);              \
+       })
+
 void percpu_counter_destroy(struct percpu_counter *fbc);
 void percpu_counter_set(struct percpu_counter *fbc, s64 amount);
 void __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch);
@@ -81,8 +89,6 @@ static inline int percpu_counter_init(struct percpu_counter *fbc, s64 amount)
        return 0;
 }
 
-#define percpu_counter_init_irq percpu_counter_init
-
 static inline void percpu_counter_destroy(struct percpu_counter *fbc)
 {
 }
@@ -92,9 +98,6 @@ static inline void percpu_counter_set(struct percpu_counter *fbc, s64 amount)
        fbc->count = amount;
 }
 
-#define __percpu_counter_add(fbc, amount, batch) \
-       percpu_counter_add(fbc, amount)
-
 static inline void
 percpu_counter_add(struct percpu_counter *fbc, s64 amount)
 {
@@ -103,6 +106,12 @@ percpu_counter_add(struct percpu_counter *fbc, s64 amount)
        preempt_enable();
 }
 
+static inline void
+__percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch)
+{
+       percpu_counter_add(fbc, amount);
+}
+
 static inline s64 percpu_counter_read(struct percpu_counter *fbc)
 {
        return fbc->count;