tools headers UAPI: Sync openat2.h with the kernel sources
[linux-2.6-microblaze.git] / lib / percpu_counter.c
index a2345de..00f666d 100644 (file)
@@ -17,7 +17,7 @@ static DEFINE_SPINLOCK(percpu_counters_lock);
 
 #ifdef CONFIG_DEBUG_OBJECTS_PERCPU_COUNTER
 
-static struct debug_obj_descr percpu_counter_debug_descr;
+static const struct debug_obj_descr percpu_counter_debug_descr;
 
 static bool percpu_counter_fixup_free(void *addr, enum debug_obj_state state)
 {
@@ -33,7 +33,7 @@ static bool percpu_counter_fixup_free(void *addr, enum debug_obj_state state)
        }
 }
 
-static struct debug_obj_descr percpu_counter_debug_descr = {
+static const struct debug_obj_descr percpu_counter_debug_descr = {
        .name           = "percpu_counter",
        .fixup_free     = percpu_counter_fixup_free,
 };
@@ -85,7 +85,7 @@ void percpu_counter_add_batch(struct percpu_counter *fbc, s64 amount, s32 batch)
 
        preempt_disable();
        count = __this_cpu_read(*fbc->counters) + amount;
-       if (count >= batch || count <= -batch) {
+       if (abs(count) >= batch) {
                unsigned long flags;
                raw_spin_lock_irqsave(&fbc->lock, flags);
                fbc->count += count;