tidspbridge: convert to idr_alloc()
authorTejun Heo <tj@kernel.org>
Wed, 13 Mar 2013 21:59:41 +0000 (14:59 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 13 Mar 2013 22:21:47 +0000 (15:21 -0700)
commit8e467e855ca5ed2921f290655f96ac40d5dc571c
tree32a7e3f92cb0ca41732b0b7d66ffb03952254b53
parenta37c3010002322f40fe668162a237aa99aac42d1
tidspbridge: convert to idr_alloc()

idr_get_new*() and friends are about to be deprecated.  Convert to the
new idr_alloc() interface.

There are some peculiarities and possible bugs in the converted
functions.  This patch preserves those.

* drv_insert_node_res_element() returns -ENOMEM on alloc failure,
  -EFAULT if id space is exhausted.  -EFAULT is at best misleading.

* drv_proc_insert_strm_res_element() is even weirder.  It returns
  -EFAULT if kzalloc() fails, -ENOMEM if idr preloading fails and
  -EPERM if id space is exhausted.  What's going on here?

* drv_proc_insert_strm_res_element() doesn't free *pstrm_res after
  failure.

Only compile tested.

Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
Cc: Rene Sapiens <rene.sapiens@ti.com>
Cc: Armando Uribe <x0095078@ti.com>
Cc: Omar Ramirez Luna <omar.ramirez@ti.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/staging/tidspbridge/rmgr/drv.c