mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
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>
This commit is contained in:
parent
c9d76be696
commit
7b51f47835
2 changed files with 13 additions and 25 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue