Commit ab516036 authored by Tejun Heo's avatar Tejun Heo Committed by Linus Torvalds

scsi/lpfc: convert to idr_alloc()

Convert to the much saner new idr interface.
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Acked-by: default avatarJames Smart <james.smart@emulex.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent c9365bd0
...@@ -3165,14 +3165,10 @@ destroy_port(struct lpfc_vport *vport) ...@@ -3165,14 +3165,10 @@ destroy_port(struct lpfc_vport *vport)
int int
lpfc_get_instance(void) lpfc_get_instance(void)
{ {
int instance = 0; int ret;
/* Assign an unused number */ ret = idr_alloc(&lpfc_hba_index, NULL, 0, 0, GFP_KERNEL);
if (!idr_pre_get(&lpfc_hba_index, GFP_KERNEL)) return ret < 0 ? -1 : ret;
return -1;
if (idr_get_new(&lpfc_hba_index, NULL, &instance))
return -1;
return instance;
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment