• Logan Gunthorpe's avatar
    char_dev: order /proc/devices by major number · 8a932f73
    Logan Gunthorpe authored
    Presently, the order of the char devices listed in /proc/devices is not
    entirely sequential. If a char device has a major number greater than
    CHRDEV_MAJOR_HASH_SIZE (255), it will be ordered as if its major were
    module 255. For example, 511 appears after 1.
    
    This patch cleans that up and prints each major number in the correct
    order, regardless of where they are stored in the hash table.
    
    In order to do this, we introduce CHRDEV_MAJOR_MAX as an artificial
    limit (chosen to be 511). It will then print all devices in major
    order number from 0 to the maximum.
    Signed-off-by: default avatarLogan Gunthorpe <logang@deltatee.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Cc: Alan Cox <alan@linux.intel.com>
    Cc: Arnd Bergmann <arnd@arndb.de>
    Cc: Linus Walleij <linus.walleij@linaro.org>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    8a932f73
devices.c 1.37 KB