The unicode font map for the virtual console is a 32x32x64 table which
allocates rows dynamically as entries are added. The unicode value
increases sequentially and should count all entries even in empty
rows. The defect is when copying the unicode font map in con_set_unimap(),
the unicode value is not incremented properly. The wrong unicode value
is entered in the new font map.
Linus Walleij [Tue, 13 Mar 2012 12:27:23 +0000 (13:27 +0100)]
serial: PL011: clear pending interrupts
Chanho Min reported that when the boot loader transfers
control to the kernel, there may be pending interrupts
causing the UART to lock up in an eternal loop trying to
pick tokens from the FIFO (since the RX interrupt flag
indicates there are tokens) while in practice there are
no tokens - in fact there is only a pending IRQ flag.
This patch address the issue with a combination of two
patches suggested by Russell King that clears and mask
all interrupts at probe() and clears any pending error
and RX interrupts at port startup time.
We suspect the spurious interrupts are a side-effect of
switching the UART from FIFO to non-FIFO mode.
Cc: Shreshtha Kumar Sahu <shreshthakumar.sahu@stericsson.com> Reported-by: Chanho Min <chanho0207@gmail.com> Suggested-by: Russell King <linux@arm.linux.org.uk> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Jong-Sung Kim <neidhard.kim@lge.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sonic Zhang [Tue, 13 Mar 2012 07:51:55 +0000 (15:51 +0800)]
serial: bfin-uart: Don't access tty circular buffer in TX DMA interrupt after it is reset.
When kernel reboot, tty circular buffer is reset before last TX DMA interrupt is called,
while the buffer tail is updated in TX DMA interrupt handler. So, don't update the buffer
tail if it is reset.
Signed-off-by: Sonic Zhang <sonic.zhang@analog.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Wolfram Sang [Sun, 11 Mar 2012 14:02:38 +0000 (15:02 +0100)]
tty: serial: vt8500: fix annotations for probe/remove
Fixes:
WARNING: drivers/tty/serial/built-in.o(.data+0x30): Section mismatch in reference from the variable vt8500_platform_driver to the function .init.text:vt8500_serial_probe()
The variable vt8500_platform_driver references
the function __init vt8500_serial_probe()
And mark the remove pointer while we are here.
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Paul Gortmaker [Fri, 9 Mar 2012 00:12:14 +0000 (19:12 -0500)]
serial: remove back and forth conversions in serial_out_sync
The two callers to serial_out_sync() have a struct port right
there in scope, but then pass in a struct 8250_port which then
is locally resolved back to a struct port.
Delete the needless back and forth and just pass in the struct
port directly. Rename the function to have "_port" in its
name, so the name <--> args relationship is consistent with the
other serial_in/out vs serial_port_in/out function classes.
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Acked-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Paul Gortmaker [Fri, 9 Mar 2012 00:12:13 +0000 (19:12 -0500)]
serial: use serial_port_in/out vs serial_in/out in 8250
The serial_in and serial_out helpers are expecting to operate
on an 8250_port struct. These in turn go after the contained
normal port struct which actually has the actual in/out accessors.
But what is happening in some cases, is that a function is passed
in a port struct, and it runs container_of to get the 8250_port
struct, and then it uses serial_in/out helpers on that. But when
you do, it goes full circle, since it jumps back inside the 8250_port
to find the contained port struct (which we already knew!).
So, if we are operating in a scope where we know the struct port,
then use the serial_port_in/out helpers and avoid the bouncing
around. If we don't have the struct port handy, and it isn't
worth making a local for it, then just leave things as-is which
uses the serial_in/out helpers that will resolve the 8250_port
onto the struct port.
Mostly, gcc figures this out on its own -- so this doesn't bring to
the table any revolutionary runtime delta. However, it is somewhat
misleading to always hammer away on 8250 structs, when the actual
underlying property isn't at all 8250 specific -- and this change
makes that clear.
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Acked-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Paul Gortmaker [Fri, 9 Mar 2012 00:12:12 +0000 (19:12 -0500)]
serial: introduce generic port in/out helpers
Looking at the existing serial drivers (esp. the 8250 derived
variants) we see a common trend. They create a hardware specific
port struct, which in turn contains a generic serial_port struct.
The other trend, is that they all create some sort of shortcut
to go through the hardware specific struct, to the serial_port
struct, which has the basic in/out operations within. Looking
for the serial_in and serial_out in several drivers shows this.
Rather than let this continue, lets create a generic set of
similar helper wrappers that can be used on a struct port, so
we can eliminate bouncing out through hardware specific struct
pointers just to come back into struct port where possible.
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Acked-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Paul Gortmaker [Fri, 9 Mar 2012 00:12:11 +0000 (19:12 -0500)]
serial: reduce number of indirections in 8250 code
The serial_8250_port struct contains within a serial_port struct
and many times one or the other, or both are in scope within
functions via a passed in arg, or via container_of.
However there are a lot of cases where we have access directly
to the port pointer, but yet go through the parent 8250_port
structure instead to get it. These should just use the port
struct directly.
Similarly there are cases where it makes sense (from a code
cleanliness point of view) to declare a local for the port
struct, so we aren't going through the parent 8250_port struct
repeatedly to get to it.
We get a small reduction in text size, but it appears that
gcc was smart enough to internally be doing most of this
already, so the readability improvement is the larger gain.
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Acked-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Paul Gortmaker [Fri, 9 Mar 2012 00:12:10 +0000 (19:12 -0500)]
serial: delete useless void casts in 8250.c
These might have worked some magic with an ancient gcc back in
1992, but "objdump --disassemble" on gcc 4.6 on x86-64 shows
identical output before and after this commit. Send the casts
and their hysterical rasins to the bitbucket.
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Acked-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Paul Gortmaker [Fri, 9 Mar 2012 00:12:09 +0000 (19:12 -0500)]
serial: make 8250's serial_in shareable to other drivers.
Currently 8250.c has serial_in and serial_out as shortcuts
to doing the port I/O. They are implemented as macros a
ways down in the file. This isn't by accident, but is
implicitly required, so cpp doesn't mangle other instances
of the common string "serial_in", as it exists as a field
in the port struct itself.
The above mangling avoidance violates the principle of least
surprise, and it also prevents the shortcuts from being
relocated up to the top of file, or into 8250.h -- either
being a better location than the current one.
Move them to 8250.h so other 8250-like drivers can also use
the shortcuts, and in the process, make the conflicting
names go away by using static inlines instead of macros.
The object file size remains unchanged with this modification.
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Acked-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Paul Gortmaker [Fri, 9 Mar 2012 00:12:08 +0000 (19:12 -0500)]
serial: delete last unused traces of pausing I/O in 8250
This is the last traces of pausing I/O that we had back some
twenty years ago. Probably was only required for 8MHz ISA
cards running "on the edge" at 12MHz. Anyway it hasn't been
in use for years, so lets just bury it for good.
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Acked-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Darren Hart [Fri, 9 Mar 2012 17:51:50 +0000 (09:51 -0800)]
pch_uart: Add user_uartclk parameter
For cases where boards with non-default clocks are not yet added to the kernel
or when the clock varies across hardware revisions, it is useful to be
able to specify the UART clock on the kernel command line.
Add the user_uartclk parameter and prefer it, if set, to the default and
board specific UART clock settings. Specify user_uartclock on the command-line
with "pch_uart.user_uartclk=48000000".
Signed-off-by: Darren Hart <dvhart@linux.intel.com> CC: Tomoya MORINAGA <tomoya.rohm@gmail.com> CC: Feng Tang <feng.tang@intel.com> CC: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Darren Hart [Fri, 9 Mar 2012 17:51:49 +0000 (09:51 -0800)]
pch_uart: Add Fish River Island II uart clock quirks
Add support for the Fish River Island II (FRI2) UART clock following the CM-iTC
quirk handling mechanism. Depending on the firmware installed on the device, the
FRI2 uses a 48MHz or a 64MHz UART clock. This is detected with DMI strings.
Add similar UART clock quirk handling to the pch_console_setup() function to
enable kernel messages on boards with non-standard UART clocks.
Per Alan's suggestion, abstract out UART clock selection into
pch_uart_get_uartclk() to avoid code duplication.
Signed-off-by: Darren Hart <dvhart@linux.intel.com> CC: Tomoya MORINAGA <tomoya.rohm@gmail.com> CC: Feng Tang <feng.tang@intel.com> CC: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Darren Hart [Fri, 9 Mar 2012 17:51:48 +0000 (09:51 -0800)]
pch_uart: Use uartclk instead of base_baud
The term "base baud" refers to the fastest baud rate the device can communicate
at. This is clock/16. pch_uart is using base_baud as the clock itself. Rename
the variables to be semantically correct.
Signed-off-by: Darren Hart <dvhart@linux.intel.com> CC: Tomoya MORINAGA <tomoya.rohm@gmail.com> CC: Feng Tang <feng.tang@intel.com> CC: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Frank Benkert [Mon, 5 Mar 2012 15:14:29 +0000 (16:14 +0100)]
mpc5200b/uart: select more tolerant uart prescaler on low baudrates
In addition to the /32 prescaler, the MPC5200B supports a second
baudrate prescaler /4 to reach higher baudrates.
The current calculation (introduced with commit 0d1f22e4) in the kernel
preferes this low prescaler as often as possible, but with some
imprecise counterparts the communication on low baudrates fails.
According a support-mail from freescale the low prescaler (/4) allows
just 1% tolerance in bittiming in contrast to 4% of the high prescaler
(/32). The prescaler not only affects the baudrate-calculation, but
also the sampling of the bits on the wire.
With this patch, we use the slightly less precise, but higher tolerant
prescaler calculation on low baudrates up to (and including) 115200 baud
and the more precise calculation above.
Tested on a custom MPC5200B board with "fsl,mpc5200b-psc-uart".
Calculation Examples with prescaler (PS) 4 and 32 and divisor (DIV) on
various baudrates. Real stands for the real baudrate generated and Diff
for the differences between:
50 Baud PS 32 DIV 0xa122 Real 50 Diff 0.00%
75 Baud PS 32 DIV 0x6b6c Real 75 Diff 0.00%
110 Baud PS 32 DIV 0x493e Real 110 Diff 0.00%
134 Baud PS 32 DIV 0x3c20 Real 133 Diff 0.75%
150 Baud PS 32 DIV 0x35b6 Real 150 Diff 0.00%
200 Baud PS 32 DIV 0x2849 Real 199 Diff 0.50%
300 Baud PS 4 DIV 0xd6d8 Real 300 Diff 0.00%
PS 32 DIV 0x1adb Real 300 Diff 0.00%
600 Baud PS 4 DIV 0x6b6c Real 600 Diff 0.00%
PS 32 DIV 0x0d6e Real 599 Diff 0.17%
1200 Baud PS 4 DIV 0x35b6 Real 1200 Diff 0.00%
PS 32 DIV 0x06b7 Real 1199 Diff 0.08%
1800 Baud PS 4 DIV 0x23cf Real 1799 Diff 0.06%
PS 32 DIV 0x047a Real 1799 Diff 0.06%
2400 Baud PS 4 DIV 0x1adb Real 2400 Diff 0.00%
PS 32 DIV 0x035b Real 2401 Diff - 0.04%
4800 Baud PS 4 DIV 0x0d6e Real 4799 Diff 0.02%
PS 32 DIV 0x01ae Real 4796 Diff 0.08%
9600 Baud PS 4 DIV 0x06b7 Real 9598 Diff 0.02%
PS 32 DIV 0x00d7 Real 9593 Diff 0.07%
19200 Baud PS 4 DIV 0x035b Real 19208 Diff - 0.04%
PS 32 DIV 0x006b Real 19275 Diff - 0.39%
38400 Baud PS 4 DIV 0x01ae Real 38372 Diff 0.07%
PS 32 DIV 0x0036 Real 38194 Diff 0.54%
57600 Baud PS 4 DIV 0x011e Real 57692 Diff - 0.16%
PS 32 DIV 0x0024 Real 57291 Diff 0.54%
76800 Baud PS 4 DIV 0x00d7 Real 76744 Diff 0.07%
PS 32 DIV 0x001b Real 76388 Diff 0.54%
115200 Baud PS 4 DIV 0x008f Real 115384 Diff - 0.16%
PS 32 DIV 0x0012 Real 114583 Diff 0.54%
153600 Baud PS 4 DIV 0x006b Real 154205 Diff - 0.39%
PS 32 DIV 0x000d Real 158653 Diff - 3.29%
230400 Baud PS 4 DIV 0x0048 Real 229166 Diff 0.54%
PS 32 DIV 0x0009 Real 229166 Diff 0.54%
307200 Baud PS 4 DIV 0x0036 Real 305555 Diff 0.54%
PS 32 DIV 0x0007 Real 294642 Diff 4.09%
460800 Baud PS 4 DIV 0x0024 Real 458333 Diff 0.54%
PS 32 DIV 0x0005 Real 412500 Diff 10.48%
500000 Baud PS 4 DIV 0x0021 Real 500000 Diff 0.00%
PS 32 DIV 0x0004 Real 515625 Diff - 3.13%
576000 Baud PS 4 DIV 0x001d Real 568965 Diff 1.22%
PS 32 DIV 0x0004 Real 515625 Diff 10.48%
614400 Baud PS 4 DIV 0x001b Real 611111 Diff 0.54%
PS 32 DIV 0x0003 Real 687500 Diff -11.90%
921600 Baud PS 4 DIV 0x0012 Real 916666 Diff 0.54%
PS 32 DIV 0x0002 Real 1031250 Diff -11.90% 1000000 Baud PS 4 DIV 0x0011 Real 970588 Diff 2.94%
PS 32 DIV 0x0002 Real 1031250 Diff - 3.13% 1152000 Baud PS 4 DIV 0x000e Real 1178571 Diff - 2.31%
PS 32 DIV 0x0002 Real 1031250 Diff 10.48% 1500000 Baud PS 4 DIV 0x000b Real 1500000 Diff 0.00%
PS 32 DIV 0x0001 Real 2062500 Diff -37.50% 2000000 Baud PS 4 DIV 0x0008 Real 2062500 Diff - 3.13%
PS 32 DIV 0x0001 Real 2062500 Diff - 3.13% 2500000 Baud PS 4 DIV 0x0007 Real 2357142 Diff 5.71%
PS 32 DIV 0x0001 Real 2062500 Diff 17.50% 3000000 Baud PS 4 DIV 0x0006 Real 2750000 Diff 8.33%
PS 32 DIV 0x0001 Real 2062500 Diff 31.25% 3500000 Baud PS 4 DIV 0x0005 Real 3300000 Diff 5.71%
PS 32 DIV 0x0001 Real 2062500 Diff 41.07% 4000000 Baud PS 4 DIV 0x0004 Real 4125000 Diff - 3.13%
PS 32 DIV 0x0001 Real 2062500 Diff 48.44%
Signed-off-by: Frank Benkert <frank.benkert@avat.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Dan Carpenter [Wed, 7 Mar 2012 10:05:00 +0000 (13:05 +0300)]
tty: moxa: fix bit test in moxa_start()
This is supposed to be doing a shift before the comparison instead of
just doing a bitwise AND directly. The current code means the start()
just returns without doing anything.
Jiri Slaby [Mon, 5 Mar 2012 13:52:55 +0000 (14:52 +0100)]
TTY: isdn/gigaset, use tty_port
Let us port the code to use tty_port. We now use open_count and tty
from there. This allows us also to use tty_port_tty_set with tty
refcounting instead of hand-written locking and logic.
Note that tty and open_count are no longer protected by cs->lock. It is
protected by tty_port->lock. But since all the places where they were
used are now switched to the helpers, we are fine.
Jiri Slaby [Mon, 5 Mar 2012 13:52:54 +0000 (14:52 +0100)]
TTY: isdn/gigaset, do not set tty->driver_data to NULL
Close the window in open where driver_data is reset to NULL on each
open. It could cause other processes to get invalid retval from the
tty->ops operations because of the checks all over the code.
With this change we may do other cleanups. Now, the only valid check
for tty->driver_data != NULL is in close. This can happen only if open
fails at gigaset_get_cs_by_tty or try_module_get. The rest of checks
in various tty->ops->* are invalid as driver_data cannot be NULL
there. The same holds for cs->open_count. So remove them.
Jiri Slaby [Mon, 5 Mar 2012 13:52:53 +0000 (14:52 +0100)]
TTY: pdc_cons, use tty_port
Instead of digging a tty out of the tty_driver struct, which is not
defined to work, use tty_port properly. This includes proper tty
refcounting even though there is no possible race currently. But we
will need tty_port for tty buffers in the future anyway.
Jiri Slaby [Mon, 5 Mar 2012 13:52:50 +0000 (14:52 +0100)]
TTY: pdc_cons, fix racy tty test
The tty->count test in the timer was racy. Let's remove the test and
properly delete the timer and wait for the body to finish using _sync
version of del_timer.
Jiri Slaby [Mon, 5 Mar 2012 13:52:48 +0000 (14:52 +0100)]
TTY: amiserial, use tty_port_close_end
Hmm, the code was sleeping with interrupts disabled. This was not
good. Fix this by turning interrupts at an appropriate place. (The
race is protected by CLOSING flag.)
After the move, the code is identical to tty_port_close_end, so use
it!
Jiri Slaby [Mon, 5 Mar 2012 13:52:46 +0000 (14:52 +0100)]
TTY: amiserial, provide carrier helpers
This is a preparation for a switch to tty_port_block_til_ready. We
need amiga_carrier_raised and amiga_dtr_rts. The implementation is
taken from startup, shutdown and current block_til_ready.
Jiri Slaby [Mon, 5 Mar 2012 13:52:45 +0000 (14:52 +0100)]
TTY: amiserial no longer needs serialP
amiserial is the last user of serialP.h. Let's move struct
serial_state directly to amiserial and remove serialP crap from
includes. Finally, remove the header from the tree completely.
Jiri Slaby [Mon, 5 Mar 2012 13:52:42 +0000 (14:52 +0100)]
TTY: simserial, final cleanup
* remove pointless checks (tty cannot be NULL at that points)
* fix some printks (use __func__, print text directly w/o using global
strings)
* remove some empty lines
This is the last patch for simserial. Overall, the driver is 400 lines
shorter. Being now at 560 lines.
Jiri Slaby [Mon, 5 Mar 2012 13:52:37 +0000 (14:52 +0100)]
TTY: simserial, use tty_port_open
So now we convert startup to be ->activate of tty_port. This means we
no longer care about INITIALIZED and TTY_IO_ERROR flags.
After we have ->activate much of the code may go as it duplicates what
tty_port_open does. In this case tty_port_open adds block_til_ready to
the path. But we do not define carrier hooks, so it is a noop.
Jiri Slaby [Mon, 5 Mar 2012 13:52:28 +0000 (14:52 +0100)]
TTY: simserial, remove static initialization
We do not use any of the preinitialized rs_state members for something
real. So there is no need to initialize them. At the places we used
them for printing, just print the values.
And since only one port is supported, get rid of the loop. This
simplifies simrs_init a heap. Thus we can handle fail paths in a
standard way without panicing.
Jiri Slaby [Mon, 5 Mar 2012 13:52:23 +0000 (14:52 +0100)]
TTY: simserial, pass tty down to functions
This avoids pain with tty refcounting and touching tty_port in the
future. It allows us to remove some state->tty tests because the tty
passed down to them can never be NULL.
Jiri Slaby [Mon, 5 Mar 2012 13:52:22 +0000 (14:52 +0100)]
TTY: amiserial, pass tty down to functions
This avoids pain with tty refcounting and touching tty_port in the
future. It allows us to remove some info->tty tests because the tty
passed down to them can never be NULL.
Jiri Slaby [Mon, 5 Mar 2012 13:52:21 +0000 (14:52 +0100)]
TTY: amiserial, simplify set_serial_info
Do not copy whole serial_state. We only need to know whether the speed
is to be changed. Hence store the info in advance and use it later.
A simple bool is enough.
Also remove reduntant assignments and move the tests directly to the
'if'.
Jiri Slaby [Mon, 5 Mar 2012 13:52:20 +0000 (14:52 +0100)]
TTY: serialP, merge serial_state and async_struct
This is the final step to get rid of the one of the structures. A
further cleanup will follow. And I struct serial_state deserves cease
to exist after a switch to tty_port too.
While changing the lines, it removes also pointless tty->driver_data
casts.
Jiri Slaby [Mon, 5 Mar 2012 13:52:17 +0000 (14:52 +0100)]
TTY: simserial, remove support of shared interrupts
It never worked there. The ISR was never written for that kind of
stuff. So remove all that crap with a hash of linked lists and pass
the pointer directly to the ISR.
BTW this answers the question there:
* I don't know exactly why they don't use the dev_id opaque data
* pointer instead of this extra lookup table
-> Because they thought they will support more devices bound to a
single interrupt w/o IRQF_SHARED. They would need exactly the hash
there.
What I don't understand is rebinding of the interrupt in the shutdown
path. They perhaps meant to do just synchronize_irq? In any case, this
is all gone and free_irq there properly.
By removing the hash we save some bits (exactly NR_IRQS * 8 bytes of
.bss and over a kilo of .text):
before:
text data bss dec hex filename
19600 320 8227 28147 6df3 ../a/ia64/arch/ia64/hp/sim/simserial.o
after:
text data bss dec hex filename
18568 320 28 18916 49e4 ../a/ia64/arch/ia64/hp/sim/simserial.o
Note that a shared interrupt could not work too. request_irq requires
data parameter to be non-NULL. So the whole IRQ_T exercise was
pointless.
Finally, this helps us remove another two members of async_struct :).
Jiri Slaby [Thu, 8 Mar 2012 20:01:19 +0000 (21:01 +0100)]
simserial, bail out when request_irq fails
Without this, the code succeeds when the port is opened by root and we
get unwanted interrupts storm on the first key stroke.
Instead of that, tell the user we failed and that we won't continue. I
suppose, the code was copied from the serial layer where we may want
to change the irq number, so we must allow open even of the failing
port. This is not the case for this driver at all.
Jiri Slaby [Thu, 8 Mar 2012 20:01:18 +0000 (21:01 +0100)]
hpsim, initialize chip for assigned irqs
Currently, when assign_irq_vector is called and the irq connected in
the simulator, the irq is not ready. request_irq will return ENOSYS
immediately. It is because the irq chip is unset.
Hence set the chip properly to irq_type_hp_sim. And make sure this is
done from both users of simulated interrupts.
Also we have to set handler here, otherwise we end up in
handle_bad_int resulting in spam in logs and no irqs handled. We use
handle_simple_irq as these are SW interrupts that need no ACK or
anything.
Jiri Slaby [Thu, 8 Mar 2012 20:01:16 +0000 (21:01 +0100)]
hpsim, fix SAL handling in fw-emu
The switch-cases of SAL_FREQ_BASE generate non-relocatable code. The
same as for the ifs one level upper. This causes oopses early in boot
because the kernel jumps to the hell instead of the offset in sal
callback.
So use ifs here for SAL_FREQ_BASE decision too.
Isn't there any compiler directive or settings to solve that cleanly?
Jiri Slaby [Mon, 5 Mar 2012 13:52:12 +0000 (14:52 +0100)]
TTY: serialP, remove unused material
First, remove unused macro and rs_multiport_struct structure. Nobody
uses them at all.
Further, the 2 drivers (they are below) which use the rest of
structures from serialP.h (async_struct and serial_state) do not use
all the members. Remove the members:
* which are unused or
* which are only initialized and never used for something real.
Everybody should avoid the structures with a looong distance.
Finally, remove the ALPHA kludge MCR quirks. They are 1:1 copy from
8250.h. No need to redefine them here.
The 2 promised users of the structures:
arch/ia64/hp/sim/simserial.c
drivers/tty/amiserial.c
Jiri Slaby [Mon, 5 Mar 2012 13:52:11 +0000 (14:52 +0100)]
TTY: speakup, do not use serialP
The structures there are going away. And speakup has enough troubles
already.
So define a structure similar to what 8250 does: old_serial_port.
There define an array of speed, port base and so on needed for
configuration. Then use this structure instead of serial_state defined
in serialP.h.
Signed-off-by: Jiri Slaby <jslaby@suse.cz> Cc: William Hubbs <w.d.hubbs@gmail.com> Cc: Chris Brannon <chris@the-brannons.com> Cc: Kirk Reiser <kirk@braille.uwo.ca> Cc: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Jiri Slaby [Mon, 5 Mar 2012 13:52:09 +0000 (14:52 +0100)]
TTY: serial, include pci.h in m32r_sio
It uses pointers to pci_dev, but compiler complains it doesn't know
it:
In file included from .../m32r_sio.c:53:
.../m32r_sio.h:21: warning: "struct pci_dev" declared inside parameter list
.../m32r_sio.h:21: warning: its scope is only this definition or declaration, which is probably not what you want
.../m32r_sio.h:22: warning: "struct pci_dev" declared inside parameter list
Jiri Slaby [Mon, 5 Mar 2012 13:52:08 +0000 (14:52 +0100)]
TTY: serial, use atomic_inc_return in ioc4_serial
We want to know the value of the atomic variable in intr_connect after
the increment. But atomic_inc doesn't, per definition, return the
value. It is just a pure coincidence that ia64 defines atomic_inc as
atomic_inc_return.
So fix this mistake by using atomic_inc_return properly.
Jiri Slaby [Mon, 5 Mar 2012 13:52:07 +0000 (14:52 +0100)]
TTY: iss/console, use tty_port
Even though the port is not used for anything real there yet, this
will change as tty buffers will be in tty_port in the near future. So
the port will be needed in all drivers.
Jiri Slaby [Mon, 5 Mar 2012 13:52:02 +0000 (14:52 +0100)]
TTY: ipwireless, fix tty->index handling
* do not test if tty->index is in bounds. It is always.
* tty->index is not a minor! Fix that.
>From now on, let's assume that the parameter of the function is tty
index with base being zero. This makes also the code more readable.
Factually, there is no real change as tty_driver->minor_start is zero,
so the tests are equivalent. But it did not make sense. And if this
had changed eventually, it would have caused troubles.
Jiri Slaby [Mon, 5 Mar 2012 13:52:01 +0000 (14:52 +0100)]
TTY: remove unneeded tty->index checks
Checking if tty->index is in bounds is not needed. The tty has the
index set in the initial open. This is done in get_tty_driver. And it
can be only in interval <0,driver->num).
So remove the tests which check exactly this interval. Some are
left untouched as they check against the current backing device count.
(Leaving apart that the check is racy in most of the cases.)
Jiri Slaby [Mon, 5 Mar 2012 13:51:59 +0000 (14:51 +0100)]
TTY: srmcons, convert to use tty_port
This is needed because the tty buffer will become a tty_port member
later. That will help us to wipe out most of the races and checks for
the tty pointer in hot paths.
Signed-off-by: Jiri Slaby <jslaby@suse.cz> Cc: Richard Henderson <rth@twiddle.net> Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru> Cc: Matt Turner <mattst88@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Note that tty->ops->shutdown is called from whatever context the user
drops the last tty reference from. E.g. if one takes a reference in
an ISR, tty close happens on other CPU and the final tty put is from
the ISR, tty->ops->shutdown will be called from that hard irq context.
We would have a problem in vt if we start using tty refcounting from
other contexts than user there. It is because vt's shutdown uses
mutexes. This is yet to be fixed.
Jiri Slaby [Mon, 5 Mar 2012 13:51:54 +0000 (14:51 +0100)]
TTY: remove tty driver re-set from tty_reopen
This is from tty_reopen:
struct tty_driver *driver = tty->driver;
...
tty->driver = driver;
and it doesn't make sense at all. The driver is intended to be set in
initialize_tty_struct from tty_init_dev (initial open). So this set in
tty_reopen is not needed.
Jiri Slaby [Mon, 5 Mar 2012 13:51:52 +0000 (14:51 +0100)]
TTY: remove re-assignments to tty_driver members
All num, magic and owner are set by alloc_tty_driver. No need to
re-set them on each allocation site.
pti driver sets something different to what it passes to
alloc_tty_driver. It is not a bug, since we don't use the lines
parameter in any way. Anyway this is fixed, and now we do the right
thing.
Jiri Slaby [Mon, 5 Mar 2012 13:51:50 +0000 (14:51 +0100)]
TTY: let alloc_tty_driver deduce the owner automatically
Like the rest of the kernel, make a stub from alloc_tty_driver which
calls __alloc_tty_driver with proper owner. This will save us one more
assignment on the driver side.
Also this fixes some drivers which didn't set the owner. This allowed
user to remove the module from the system even though a tty from the
driver is still open.
Cousson, Benoit [Tue, 28 Feb 2012 17:22:12 +0000 (18:22 +0100)]
tty: serial: OMAP: Fix oops due to NULL pdata in DT boot
The following commit: be4b0281956c5cae4f63f31f11d07625a6988766
(tty: serial: OMAP: block idle while the UART is transferring data in PIO mode),
is introducing an oops if OMAP is booted using device tree blob because
the pdata will not be initialized.
Alan Cox [Tue, 28 Feb 2012 14:49:23 +0000 (14:49 +0000)]
vt:tackle kbd_table
Keyboard struct lifetime is easy, but the locking is not and is completely
ignored by the existing code. Tackle this one head on
- Make the kbd_table private so we can run down all direct users
- Hoick the relevant ioctl handlers into the keyboard layer
- Lock them with the keyboard lock so they don't change mid keypress
- Add helpers for things like console stop/start so we isolate the poking
around properly
- Tweak the braille console so it still builds
There are a couple of FIXME locking cases left for ioctls that are so hideous
they should be addressed in a later patch. After this patch the kbd_table is
private and all the keyboard jiggery pokery is in one place.
This update fixes speakup and also a memory leak in the original.
Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>