From patchwork Fri Dec 13 22:25:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 22456 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qe0-f71.google.com (mail-qe0-f71.google.com [209.85.128.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CA84623FBA for ; Fri, 13 Dec 2013 22:28:31 +0000 (UTC) Received: by mail-qe0-f71.google.com with SMTP id b10sf4604670qen.2 for ; Fri, 13 Dec 2013 14:28:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=mL3BlcWpY9cV+UX0FEb2wKR/7fYC94pXF0YhSr0zgRE=; b=HwO9pzssYTix1s8mNs0NtmwAEhQV1os/Oo7q7xD/M49i8MiuoytM/A9nuqhnDuF0U8 nhdoh3sBmEbbzRVnxDleeaIW4exeD4ci3Km/nMsc0oWJXo3FpG40ZoaWyShjGjrqe+vs RlexcXBgU8HMetxboasfN22yxD4WgUJZ0g5NF+htxMCH9QsCOAmhgzPOzYOYJNjHak2E +2SbEp+mujtvh02j9P3cdU2UgxjHwlfv/S66uTRzQBiQ7omZBQ4kkui2QwDkNvSbh6Ls vB+ubicfy06zuJ9vOtk17ymmu6EbqGhzSCZTU8orrpWUDeOsiPetLkCZiC+EIcHbs8yJ fJhw== X-Gm-Message-State: ALoCoQlxBZX0L2sHOFpjA9e0hH5kJfnn38oIMmqroWfrQFBH12FF1P988VbRDC6YolAdgjSLBm7a X-Received: by 10.236.69.35 with SMTP id m23mr1678760yhd.6.1386973711682; Fri, 13 Dec 2013 14:28:31 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.37.163 with SMTP id z3ls1226435qej.1.gmail; Fri, 13 Dec 2013 14:28:31 -0800 (PST) X-Received: by 10.58.233.2 with SMTP id ts2mr61732vec.78.1386973711583; Fri, 13 Dec 2013 14:28:31 -0800 (PST) Received: from mail-ve0-f173.google.com (mail-ve0-f173.google.com [209.85.128.173]) by mx.google.com with ESMTPS id dj3si1201258vcb.44.2013.12.13.14.28.31 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Dec 2013 14:28:31 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.173 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.173; Received: by mail-ve0-f173.google.com with SMTP id oz11so1832404veb.18 for ; Fri, 13 Dec 2013 14:28:31 -0800 (PST) X-Received: by 10.58.39.97 with SMTP id o1mr2184116vek.15.1386973711517; Fri, 13 Dec 2013 14:28:31 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp73641vcz; Fri, 13 Dec 2013 14:28:31 -0800 (PST) X-Received: by 10.66.123.5 with SMTP id lw5mr5988977pab.83.1386973710743; Fri, 13 Dec 2013 14:28:30 -0800 (PST) Received: from mail-pa0-f43.google.com (mail-pa0-f43.google.com [209.85.220.43]) by mx.google.com with ESMTPS id xu5si2428982pab.225.2013.12.13.14.28.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Dec 2013 14:28:30 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.43 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=209.85.220.43; Received: by mail-pa0-f43.google.com with SMTP id bj1so597366pad.30 for ; Fri, 13 Dec 2013 14:28:30 -0800 (PST) X-Received: by 10.66.149.73 with SMTP id ty9mr6175726pab.36.1386973710316; Fri, 13 Dec 2013 14:28:30 -0800 (PST) Received: from localhost.localdomain (c-67-170-153-23.hsd1.or.comcast.net. [67.170.153.23]) by mx.google.com with ESMTPSA id qz9sm7457908pbc.3.2013.12.13.14.28.28 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Dec 2013 14:28:29 -0800 (PST) From: John Stultz To: LKML Cc: Greg KH , Android Kernel Team , Sumit Semwal , Jesse Barker , Colin Cross , John Stultz Subject: [PATCH 091/115] ion: update idr to avoid deprecated apis Date: Fri, 13 Dec 2013 14:25:05 -0800 Message-Id: <1386973529-4884-92-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1386973529-4884-1-git-send-email-john.stultz@linaro.org> References: <1386973529-4884-1-git-send-email-john.stultz@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: john.stultz@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.173 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Colin Cross Use idr_alloc instead if idr_pre_get/idr_get_new_above, and remove idr_remove_all. Signed-off-by: Colin Cross Signed-off-by: John Stultz --- drivers/staging/android/ion/ion.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c index 8d568ca..199ab9a 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);