diff options
author | Tejun Heo <tj@kernel.org> | 2013-02-27 17:04:28 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-27 19:10:17 -0800 |
commit | 7b51f47835f61d9ee6273908b774a0f569e99646 (patch) | |
tree | 88eb8561b44342f5531b459eabd17f0a2d99647d /drivers/memstick/core/mspro_block.c | |
parent | c9d76be696bbb76ba1081d2b0fc0086f449788da (diff) | |
download | op-kernel-dev-7b51f47835f61d9ee6273908b774a0f569e99646.zip op-kernel-dev-7b51f47835f61d9ee6273908b774a0f569e99646.tar.gz |
memstick: convert to idr_alloc()
Convert to the much saner new idr interface.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Alex Dubov <oakad@yahoo.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/memstick/core/mspro_block.c')
-rw-r--r-- | drivers/memstick/core/mspro_block.c | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/drivers/memstick/core/mspro_block.c b/drivers/memstick/core/mspro_block.c index 9729b92..f12b78d 100644 --- a/drivers/memstick/core/mspro_block.c +++ b/drivers/memstick/core/mspro_block.c @@ -1213,21 +1213,10 @@ static int mspro_block_init_disk(struct memstick_dev *card) msb->page_size = be16_to_cpu(sys_info->unit_size); mutex_lock(&mspro_block_disk_lock); - if (!idr_pre_get(&mspro_block_disk_idr, GFP_KERNEL)) { - mutex_unlock(&mspro_block_disk_lock); - return -ENOMEM; - } - - rc = idr_get_new(&mspro_block_disk_idr, card, &disk_id); + disk_id = idr_alloc(&mspro_block_disk_idr, card, 0, 256, GFP_KERNEL); mutex_unlock(&mspro_block_disk_lock); - - if (rc) - return rc; - - if ((disk_id << MSPRO_BLOCK_PART_SHIFT) > 255) { - rc = -ENOSPC; - goto out_release_id; - } + if (disk_id < 0) + return disk_id; msb->disk = alloc_disk(1 << MSPRO_BLOCK_PART_SHIFT); if (!msb->disk) { |