From: Tejun Heo Date: Thu, 7 Feb 2013 01:31:50 +0000 (+1100) Subject: events: convert to idr_alloc() X-Git-Tag: next-20130218~1^2~94 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=a95481b00909efd0ec130a5147a9adeaec0f10d6;p=karo-tx-linux.git events: convert to idr_alloc() Convert to the much saner new idr interface. Only compile tested. Signed-off-by: Tejun Heo Cc: Peter Zijlstra Cc: Paul Mackerras Cc: Ingo Molnar Cc: Arnaldo Carvalho de Melo Signed-off-by: Andrew Morton --- diff --git a/kernel/events/core.c b/kernel/events/core.c index 5c75791d7269..ab99e41b3b4d 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -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; } }