/* See if the device with a specific minor # is free.  */
static int specific_minor(int minor)
/* See if the device with a specific minor # is free.  */
static int specific_minor(int minor)
{
	int r, m;
	if (minor >= (1 << MINORBITS))
		return -EINVAL;
	r = idr_pre_get(&_minor_idr, GFP_KERNEL);
	if (!r)
		return -ENOMEM;
	spin_lock(&_minor_lock);
	if (idr_find(&_minor_idr, minor)) {
		r = -EBUSY;
		goto out;
	}
	r = idr_get_new_above(&_minor_idr, MINOR_ALLOCED, minor, &m);
	if (r)
		goto out;
	if (m != minor) {
		idr_remove(&_minor_idr, m);
		r = -EBUSY;
		goto out;
	}
out:
	spin_unlock(&_minor_lock);
	return r;
}