aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/serial_core.c
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2008-07-04 12:59:28 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-04 13:40:04 -0400
commit7ca796f492a11f9408e661c8f22cd8c4f486b8e5 (patch)
tree4b4e7fd0017a227c98b72a04c28a66ed5720c3fe /drivers/serial/serial_core.c
parent69d44a1835ec8163a82c4ee57367f87ae0f85c2e (diff)
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 <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>
Diffstat (limited to 'drivers/serial/serial_core.c')
-rw-r--r--drivers/serial/serial_core.c4
1 files changed, 3 insertions, 1 deletions
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 {
1991static int serial_match_port(struct device *dev, void *data) 1991static int serial_match_port(struct device *dev, void *data)
1992{ 1992{
1993 struct uart_match *match = data; 1993 struct uart_match *match = data;
1994 dev_t devt = MKDEV(match->driver->major, match->driver->minor) + match->port->line; 1994 struct tty_driver *tty_drv = match->driver->tty_driver;
1995 dev_t devt = MKDEV(tty_drv->major, tty_drv->minor_start) +
1996 match->port->line;
1995 1997
1996 return dev->devt == devt; /* Actually, only one tty per port */ 1998 return dev->devt == devt; /* Actually, only one tty per port */
1997} 1999}