From patchwork Sun Feb 3 01:20:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tejun Heo X-Patchwork-Id: 2085411 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 E10193FD2B for ; Sun, 3 Feb 2013 01:25:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D0918E6147 for ; Sat, 2 Feb 2013 17:25:07 -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 49FC2E5F7F for ; Sat, 2 Feb 2013 17:21:55 -0800 (PST) Received: by mail-pa0-f50.google.com with SMTP id fa11so228816pad.23 for ; Sat, 02 Feb 2013 17:21:55 -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=r0lLu798PaAuaM4+7rA84CX2lY+QHvlpW0EwSIxT/xw=; b=Qs4tGibRC5tJybtc+UCiPyaCOML8bZjKj8wcYtHcSIHsj88PArX1bRc7d47G07P9Xq 0eyEhSAINjtLYmdn6JnH6KKxvEO2aA3Y3cPatHybUNWLkRHSGqRQUvhivmQmnYtpqbz6 828+zWYDuD/dGXEVQ1ExP4pCL83+9GcydIJVs5WRZFrp3MzOm+DbMRhQZOyRvOp6req4 PK2FIx3B9WnuaqBkUkty/L3JrdA0CQ9RWS22BD5sd2HjE3aFDgqyqnCDe8jhdZ6GA3VS 5uFF0E/iiRWEs/HKHHIg41m722QR4pGqKiMpkJvAZMO30BKfFIgVrG7drC6p87ma6oG3 5qww== X-Received: by 10.68.241.103 with SMTP id wh7mr44267487pbc.153.1359854514769; Sat, 02 Feb 2013 17:21:54 -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.53 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 02 Feb 2013 17:21:54 -0800 (PST) From: Tejun Heo To: akpm@linux-foundation.org Subject: [PATCH 19/62] drm/via: convert to idr_alloc() Date: Sat, 2 Feb 2013 17:20:20 -0800 Message-Id: <1359854463-2538-20-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/via/via_mm.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/via/via_mm.c b/drivers/gpu/drm/via/via_mm.c index 0d55432..0ab93ff 100644 --- a/drivers/gpu/drm/via/via_mm.c +++ b/drivers/gpu/drm/via/via_mm.c @@ -148,17 +148,10 @@ int via_mem_alloc(struct drm_device *dev, void *data, 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);