From patchwork Wed Feb 6 19:40:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tejun Heo X-Patchwork-Id: 2106911 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 EFFEADF2A1 for ; Wed, 6 Feb 2013 19:53:01 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CF9FCE6392 for ; Wed, 6 Feb 2013 11:53:01 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-oa0-f43.google.com (mail-oa0-f43.google.com [209.85.219.43]) by gabe.freedesktop.org (Postfix) with ESMTP id 18A20E625B for ; Wed, 6 Feb 2013 11:50:22 -0800 (PST) Received: by mail-oa0-f43.google.com with SMTP id l10so1949983oag.30 for ; Wed, 06 Feb 2013 11:50:21 -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=5wiuHHZqas43KOzAXnPrt1tbwBww9v/iN1sh490VK/c=; b=Ynqfnr8OmiVmWR9+uGyh9j9zimX4/GbI0G8cfanP40j8rJqwxgkhp3baGeX74rVRky 2XyRmcoO9swhaDeoXSLGX/AXbPX/AWoVjkS1fXoxUE1KB3lga5GBwWjtbinFFnd3RaID q2NUmRWBos6UDsSeubjYgb4c9pP1Pk/dUR62asJnhXw36xDgYGRC1N7SkgPCFWoHpVeA LJhuUmsJjo9XbAkEfhKaX2q13kUzAn5qtNSG2hDlso5Ub5a7xRZKn+hlUIvqbT0rFmjX Ksbtx2Qmaj6DHRzpFtCibuqRbPFcb8kN18UGIwAnHcjNfJh53ZskVMxBkmcgmO5H3XRH thZQ== X-Received: by 10.60.4.35 with SMTP id h3mr23723451oeh.123.1360180221701; Wed, 06 Feb 2013 11:50:21 -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.20 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 06 Feb 2013 11:50:21 -0800 (PST) From: Tejun Heo To: akpm@linux-foundation.org Subject: [PATCH 35/77] drm/via: convert to idr_alloc() Date: Wed, 6 Feb 2013 11:40:07 -0800 Message-Id: <1360179649-22465-36-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/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);