提交 ab516036 编写于 作者: T Tejun Heo 提交者: Linus Torvalds

scsi/lpfc: convert to idr_alloc()

Convert to the much saner new idr interface.
Signed-off-by: NTejun Heo <tj@kernel.org>
Acked-by: NJames Smart <james.smart@emulex.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册