aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/osd/osd_uld.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-08-26 11:48:42 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2018-08-26 11:48:42 -0700
commitaba16dc5cf9318b4e0fe92f8261779cd9f1d2d77 (patch)
tree1f53d2cee40e82efe6a727208307af475327af9a /drivers/scsi/osd/osd_uld.c
parentMerge tag 'gcc-plugins-v4.19-rc1-fix' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux (diff)
parentida: Change ida_get_new_above to return the id (diff)
downloadlinux-dev-aba16dc5cf9318b4e0fe92f8261779cd9f1d2d77.tar.xz
linux-dev-aba16dc5cf9318b4e0fe92f8261779cd9f1d2d77.zip
Merge branch 'ida-4.19' of git://git.infradead.org/users/willy/linux-dax
Pull IDA updates from Matthew Wilcox: "A better IDA API: id = ida_alloc(ida, GFP_xxx); ida_free(ida, id); rather than the cumbersome ida_simple_get(), ida_simple_remove(). The new IDA API is similar to ida_simple_get() but better named. The internal restructuring of the IDA code removes the bitmap preallocation nonsense. I hope the net -200 lines of code is convincing" * 'ida-4.19' of git://git.infradead.org/users/willy/linux-dax: (29 commits) ida: Change ida_get_new_above to return the id ida: Remove old API test_ida: check_ida_destroy and check_ida_alloc test_ida: Convert check_ida_conv to new API test_ida: Move ida_check_max test_ida: Move ida_check_leaf idr-test: Convert ida_check_nomem to new API ida: Start new test_ida module target/iscsi: Allocate session IDs from an IDA iscsi target: fix session creation failure handling drm/vmwgfx: Convert to new IDA API dmaengine: Convert to new IDA API ppc: Convert vas ID allocation to new IDA API media: Convert entity ID allocation to new IDA API ppc: Convert mmu context allocation to new IDA API Convert net_namespace to new IDA API cb710: Convert to new IDA API rsxx: Convert to new IDA API osd: Convert to new IDA API sd: Convert to new IDA API ...
Diffstat (limited to 'drivers/scsi/osd/osd_uld.c')
-rw-r--r--drivers/scsi/osd/osd_uld.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/drivers/scsi/osd/osd_uld.c b/drivers/scsi/osd/osd_uld.c
index 0e56f1eb05dc..eaf36ccf58db 100644
--- a/drivers/scsi/osd/osd_uld.c
+++ b/drivers/scsi/osd/osd_uld.c
@@ -423,19 +423,11 @@ static int osd_probe(struct device *dev)
if (scsi_device->type != TYPE_OSD)
return -ENODEV;
- do {
- if (!ida_pre_get(&osd_minor_ida, GFP_KERNEL))
- return -ENODEV;
-
- error = ida_get_new(&osd_minor_ida, &minor);
- } while (error == -EAGAIN);
-
- if (error)
- return error;
- if (minor >= SCSI_OSD_MAX_MINOR) {
- error = -EBUSY;
- goto err_retract_minor;
- }
+ minor = ida_alloc_max(&osd_minor_ida, SCSI_OSD_MAX_MINOR, GFP_KERNEL);
+ if (minor == -ENOSPC)
+ return -EBUSY;
+ if (minor < 0)
+ return -ENODEV;
error = -ENOMEM;
oud = kzalloc(sizeof(*oud), GFP_KERNEL);
@@ -499,7 +491,7 @@ static int osd_probe(struct device *dev)
err_free_osd:
put_device(&oud->class_dev);
err_retract_minor:
- ida_remove(&osd_minor_ida, minor);
+ ida_free(&osd_minor_ida, minor);
return error;
}
@@ -514,7 +506,7 @@ static int osd_remove(struct device *dev)
}
cdev_device_del(&oud->cdev, &oud->class_dev);
- ida_remove(&osd_minor_ida, oud->minor);
+ ida_free(&osd_minor_ida, oud->minor);
put_device(&oud->class_dev);
return 0;