int err;
        struct mmc_host *host;
 
-       if (!idr_pre_get(&mmc_host_idr, GFP_KERNEL))
-               return NULL;
-
        host = kzalloc(sizeof(struct mmc_host) + extra, GFP_KERNEL);
        if (!host)
                return NULL;
 
        /* scanning will be enabled when we're ready */
        host->rescan_disable = 1;
+       idr_preload(GFP_KERNEL);
        spin_lock(&mmc_host_lock);
-       err = idr_get_new(&mmc_host_idr, host, &host->index);
+       err = idr_alloc(&mmc_host_idr, host, 0, 0, GFP_NOWAIT);
+       if (err >= 0)
+               host->index = err;
        spin_unlock(&mmc_host_lock);
-       if (err)
+       idr_preload_end();
+       if (err < 0)
                goto free;
 
        dev_set_name(&host->class_dev, "mmc%d", host->index);