#endif
};
-static DEFINE_IDR(minors);
+static DEFINE_IDA(minors);
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;
"vibrator%d", vib->minor);
if (IS_ERR(dev)) {
retval = -EINVAL;
- goto err_idr_remove;
+ goto err_ida_remove;
}
vib->dev = dev;
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;
#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);
}