Skip to content

Commit d06587f

Browse files
author
Lai Jiangshan
committed
scsi/osd: use ida_simple_get()
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
1 parent cdf4e29 commit d06587f

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

drivers/scsi/osd/osd_uld.c

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ static void __remove(struct device *dev)
410410

411411
if (oud->disk)
412412
put_disk(oud->disk);
413-
ida_remove(&osd_minor_ida, oud->minor);
413+
ida_simple_remove(&osd_minor_ida, oud->minor);
414414

415415
kfree(oud);
416416
}
@@ -426,19 +426,12 @@ static int osd_probe(struct device *dev)
426426
if (scsi_device->type != TYPE_OSD)
427427
return -ENODEV;
428428

429-
do {
430-
if (!ida_pre_get(&osd_minor_ida, GFP_KERNEL))
431-
return -ENODEV;
432-
433-
error = ida_get_new(&osd_minor_ida, &minor);
434-
} while (error == -EAGAIN);
435-
436-
if (error)
437-
return error;
438-
if (minor >= SCSI_OSD_MAX_MINOR) {
439-
error = -EBUSY;
440-
goto err_retract_minor;
441-
}
429+
minor = ida_simple_get(&osd_minor_ida, 0, SCSI_OSD_MAX_MINOR,
430+
GFP_KERNEL);
431+
if (minor == -ENOSPC)
432+
return -EBUSY;
433+
else if (minor < 0)
434+
return minor;
442435

443436
error = -ENOMEM;
444437
oud = kzalloc(sizeof(*oud), GFP_KERNEL);
@@ -514,7 +507,7 @@ static int osd_probe(struct device *dev)
514507
dev_set_drvdata(dev, NULL);
515508
kfree(oud);
516509
err_retract_minor:
517-
ida_remove(&osd_minor_ida, minor);
510+
ida_simple_remove(&osd_minor_ida, minor);
518511
return error;
519512
}
520513

0 commit comments

Comments
 (0)