From: Guennadi Liakhovetski Date: Fri, 4 Jul 2008 16:59:28 +0000 (-0700) Subject: serial: fix serial_match_port() for dynamic major tty-device numbers X-Git-Tag: v2.6.26-rc9~53 X-Git-Url: http://www.pilppa.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=7ca796f492a11f9408e661c8f22cd8c4f486b8e5;p=linux-2.6-omap-h63xx.git serial: fix serial_match_port() for dynamic major tty-device numbers 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 Tested-by: Vipul Gandhi Cc: Alan Cox Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c index c9b64e73c98..42d2e108b67 100644 --- a/drivers/serial/serial_core.c +++ b/drivers/serial/serial_core.c @@ -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 */ }