• Andrew Morton's avatar
    [PATCH] dev_t [2/3] - remove MAX_CHRDEV · 826d245f
    Andrew Morton authored
    Patch from Andries.Brouwer@cwi.nl
    
    The actual patch for today is this part.  I already quoted most of this on
    the list earlier this week.
    
    In order not to have to change all drivers, I did
    
    +int register_chrdev(unsigned int major, const char *name,
    +                   struct file_operations *fops)
    +{
    +       return register_chrdev_region(major, 0, 256, name, fops);
    +}
    
    so that the old register_chrdev registers a single major and 256 minors.
    Later this can be changed (but see my letter to Al last week).
    
    The only driver that is tricky is the tty driver.  Here some major cleanup
    happened - all tty specific stuff disappeared from char_dev.c, and tty uses
    the actual register_chrdev_region() call.
    
    There is a race in register_chrdev_region() that I did not worry about: when
    two dynamic majors 0 are registered simultaneously, one of them will be first
    and the other one gets -EBUSY.  If this is a problem, the code there will
    have to be uglified a little.  I didn't do that because it disappears again
    in a subsequent patch.
    826d245f
tty_io.c 59.1 KB