diff options
author | Tejun Heo <tj@kernel.org> | 2013-02-27 20:04:32 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-27 22:10:17 -0500 |
commit | 803d9e043dc31ea2d26442618f0eb020550f8e08 (patch) | |
tree | 288f26ce885d39e7f3ee1cf8c7504a6a336d70eb /drivers/mmc/core/host.c | |
parent | 57f2667cc7ebf69bd5fdb26f132228d331766ea8 (diff) |
mmc: convert to idr_alloc()
Convert to the much saner new idr interface.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Chris Ball <cjb@laptop.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/mmc/core/host.c')
-rw-r--r-- | drivers/mmc/core/host.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c index 821cd8224137..2a3593d9f87d 100644 --- a/drivers/mmc/core/host.c +++ b/drivers/mmc/core/host.c | |||
@@ -429,19 +429,20 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev) | |||
429 | int err; | 429 | int err; |
430 | struct mmc_host *host; | 430 | struct mmc_host *host; |
431 | 431 | ||
432 | if (!idr_pre_get(&mmc_host_idr, GFP_KERNEL)) | ||
433 | return NULL; | ||
434 | |||
435 | host = kzalloc(sizeof(struct mmc_host) + extra, GFP_KERNEL); | 432 | host = kzalloc(sizeof(struct mmc_host) + extra, GFP_KERNEL); |
436 | if (!host) | 433 | if (!host) |
437 | return NULL; | 434 | return NULL; |
438 | 435 | ||
439 | /* scanning will be enabled when we're ready */ | 436 | /* scanning will be enabled when we're ready */ |
440 | host->rescan_disable = 1; | 437 | host->rescan_disable = 1; |
438 | idr_preload(GFP_KERNEL); | ||
441 | spin_lock(&mmc_host_lock); | 439 | spin_lock(&mmc_host_lock); |
442 | err = idr_get_new(&mmc_host_idr, host, &host->index); | 440 | err = idr_alloc(&mmc_host_idr, host, 0, 0, GFP_NOWAIT); |
441 | if (err >= 0) | ||
442 | host->index = err; | ||
443 | spin_unlock(&mmc_host_lock); | 443 | spin_unlock(&mmc_host_lock); |
444 | if (err) | 444 | idr_preload_end(); |
445 | if (err < 0) | ||
445 | goto free; | 446 | goto free; |
446 | 447 | ||
447 | dev_set_name(&host->class_dev, "mmc%d", host->index); | 448 | dev_set_name(&host->class_dev, "mmc%d", host->index); |