]> err.no Git - linux-2.6/commitdiff
serial: fix serial_match_port() for dynamic major tty-device numbers
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Fri, 4 Jul 2008 16:59:28 +0000 (09:59 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 4 Jul 2008 17:40:04 +0000 (10:40 -0700)
As reported by Vipul Gandhi, the current serial_match_port() doesn't work
for tty-devices using dynamic major number allocation.  Fix it.

It oopses if you suspend a serial port with _dynamic_ major number.  ATM,
I think, there's only the drivers/serial/jsm/jsm_driver.c driver, that
does it in-tree.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Tested-by: Vipul Gandhi <vcgandhi1@aol.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/serial/serial_core.c

index c9b64e73c9879d10d7bd7e7e4055bd257c083e73..42d2e108b67968406ebc1da8ac8b316d532f578a 100644 (file)
@@ -1991,7 +1991,9 @@ struct uart_match {
 static int serial_match_port(struct device *dev, void *data)
 {
        struct uart_match *match = data;
-       dev_t devt = MKDEV(match->driver->major, match->driver->minor) + match->port->line;
+       struct tty_driver *tty_drv = match->driver->tty_driver;
+       dev_t devt = MKDEV(tty_drv->major, tty_drv->minor_start) +
+               match->port->line;
 
        return dev->devt == devt; /* Actually, only one tty per port */
 }