X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=lib%2Fpercpu_counter.c;h=b255b939bc1b85bd4fc385df4e1322e9472b2b26;hb=1806f826554efd206cebacc7f9f213c8e6493a5d;hp=a8663890a88c2e358f21b8cdc6f23a8ebb9d77e5;hpb=1f7c14c62ce63805f9574664a6c6de3633d4a354;p=h-e-n diff --git a/lib/percpu_counter.c b/lib/percpu_counter.c index a866389..b255b93 100644 --- a/lib/percpu_counter.c +++ b/lib/percpu_counter.c @@ -62,10 +62,7 @@ s64 __percpu_counter_sum(struct percpu_counter *fbc) for_each_online_cpu(cpu) { s32 *pcount = per_cpu_ptr(fbc->counters, cpu); ret += *pcount; - *pcount = 0; } - fbc->count = ret; - spin_unlock(&fbc->lock); return ret; } @@ -104,13 +101,13 @@ void percpu_counter_destroy(struct percpu_counter *fbc) if (!fbc->counters) return; - free_percpu(fbc->counters); - fbc->counters = NULL; #ifdef CONFIG_HOTPLUG_CPU mutex_lock(&percpu_counters_lock); list_del(&fbc->list); mutex_unlock(&percpu_counters_lock); #endif + free_percpu(fbc->counters); + fbc->counters = NULL; } EXPORT_SYMBOL(percpu_counter_destroy);