From: Tejun Heo Date: Wed, 20 Feb 2013 02:16:24 +0000 (+1100) Subject: scsi/lpfc: convert to idr_alloc() X-Git-Tag: next-20130220~1^2~131 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=09cb13d650ae3a878fd0776fba769ebcdf7868a2;p=karo-tx-linux.git scsi/lpfc: convert to idr_alloc() Convert to the much saner new idr interface. Only compile tested. Signed-off-by: Tejun Heo Acked-by: James Smart Cc: James Bottomley Signed-off-by: Andrew Morton --- diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 26ca2efa976e..314b4f61b9e3 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; } /**