From patchwork Sun Feb 3 01:20:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tejun Heo X-Patchwork-Id: 2085281 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id B8FF840148 for ; Sun, 3 Feb 2013 01:24:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AB183E6147 for ; Sat, 2 Feb 2013 17:24:20 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pa0-f46.google.com (mail-pa0-f46.google.com [209.85.220.46]) by gabe.freedesktop.org (Postfix) with ESMTP id 4F766E5EC9 for ; Sat, 2 Feb 2013 17:21:53 -0800 (PST) Received: by mail-pa0-f46.google.com with SMTP id kp14so2773367pab.19 for ; Sat, 02 Feb 2013 17:21:53 -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=OJy9ynt31nJzczIrv3Oxd82rU9OUwiGUPaCrnjomNJ8=; b=Y98WVRuDqWeYGVnugE0TgDaqXLyw4mKTg5UXz72kerf1L0T3rNQgZ+JeL+AcpOWEcm dWp7Q4kIH1wS9M7YqrdHLxV3BJeiok6ZoaZHSQLwvaA6lYZEtO1e5NAwttqatqRdyEYD /hz41jgjmOp+GNoSBPB+0A1kVy9djs426kRTupDkhOlXkIdIGZr8ea7U84cRdGZggaPD YsyCWGldA8BDeM0w9jQ2b5PZFGLK280ARELX6Xlzy5hfoRF19DQf6jfihKjdd8q1NA4j Xcu8IsukvrWfUr9Q62ml5nFg2mwxlt+7mNzKmon8iKMWIKUi7QvbjTy+TY+rC0ULLvdN kSkA== X-Received: by 10.68.223.35 with SMTP id qr3mr44535646pbc.27.1359854513101; Sat, 02 Feb 2013 17:21:53 -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 hs2sm13149467pbc.22.2013.02.02.17.21.51 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 02 Feb 2013 17:21:52 -0800 (PST) From: Tejun Heo To: akpm@linux-foundation.org Subject: [PATCH 18/62] drm/sis: convert to idr_alloc() Date: Sat, 2 Feb 2013 17:20:19 -0800 Message-Id: <1359854463-2538-19-git-send-email-tj@kernel.org> X-Mailer: git-send-email 1.8.1 In-Reply-To: <1359854463-2538-1-git-send-email-tj@kernel.org> References: <1359854463-2538-1-git-send-email-tj@kernel.org> Cc: axboe@kernel.dk, skinsbursky@parallels.com, rusty@rustcorp.com.au, jmorris@namei.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, bfields@fieldses.org, ebiederm@xmission.com, Tejun Heo 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 --- This patch depends on an earlier idr changes and I think it would be best to route these together through -mm. Please holler if there's any objection. Thanks. 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);