public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH 37/62] mtd: convert to idr_alloc()
       [not found] <1359854463-2538-1-git-send-email-tj@kernel.org>
@ 2013-02-03  1:20 ` Tejun Heo
  2013-02-04 13:09   ` Ezequiel Garcia
  0 siblings, 1 reply; 2+ messages in thread
From: Tejun Heo @ 2013-02-03  1:20 UTC (permalink / raw)
  To: akpm
  Cc: axboe, skinsbursky, rusty, jmorris, linux-kernel, bfields,
	linux-mtd, ebiederm, Tejun Heo, David Woodhouse

Convert to the much saner new idr interface.

Only compile tested.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: linux-mtd@lists.infradead.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/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;
-- 
1.8.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 37/62] mtd: convert to idr_alloc()
  2013-02-03  1:20 ` [PATCH 37/62] mtd: convert to idr_alloc() Tejun Heo
@ 2013-02-04 13:09   ` Ezequiel Garcia
  0 siblings, 0 replies; 2+ messages in thread
From: Ezequiel Garcia @ 2013-02-04 13:09 UTC (permalink / raw)
  To: Tejun Heo
  Cc: axboe, skinsbursky, rusty, jmorris, linux-kernel, bfields,
	linux-mtd, ebiederm, akpm, David Woodhouse

On Sat, Feb 02, 2013 at 05:20:38PM -0800, Tejun Heo wrote:
> Convert to the much saner new idr interface.
> 
> Only compile tested.
> 

Tested-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>

-- 
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-02-04 13:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1359854463-2538-1-git-send-email-tj@kernel.org>
2013-02-03  1:20 ` [PATCH 37/62] mtd: convert to idr_alloc() Tejun Heo
2013-02-04 13:09   ` Ezequiel Garcia

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox