diff options
author | Colin Cross <ccross@android.com> | 2013-09-19 14:54:56 -0500 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2013-12-12 15:27:03 -0800 |
commit | acd77fc7d05a80e7ae39e64e1a3948487e2255ff (patch) | |
tree | 5997e8506c0dc0dc130c5661e52df19136af019a | |
parent | 5c31b87cef4e03eea5b417a6e3f7c9b781aacf96 (diff) |
ion: update idr to avoid deprecated apis
Use idr_alloc instead if idr_pre_get/idr_get_new_above, and
remove idr_remove_all.
Change-Id: I675b789879549bd3767ed3ef2016cf108eb622d2
Signed-off-by: Colin Cross <ccross@android.com>
-rw-r--r-- | drivers/staging/android/ion/ion.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c index 4d19716cabd..80c79455c36 100644 --- a/drivers/staging/android/ion/ion.c +++ b/drivers/staging/android/ion/ion.c @@ -432,22 +432,16 @@ static bool ion_handle_validate(struct ion_client *client, struct ion_handle *ha static int ion_handle_add(struct ion_client *client, struct ion_handle *handle) { - int rc; + int id; struct rb_node **p = &client->handles.rb_node; struct rb_node *parent = NULL; struct ion_handle *entry; - do { - int id; - rc = idr_pre_get(&client->idr, GFP_KERNEL); - if (!rc) - return -ENOMEM; - rc = idr_get_new_above(&client->idr, handle, 1, &id); - handle->id = id; - } while (rc == -EAGAIN); + id = idr_alloc(&client->idr, handle, 1, 0, GFP_KERNEL); + if (id < 0) + return id; - if (rc < 0) - return rc; + handle->id = id; while (*p) { parent = *p; @@ -786,7 +780,6 @@ void ion_client_destroy(struct ion_client *client) ion_handle_destroy(&handle->ref); } - idr_remove_all(&client->idr); idr_destroy(&client->idr); down_write(&dev->lock); |