From: Tejun Heo Date: Thu, 28 Feb 2013 01:04:44 +0000 (-0800) Subject: scsi/lpfc: convert to idr_alloc() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ab51603672a335d325963ca410d9c527d9f834f7;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git scsi/lpfc: convert to idr_alloc() Convert to the much saner new idr interface. Signed-off-by: Tejun Heo Acked-by: James Smart Cc: James Bottomley Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 89ad55807012..7de4ef14698f 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -3165,14 +3165,10 @@ destroy_port(struct lpfc_vport *vport) int lpfc_get_instance(void) { - int instance = 0; - - /* Assign an unused number */ - if (!idr_pre_get(&lpfc_hba_index, GFP_KERNEL)) - return -1; - if (idr_get_new(&lpfc_hba_index, NULL, &instance)) - return -1; - return instance; + int ret; + + ret = idr_alloc(&lpfc_hba_index, NULL, 0, 0, GFP_KERNEL); + return ret < 0 ? -1 : ret; } /**