提交 7ca796f4 编写于 作者: G Guennadi Liakhovetski 提交者: Linus Torvalds

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: NGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Tested-by: NVipul Gandhi <vcgandhi1@aol.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: <stable@kernel.org>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 69d44a18
...@@ -1991,7 +1991,9 @@ struct uart_match { ...@@ -1991,7 +1991,9 @@ struct uart_match {
static int serial_match_port(struct device *dev, void *data) static int serial_match_port(struct device *dev, void *data)
{ {
struct uart_match *match = 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 */ return dev->devt == devt; /* Actually, only one tty per port */
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册