diff options
author | David S. Miller <davem@davemloft.net> | 2008-10-13 05:45:26 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-13 12:51:44 -0400 |
commit | 8440838bc5337243917f13bc14ea2445da5e0197 (patch) | |
tree | 175af8fd7d678073a9794248132b606fb536c887 /drivers/serial | |
parent | a7be18d436f0c7007794965e5af29fa1ffff1e05 (diff) |
serial: fix device name reporting when minor space is shared between drivers
The multiple drivers share the minor space occupied by a particular major
number, the actual index within the device name's space is indicated by
the tty_driver->name_base + uart_port->line
Another usable formula is (uart_driver->minor - MINOR_BASE) + port->line
Use those to print the device names properly in such situations in
serial_core.c and 8250.c
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/serial')
-rw-r--r-- | drivers/serial/8250.c | 22 | ||||
-rw-r--r-- | drivers/serial/serial_core.c | 7 |
2 files changed, 20 insertions, 9 deletions
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c index db2cdc103c88..d4104a3bbe87 100644 --- a/drivers/serial/8250.c +++ b/drivers/serial/8250.c | |||
@@ -57,6 +57,13 @@ static unsigned int share_irqs = SERIAL8250_SHARE_IRQS; | |||
57 | 57 | ||
58 | static unsigned int nr_uarts = CONFIG_SERIAL_8250_RUNTIME_UARTS; | 58 | static unsigned int nr_uarts = CONFIG_SERIAL_8250_RUNTIME_UARTS; |
59 | 59 | ||
60 | static struct uart_driver serial8250_reg; | ||
61 | |||
62 | static int serial_index(struct uart_port *port) | ||
63 | { | ||
64 | return (serial8250_reg.minor - 64) + port->line; | ||
65 | } | ||
66 | |||
60 | /* | 67 | /* |
61 | * Debugging. | 68 | * Debugging. |
62 | */ | 69 | */ |
@@ -997,7 +1004,7 @@ static void autoconfig(struct uart_8250_port *up, unsigned int probeflags) | |||
997 | return; | 1004 | return; |
998 | 1005 | ||
999 | DEBUG_AUTOCONF("ttyS%d: autoconf (0x%04x, 0x%p): ", | 1006 | DEBUG_AUTOCONF("ttyS%d: autoconf (0x%04x, 0x%p): ", |
1000 | up->port.line, up->port.iobase, up->port.membase); | 1007 | serial_index(&up->port), up->port.iobase, up->port.membase); |
1001 | 1008 | ||
1002 | /* | 1009 | /* |
1003 | * We really do need global IRQs disabled here - we're going to | 1010 | * We really do need global IRQs disabled here - we're going to |
@@ -1132,8 +1139,8 @@ static void autoconfig(struct uart_8250_port *up, unsigned int probeflags) | |||
1132 | if (up->capabilities != uart_config[up->port.type].flags) { | 1139 | if (up->capabilities != uart_config[up->port.type].flags) { |
1133 | printk(KERN_WARNING | 1140 | printk(KERN_WARNING |
1134 | "ttyS%d: detected caps %08x should be %08x\n", | 1141 | "ttyS%d: detected caps %08x should be %08x\n", |
1135 | up->port.line, up->capabilities, | 1142 | serial_index(&up->port), up->capabilities, |
1136 | uart_config[up->port.type].flags); | 1143 | uart_config[up->port.type].flags); |
1137 | } | 1144 | } |
1138 | 1145 | ||
1139 | up->port.fifosize = uart_config[up->port.type].fifo_size; | 1146 | up->port.fifosize = uart_config[up->port.type].fifo_size; |
@@ -1857,7 +1864,8 @@ static int serial8250_startup(struct uart_port *port) | |||
1857 | */ | 1864 | */ |
1858 | if (!(up->port.flags & UPF_BUGGY_UART) && | 1865 | if (!(up->port.flags & UPF_BUGGY_UART) && |
1859 | (serial_inp(up, UART_LSR) == 0xff)) { | 1866 | (serial_inp(up, UART_LSR) == 0xff)) { |
1860 | printk("ttyS%d: LSR safety check engaged!\n", up->port.line); | 1867 | printk(KERN_INFO "ttyS%d: LSR safety check engaged!\n", |
1868 | serial_index(&up->port)); | ||
1861 | return -ENODEV; | 1869 | return -ENODEV; |
1862 | } | 1870 | } |
1863 | 1871 | ||
@@ -1912,7 +1920,8 @@ static int serial8250_startup(struct uart_port *port) | |||
1912 | */ | 1920 | */ |
1913 | if (!(iir1 & UART_IIR_NO_INT) && (iir & UART_IIR_NO_INT)) { | 1921 | if (!(iir1 & UART_IIR_NO_INT) && (iir & UART_IIR_NO_INT)) { |
1914 | up->bugs |= UART_BUG_THRE; | 1922 | up->bugs |= UART_BUG_THRE; |
1915 | pr_debug("ttyS%d - using backup timer\n", port->line); | 1923 | pr_debug("ttyS%d - using backup timer\n", |
1924 | serial_index(port)); | ||
1916 | } | 1925 | } |
1917 | } | 1926 | } |
1918 | 1927 | ||
@@ -1972,7 +1981,7 @@ static int serial8250_startup(struct uart_port *port) | |||
1972 | if (!(up->bugs & UART_BUG_TXEN)) { | 1981 | if (!(up->bugs & UART_BUG_TXEN)) { |
1973 | up->bugs |= UART_BUG_TXEN; | 1982 | up->bugs |= UART_BUG_TXEN; |
1974 | pr_debug("ttyS%d - enabling bad tx status workarounds\n", | 1983 | pr_debug("ttyS%d - enabling bad tx status workarounds\n", |
1975 | port->line); | 1984 | serial_index(port)); |
1976 | } | 1985 | } |
1977 | } else { | 1986 | } else { |
1978 | up->bugs &= ~UART_BUG_TXEN; | 1987 | up->bugs &= ~UART_BUG_TXEN; |
@@ -2633,7 +2642,6 @@ static int serial8250_console_early_setup(void) | |||
2633 | return serial8250_find_port_for_earlycon(); | 2642 | return serial8250_find_port_for_earlycon(); |
2634 | } | 2643 | } |
2635 | 2644 | ||
2636 | static struct uart_driver serial8250_reg; | ||
2637 | static struct console serial8250_console = { | 2645 | static struct console serial8250_console = { |
2638 | .name = "ttyS", | 2646 | .name = "ttyS", |
2639 | .write = serial8250_console_write, | 2647 | .write = serial8250_console_write, |
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c index 308588e2072b..6bdf3362e3b1 100644 --- a/drivers/serial/serial_core.c +++ b/drivers/serial/serial_core.c | |||
@@ -2051,7 +2051,8 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *port) | |||
2051 | "transmitter\n", | 2051 | "transmitter\n", |
2052 | port->dev ? port->dev->bus_id : "", | 2052 | port->dev ? port->dev->bus_id : "", |
2053 | port->dev ? ": " : "", | 2053 | port->dev ? ": " : "", |
2054 | drv->dev_name, port->line); | 2054 | drv->dev_name, |
2055 | drv->tty_driver->name_base + port->line); | ||
2055 | 2056 | ||
2056 | ops->shutdown(port); | 2057 | ops->shutdown(port); |
2057 | } | 2058 | } |
@@ -2176,7 +2177,9 @@ uart_report_port(struct uart_driver *drv, struct uart_port *port) | |||
2176 | printk(KERN_INFO "%s%s%s%d at %s (irq = %d) is a %s\n", | 2177 | printk(KERN_INFO "%s%s%s%d at %s (irq = %d) is a %s\n", |
2177 | port->dev ? port->dev->bus_id : "", | 2178 | port->dev ? port->dev->bus_id : "", |
2178 | port->dev ? ": " : "", | 2179 | port->dev ? ": " : "", |
2179 | drv->dev_name, port->line, address, port->irq, uart_type(port)); | 2180 | drv->dev_name, |
2181 | drv->tty_driver->name_base + port->line, | ||
2182 | address, port->irq, uart_type(port)); | ||
2180 | } | 2183 | } |
2181 | 2184 | ||
2182 | static void | 2185 | static void |