greybus: vibrator: convert idr to be an ida
All we need is a simple ida, so use that interface instead of the more
"complex" idr one. Bonus is we don't need to fix the locking issue I
forgot about when using an idr, as ida has one built-in.
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Reviewed-by: Alex Elder <elder@linaro.org>
diff --git a/drivers/staging/greybus/vibrator.c b/drivers/staging/greybus/vibrator.c
index aefd2cd..20f09bb 100644
--- a/drivers/staging/greybus/vibrator.c
+++ b/drivers/staging/greybus/vibrator.c
@@ -93,7 +93,7 @@
#endif
};
-static DEFINE_IDR(minors);
+static DEFINE_IDA(minors);
static int gb_vibrator_connection_init(struct gb_connection *connection)
{
@@ -117,7 +117,7 @@
* there is a "real" device somewhere in the kernel for this, but I
* can't find it at the moment...
*/
- vib->minor = idr_alloc(&minors, vib, 0, 0, GFP_KERNEL);
+ vib->minor = ida_simple_get(&minors, 0, 0, GFP_KERNEL);
if (vib->minor < 0) {
retval = vib->minor;
goto error;
@@ -126,7 +126,7 @@
"vibrator%d", vib->minor);
if (IS_ERR(dev)) {
retval = -EINVAL;
- goto err_idr_remove;
+ goto err_ida_remove;
}
vib->dev = dev;
@@ -139,14 +139,14 @@
retval = sysfs_create_group(&dev->kobj, vibrator_groups[0]);
if (retval) {
device_unregister(dev);
- goto err_idr_remove;
+ goto err_ida_remove;
}
#endif
return 0;
-err_idr_remove:
- idr_remove(&minors, vib->minor);
+err_ida_remove:
+ ida_simple_remove(&minors, vib->minor);
error:
kfree(vib);
return retval;
@@ -159,7 +159,7 @@
#if LINUX_VERSION_CODE <= KERNEL_VERSION(3,11,0)
sysfs_remove_group(&vib->dev->kobj, vibrator_groups[0]);
#endif
- idr_remove(&minors, vib->minor);
+ ida_simple_remove(&minors, vib->minor);
device_unregister(vib->dev);
kfree(vib);
}