From patchwork Wed Feb 6 19:40:06 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tejun Heo X-Patchwork-Id: 2106971 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id 84635DF2A1 for ; Wed, 6 Feb 2013 19:54:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 69392E5CCA for ; Wed, 6 Feb 2013 11:54:30 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pa0-f50.google.com (mail-pa0-f50.google.com [209.85.220.50]) by gabe.freedesktop.org (Postfix) with ESMTP id A6A71E66A6 for ; Wed, 6 Feb 2013 11:53:35 -0800 (PST) Received: by mail-pa0-f50.google.com with SMTP id fa11so1019973pad.23 for ; Wed, 06 Feb 2013 11:53:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references; bh=84k4f8xMJ5qAB4KBl4qfn4Z2W9yq1418pmiM1kdUotQ=; b=hvL3ah0HDsnKOjDiir4tPJJyk6NYYoWVrJKoh5IBPlCF58XCC0SfKHRbI4mXhJF3yU JBczmD2bAb2cfMUWeSWrT9yHT0hH1Opg3kqTBMFz2veAUrdo/WumGzrVbRv3khF8uMWe Y37knVM9PvqrNGLYTyhZXsO5wKp4XkHG00AZXujWGgQ/vEFMnvnIJzRusZyFPbIMSYsi 03GSx1fh7Oh8W4UDYIllEIXpqTFE0GG1CmcwOz2t08RJ87B0lgy66+917eS45/D2/q7z slv2je2pytH/J9j58THfFpqU0NuWRnKH+09Xep3pBRRD9GOAh8fbjnGBew7b/ZvivFLB DbUA== X-Received: by 10.66.73.105 with SMTP id k9mr78874683pav.37.1360180220037; Wed, 06 Feb 2013 11:50:20 -0800 (PST) Received: from htj.dyndns.org (c-69-181-251-227.hsd1.ca.comcast.net. [69.181.251.227]) by mx.google.com with ESMTPS id l5sm39989590pax.10.2013.02.06.11.50.18 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 06 Feb 2013 11:50:19 -0800 (PST) From: Tejun Heo To: akpm@linux-foundation.org Subject: [PATCH 34/77] drm/sis: convert to idr_alloc() Date: Wed, 6 Feb 2013 11:40:06 -0800 Message-Id: <1360179649-22465-35-git-send-email-tj@kernel.org> X-Mailer: git-send-email 1.8.1 In-Reply-To: <1360179649-22465-1-git-send-email-tj@kernel.org> References: <1360179649-22465-1-git-send-email-tj@kernel.org> Cc: Tejun Heo , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Convert to the much saner new idr interface. Only compile tested. Signed-off-by: Tejun Heo Cc: David Airlie Cc: dri-devel@lists.freedesktop.org --- drivers/gpu/drm/sis/sis_mm.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/sis/sis_mm.c b/drivers/gpu/drm/sis/sis_mm.c index 2b2f78c..9a43d98 100644 --- a/drivers/gpu/drm/sis/sis_mm.c +++ b/drivers/gpu/drm/sis/sis_mm.c @@ -128,17 +128,10 @@ static int sis_drm_alloc(struct drm_device *dev, struct drm_file *file, if (retval) goto fail_alloc; -again: - if (idr_pre_get(&dev_priv->object_idr, GFP_KERNEL) == 0) { - retval = -ENOMEM; - goto fail_idr; - } - - retval = idr_get_new_above(&dev_priv->object_idr, item, 1, &user_key); - if (retval == -EAGAIN) - goto again; - if (retval) + retval = idr_alloc(&dev_priv->object_idr, item, 1, 0, GFP_KERNEL); + if (retval < 0) goto fail_idr; + user_key = retval; list_add(&item->owner_list, &file_priv->obj_list); mutex_unlock(&dev->struct_mutex);