From patchwork Sun Feb 3 01:20:38 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tejun Heo X-Patchwork-Id: 217720 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:4978:20e::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 494452C0092 for ; Sun, 3 Feb 2013 12:23:49 +1100 (EST) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1U1oHw-0005vc-Hx; Sun, 03 Feb 2013 01:22:32 +0000 Received: from mail-pb0-f48.google.com ([209.85.160.48]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1U1oHt-0005v7-Lc for linux-mtd@lists.infradead.org; Sun, 03 Feb 2013 01:22:30 +0000 Received: by mail-pb0-f48.google.com with SMTP id wy12so2686692pbc.7 for ; Sat, 02 Feb 2013 17:22:27 -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=kjRnzUWy3eCSC5ESJCqFcNFsHBJbRMfnWaqirjhGww4=; b=gS8a1cKGnubM9MtPm1FTOrQUkDjr1+CP0lVMEtPa8w4xWNAPtoXmdHN9WJ2hFiZrBo Ltn5BTsoFtuTB1rr5lgEb/gWRaEMktHv9+pouDaMrRJddakSI3DAWKk3/eV3iiYtsW0n eG+Yg1wSTv/xe+ZZgRXgdyWbHrJwag7U1mC9udlbFDAeG+uLWW51YxKOFJI0mO5iaJhv mUFpXOaSwZs+rBOBKya+myKRwS0AEhE1fTy0QTRFs2p0iQGCkHP+aewntmDopsMq0rq1 dew7eaoNyCuKVrx5XDFCUFu0ca2TfNC+D8nBi6JW/JRXGwutRQzKx34rUXI07ybZ6HmB f8uw== X-Received: by 10.66.82.170 with SMTP id j10mr41576648pay.9.1359854547413; Sat, 02 Feb 2013 17:22:27 -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.22.25 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 02 Feb 2013 17:22:26 -0800 (PST) From: Tejun Heo To: akpm@linux-foundation.org Subject: [PATCH 37/62] mtd: convert to idr_alloc() Date: Sat, 2 Feb 2013 17:20:38 -0800 Message-Id: <1359854463-2538-38-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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130202_202229_777823_3F45AE34 X-CRM114-Status: GOOD ( 10.49 ) X-Spam-Score: 0.4 (/) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (0.4 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.160.48 listed in list.dnswl.org] 3.0 KHOP_BIG_TO_CC Sent to 10+ recipients instaed of Bcc or a list 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (htejun[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: axboe@kernel.dk, skinsbursky@parallels.com, rusty@rustcorp.com.au, jmorris@namei.org, linux-kernel@vger.kernel.org, bfields@fieldses.org, linux-mtd@lists.infradead.org, ebiederm@xmission.com, Tejun Heo , David Woodhouse X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Convert to the much saner new idr interface. Only compile tested. Signed-off-by: Tejun Heo Cc: David Woodhouse Cc: linux-mtd@lists.infradead.org Tested-by: Ezequiel Garcia --- 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/mtd/mtdcore.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index ec794a7..61d5f56 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c @@ -349,13 +349,8 @@ int add_mtd_device(struct mtd_info *mtd) BUG_ON(mtd->writesize == 0); mutex_lock(&mtd_table_mutex); - do { - if (!idr_pre_get(&mtd_idr, GFP_KERNEL)) - goto fail_locked; - error = idr_get_new(&mtd_idr, mtd, &i); - } while (error == -EAGAIN); - - if (error) + i = idr_alloc(&mtd_idr, mtd, 0, 0, GFP_KERNEL); + if (i < 0) goto fail_locked; mtd->index = i;