]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
events: convert to idr_alloc()
authorTejun Heo <tj@kernel.org>
Thu, 7 Feb 2013 01:31:50 +0000 (12:31 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Mon, 18 Feb 2013 05:47:38 +0000 (16:47 +1100)
Convert to the much saner new idr interface.

Only compile tested.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
kernel/events/core.c

index 5c75791d7269e87c19a86fe711364f2c3c2793f2..ab99e41b3b4de753537338aa7e1c8d071afa84e8 100644 (file)
@@ -5965,13 +5965,9 @@ int perf_pmu_register(struct pmu *pmu, char *name, int type)
        pmu->name = name;
 
        if (type < 0) {
-               int err = idr_pre_get(&pmu_idr, GFP_KERNEL);
-               if (!err)
-                       goto free_pdc;
-
-               err = idr_get_new_above(&pmu_idr, pmu, PERF_TYPE_MAX, &type);
-               if (err) {
-                       ret = err;
+               type = idr_alloc(&pmu_idr, pmu, PERF_TYPE_MAX, 0, GFP_KERNEL);
+               if (type < 0) {
+                       ret = type;
                        goto free_pdc;
                }
        }