> Keep track of allocated minors in a bitset rather than abusing
> get_gendisk.
> + spin_lock(&_minor_lock);
> + for (i = 0; i < MAX_DEVICES; i++) {
> + if (!test_bit(i, _minor_bits)) {
> + r = i;
> + set_bit(i, _minor_bits);
> DMWARN("allocating minor = %d", i);
> - return i;
> + break;
> }
> + }
> + spin_unlock(&_minor_lock);
Ugh. See find_first_zero_bit() - no need to reinvent that wheel...
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/