Re: [PATCH 2/2] RFC: chrdev: allocate chardevs in all unused holes

From: Linus Torvalds
Date: Sat Feb 20 2016 - 16:36:17 EST


On Fri, Feb 19, 2016 at 6:36 AM, Linus Walleij <linus.walleij@xxxxxxxxxx> wrote:
> This is a duct-tape-and-chewing-gum solution to the problem with
> the major numbers running out when allocating major numbers
> dynamically.

Ugh. This is too ugly to live.

Can't you do something with a simple bitmap, and just pre-allocate the
fixed numbers? Allocate new major numbers using find_next_zero_bit()
or something..

I can't imagine that we couldn't do something prettier in less code
than that too-disgusting-to-live free_majors[] array..

Linus