]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
scsi/lpfc: convert to idr_alloc()
authorTejun Heo <tj@kernel.org>
Wed, 20 Feb 2013 02:16:24 +0000 (13:16 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 20 Feb 2013 05:53:52 +0000 (16:53 +1100)
Convert to the much saner new idr interface.

Only compile tested.

Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: James Smart <james.smart@emulex.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
drivers/scsi/lpfc/lpfc_init.c

index 26ca2efa976e4654f8df87d89dcea52d1091bb27..314b4f61b9e3fc73035fbdf48995e34bb31ed4dc 100644 (file)
@@ -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;
 }
 
 /**