summaryrefslogtreecommitdiff
path: root/drivers/staging/greybus/vibrator.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@google.com>2015-05-14 10:39:35 -0700
committerGreg Kroah-Hartman <gregkh@google.com>2015-05-14 13:35:10 -0700
commit6b17492eee00cbaac20b8431e8fa63f137a9ca5c (patch)
tree99f800d19e76876ed66b4a3a95d0d9d45aac4c4e /drivers/staging/greybus/vibrator.c
parent6f8528e0bea76850a153a98e47ad60aecf112801 (diff)
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>
Diffstat (limited to 'drivers/staging/greybus/vibrator.c')
-rw-r--r--drivers/staging/greybus/vibrator.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/staging/greybus/vibrator.c b/drivers/staging/greybus/vibrator.c
index aefd2cd3f18e..20f09bba5fac 100644
--- a/drivers/staging/greybus/vibrator.c
+++ b/drivers/staging/greybus/vibrator.c
@@ -93,7 +93,7 @@ static struct class vibrator_class = {
#endif
};
-static DEFINE_IDR(minors);
+static DEFINE_IDA(minors);
static int gb_vibrator_connection_init(struct gb_connection *connection)
{
@@ -117,7 +117,7 @@ static int gb_vibrator_connection_init(struct gb_connection *connection)
* 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 @@ static int gb_vibrator_connection_init(struct gb_connection *connection)
"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 @@ static int gb_vibrator_connection_init(struct gb_connection *connection)
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 @@ static void gb_vibrator_connection_exit(struct gb_connection *connection)
#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);
}