firefly-linux-kernel-4.4.55.git
12 years agoserial: pl011: implement workaround for CTS clear event issue
Rajanikanth H.V [Mon, 26 Mar 2012 09:17:02 +0000 (11:17 +0200)]
serial: pl011: implement workaround for CTS clear event issue

Problem Observed:
- interrupt status is set by rising or falling edge on CTS line
- interrupt status is cleared on a .0. to .1. transition of the
  interrupt-clear register bit 1.
- interrupt-clear register is reset by hardware once the interrupt
  status is .0..
  Remark: It seems not possible to read this register back by the
  CPU though, but internally this register exists.
- when simultaneous set and reset event on the interrupt status
  happens, then the set-event has priority and the status remains
  .1.. As a result the interrupt-clear register is not reset to
  .0., and no new .0. to .1. transition can be detected on it when
  writing a .1. to it.
  This implies race condition, the clear must be performed at least
  one UARTCLK the riding edge of CTS RIS interrupt.

Fix:
  Instead of resetting UART as done in commit
  c16d51a32bbb61ac8fd96f78b5ce2fccfe0fb4c3
  "amba pl011: workaround for uart registers lockup" do the
  following:

  write .0. and then  .1. to the interrupt-clear register to make
  sure that this transition is detected. According to the datasheet
  writing a .0. does not have any effect, but actually it allows to
  reset the internal interrupt-clear register.

  Take into account:
  The .0. needs to last at least for one clk_uart clock period
  (~ 38 MHz, 26.08ns)

This way we can do away with the tasklet and keep only a tiny
fix triggered by the variant flag introduced in this patch.

Signed-off-by: Guillaume Jaunet <guillaume.jaunet@stericsson.com>
Signed-off-by: Christophe Arnal <christophe.arnal@stericsson.com>
Signed-off-by: Matthias Locher <Matthias.Locher@stericsson.com>
Signed-off-by: Rajanikanth H.V <rajanikanth.hv@stericsson.com>
Reviewed-by: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agotty: add missing tty_port_tty_get() call to raw3215_wakeup
Heiko Carstens [Tue, 17 Apr 2012 11:16:34 +0000 (13:16 +0200)]
tty: add missing tty_port_tty_get() call to raw3215_wakeup

Fix compile error caused by "TTY: con3215, use tty from tty_port":

 CC      drivers/s390/char/con3215.o
drivers/s390/char/con3215.c: In function 'raw3215_wakeup':
drivers/s390/char/con3215.c:339:16: error: 'struct raw3215_info' has no member named 'tty'
make[1]: *** [drivers/s390/char/con3215.o] Error 1
make: *** [drivers/s390/char/] Error 2

Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Acked-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: con3215, use tty from tty_port
Jiri Slaby [Wed, 11 Apr 2012 09:14:59 +0000 (11:14 +0200)]
TTY: con3215, use tty from tty_port

Obtain tty_struct only once in ISR and pass it down to
raw3215_next_io. Other than that, we just use the tty with raised
reference. And set it properly in open and close.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: linux390@de.ibm.com
Cc: linux-s390@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: con3215, add tty_port
Jiri Slaby [Wed, 11 Apr 2012 09:14:58 +0000 (11:14 +0200)]
TTY: con3215, add tty_port

And use flags from that. But first we have to get rid of duplicated
flag names. From now on, for the standard ones that are stored in
tty_port->flags, we use ASYNC_* ones.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: linux390@de.ibm.com
Cc: linux-s390@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: hvc, fix TTY refcounting
Jiri Slaby [Fri, 13 Apr 2012 08:31:32 +0000 (10:31 +0200)]
TTY: hvc, fix TTY refcounting

A -next commit "TTY: HVC, use tty from tty_port" switched the driver
to use tty_port helper for tty refcounting. But it omitted to remove
manual tty refcounting from open, close and hangup. So now we are
getting random crashes caused by use-after-free:
Unable to handle kernel paging request for data at address 0xc0000003f9d550
Faulting instruction address: 0xc0000000001b7f40
Oops: Kernel access of bad area, sig: 11 [#1]
...
NIP: c0000000001b7f40 LR: c0000000001b7f14 CTR: c0000000000e04f0
...
NIP [c0000000001b7f40] .__kmalloc+0x70/0x230
LR [c0000000001b7f14] .__kmalloc+0x44/0x230
Call Trace:
[c0000003f68bf930] [c0000003f68bf9b0] 0xc0000003f68bf9b0 (unreliable)
[c0000003f68bf9e0] [c0000000001e5424] .alloc_fdmem+0x24/0x70
[c0000003f68bfa60] [c0000000001e54f8] .alloc_fdtable+0x88/0x130
[c0000003f68bfaf0] [c0000000001e5924] .dup_fd+0x384/0x450
[c0000003f68bfbd0] [c00000000009a310] .copy_process+0x880/0x11d0
[c0000003f68bfcd0] [c00000000009aee0] .do_fork+0x70/0x400
[c0000003f68bfdc0] [c0000000000141c4] .sys_clone+0x54/0x70
[c0000003f68bfe30] [c000000000009aa0] .ppc_clone+0x8/0xc

Fix that by complete removal of tty_kref_get/put in open/close/hangup
paths.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Reported-and-tested-by: Michael Neuling <mikey@neuling.org>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: ppc-dev <linuxppc-dev@lists.ozlabs.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoISDN: remove uses of isdn_tty_revision
Jiri Slaby [Tue, 10 Apr 2012 08:35:29 +0000 (10:35 +0200)]
ISDN: remove uses of isdn_tty_revision

Commit "ISDN: i4l, remove cvs crap" removed definition of
isdn_tty_revision, but there is still a user. So this causes linking
errors. This was hidden from my radar because the variable was not
declared in any header. Instead isdn_common.c declares it locally.

So remove this variable also from isdn_common.c, because there is
really no way to find out the version. Git commit or tag is...

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Karsten Keil <isdn@linux-pingi.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agotty: hold lock across tty buffer finding and buffer filling
Xiaobing Tu [Fri, 16 Mar 2012 03:00:26 +0000 (03:00 +0000)]
tty: hold lock across tty buffer finding and buffer filling

tty_buffer_request_room is well protected, but while after it returns,
 it releases the port->lock. tty->buf.tail might be modified
by either irq handler or other threads. The patch adds more protection
by holding the lock across tty buffer finding and buffer filling.

Signed-off-by: Alek Du <alek.du@intel.com>
Signed-off-by: Xiaobing Tu <xiaobing.tu@intel.com>
Cc: Jiri Slaby <jslaby@suse.cz>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agotty/vt: handle bad user buffer in {G,P}IO_CMAP ioctl
Michael Gehring [Wed, 21 Mar 2012 00:26:45 +0000 (01:26 +0100)]
tty/vt: handle bad user buffer in {G,P}IO_CMAP ioctl

set_get_cmap() ignored the result of {get,put}_user(), causing ioctl(vt,
{G,P}IO_CMAP, 0xdeadbeef) to silently fail.

Another side effect of this: calling the PIO_CMAP ioctl with an invalid
buffer would zero the default colormap and the palette for all vts (all
colors set to black).

Leave the default colormap intact and return -EFAULT when
reading/writing to the userspace buffer fails.

Signed-off-by: Michael Gehring <mg@ebfe.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agopch_uart: Fix duplicate memory release issue
Tomoya MORINAGA [Mon, 26 Mar 2012 05:43:06 +0000 (14:43 +0900)]
pch_uart: Fix duplicate memory release issue

Add initialize variable to prevent duplicate free memory.

Signed-off-by: Tomoya MORINAGA <tomoya.rohm@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agopch_uart: Fix return value issue
Tomoya MORINAGA [Mon, 26 Mar 2012 05:43:05 +0000 (14:43 +0900)]
pch_uart: Fix return value issue

Currently, occurring line status interrupt,
returned value is not set in interrupt handler function.
As a result, 0 can be returned.

This patch adds setting returned value.

Signed-off-by: Tomoya MORINAGA <tomoya.rohm@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agopch_uart: delete unused data structure
Tomoya MORINAGA [Mon, 26 Mar 2012 05:43:04 +0000 (14:43 +0900)]
pch_uart: delete unused data structure

Signed-off-by: Tomoya MORINAGA <tomoya.rohm@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agopch_uart: Support modem status interrupt
Tomoya MORINAGA [Mon, 26 Mar 2012 05:43:03 +0000 (14:43 +0900)]
pch_uart: Support modem status interrupt

Signed-off-by: Tomoya MORINAGA <tomoya.rohm@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agopch_uart: change type to %d to %02x
Tomoya MORINAGA [Mon, 26 Mar 2012 05:43:02 +0000 (14:43 +0900)]
pch_uart: change type to %d to %02x

%02x format is easier to understand better than %d.

Signed-off-by: Tomoya MORINAGA <tomoya.rohm@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agopch_uart: change type to u8
Tomoya MORINAGA [Mon, 26 Mar 2012 05:43:01 +0000 (14:43 +0900)]
pch_uart: change type to u8

Target uart register access size is 8bit.
However, 32bit is used at 2 points.

This patch modifies type "unsigned int" to "unsigned char".

Signed-off-by: Tomoya MORINAGA <tomoya.rohm@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agopch_uart: Delete unused structure member
Tomoya MORINAGA [Mon, 26 Mar 2012 05:43:00 +0000 (14:43 +0900)]
pch_uart: Delete unused structure member

Signed-off-by: Tomoya MORINAGA <tomoya.rohm@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: rfcomm/tty, use count from tty_port
Jiri Slaby [Mon, 2 Apr 2012 11:54:53 +0000 (13:54 +0200)]
TTY: rfcomm/tty, use count from tty_port

This means converting an atomic counter to a counter protected by
lock. This is the first step needed to convert the rest of the code to
the tty_port helpers.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: rfcomm/tty, remove work for tty_wakeup
Jiri Slaby [Mon, 2 Apr 2012 11:54:52 +0000 (13:54 +0200)]
TTY: rfcomm/tty, remove work for tty_wakeup

tty_wakeup is safe to be called from all contexts. No need to schedule
a work for that. Let us call it directly like in other drivers.

This allows us to kill another member of rfcomm_dev structure.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: rfcomm/tty, use tty_port refcounting
Jiri Slaby [Mon, 2 Apr 2012 11:54:51 +0000 (13:54 +0200)]
TTY: rfcomm/tty, use tty_port refcounting

Switch the refcounting from manual atomic plays with refcounter to the
one offered by tty_port.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: rfcomm/tty, add tty_port
Jiri Slaby [Mon, 2 Apr 2012 11:54:50 +0000 (13:54 +0200)]
TTY: rfcomm/tty, add tty_port

And use tty from there.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: usb/u_serial use close_wait from tty_port
Jiri Slaby [Mon, 2 Apr 2012 11:54:49 +0000 (13:54 +0200)]
TTY: usb/u_serial use close_wait from tty_port

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: usb/u_serial, use tty from tty_port
Jiri Slaby [Mon, 2 Apr 2012 11:54:48 +0000 (13:54 +0200)]
TTY: usb/u_serial, use tty from tty_port

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: usb/u_serial, add tty_port
Jiri Slaby [Mon, 2 Apr 2012 11:54:47 +0000 (13:54 +0200)]
TTY: usb/u_serial, add tty_port

And use count from there.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: 68328serial, use tty_port_block_til_ready
Jiri Slaby [Mon, 2 Apr 2012 11:54:46 +0000 (13:54 +0200)]
TTY: 68328serial, use tty_port_block_til_ready

Since the code is identical, use the tty_port_block_til_ready helper
instead of re-implemented variant.

The code does not perform rtsdts handling, hence we do not need to
provide tty port hooks for them. The default ones will be used
instead. The only necessary thing is to provide tty_port_operations.
It is empty, but has to be there...

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-m68k@lists.linux-m68k.org
Acked-by: Greg Ungerer <gerg@uclinux.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: 68328serial, use tty from tty_port
Jiri Slaby [Mon, 2 Apr 2012 11:54:45 +0000 (13:54 +0200)]
TTY: 68328serial, use tty from tty_port

And refcount that properly.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-m68k@lists.linux-m68k.org
Acked-by: Greg Ungerer <gerg@uclinux.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: 68328serial, propagate tty
Jiri Slaby [Mon, 2 Apr 2012 11:54:44 +0000 (13:54 +0200)]
TTY: 68328serial, propagate tty

We need tty at some places, but info->tty might be NULL at those. Let
us propagate tty from callers where we know we have a valid tty. This
will make a switch to tty refcounting simpler.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-m68k@lists.linux-m68k.org
Acked-by: Greg Ungerer <gerg@uclinux.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: 68328serial, use flags from tty_port
Jiri Slaby [Mon, 2 Apr 2012 11:54:43 +0000 (13:54 +0200)]
TTY: 68328serial, use flags from tty_port

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-m68k@lists.linux-m68k.org
Acked-by: Greg Ungerer <gerg@uclinux.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: 68328serial, use close_delay/closing_wait from tty_port
Jiri Slaby [Mon, 2 Apr 2012 11:54:42 +0000 (13:54 +0200)]
TTY: 68328serial, use close_delay/closing_wait from tty_port

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-m68k@lists.linux-m68k.org
Acked-by: Greg Ungerer <gerg@uclinux.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: 68328serial, use open/close_wait from tty_port
Jiri Slaby [Mon, 2 Apr 2012 11:54:41 +0000 (13:54 +0200)]
TTY: 68328serial, use open/close_wait from tty_port

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-m68k@lists.linux-m68k.org
Acked-by: Greg Ungerer <gerg@uclinux.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: 68328serial, add tty_port
Jiri Slaby [Mon, 2 Apr 2012 11:54:40 +0000 (13:54 +0200)]
TTY: 68328serial, add tty_port

And use count and blocked_count from that.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-m68k@lists.linux-m68k.org
Acked-by: Greg Ungerer <gerg@uclinux.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: 68328serial, remove 68328serial.h
Jiri Slaby [Mon, 2 Apr 2012 11:54:39 +0000 (13:54 +0200)]
TTY: 68328serial, remove 68328serial.h

All the needed stuff is moved to 68328serial.c now.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-m68k@lists.linux-m68k.org
Acked-by: Greg Ungerer <gerg@uclinux.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: 68328serial, use ulong flags for interrupts status
Jiri Slaby [Mon, 2 Apr 2012 11:54:38 +0000 (13:54 +0200)]
TTY: 68328serial, use ulong flags for interrupts status

flags passed to local_irq_save/restore should be ulong. Switch tehem
to that. Otherwise we get compilation warnings:
.../68328serial.c:248:9: warning: comparison of distinct pointer types lacks a cast [enabled by default]
.../68328serial.c:257:9: warning: comparison of distinct pointer types lacks a cast [enabled by default]

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-m68k@lists.linux-m68k.org
Acked-by: Greg Ungerer <gerg@uclinux.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: 68328serial, remove garbage
Jiri Slaby [Mon, 2 Apr 2012 11:54:37 +0000 (13:54 +0200)]
TTY: 68328serial, remove garbage

- empty functions
- unused global variables

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-m68k@lists.linux-m68k.org
Acked-by: Greg Ungerer <gerg@uclinux.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: 68328serial, remove unused stuff from m68k_serial
Jiri Slaby [Mon, 2 Apr 2012 11:54:36 +0000 (13:54 +0200)]
TTY: 68328serial, remove unused stuff from m68k_serial

Not everything from struct m68k_serial is really used. So remove
unused or only-set members of that structure. Next step is to move it
to 68328serial.c and remove 68328serial.h completely.

This change also takes status_handle and batten_down_hatches away
since they use break_abort but do nothing.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-m68k@lists.linux-m68k.org
Acked-by: Greg Ungerer <gerg@uclinux.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: 68328serial, remove serial_state and friends
Jiri Slaby [Mon, 2 Apr 2012 11:54:35 +0000 (13:54 +0200)]
TTY: 68328serial, remove serial_state and friends

serial_state in 68328serial.h is a duplicated structure. One is
defined in linux/serial.h. So let us use that instead. And since the
serial flags are identical, use ones from there too.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Greg Ungerer <gerg@uclinux.org>
Cc: linux-m68k@lists.linux-m68k.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: ipwireless, use tty from tty_port
Jiri Slaby [Mon, 2 Apr 2012 11:54:34 +0000 (13:54 +0200)]
TTY: ipwireless, use tty from tty_port

It does not make the driver less racy though. Close and hangup should
be rewritten and tty refcounting used properly.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Jiri Kosina <jkosina@suse.cz>
Acked-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: ipwireless, add tty_port
Jiri Slaby [Mon, 2 Apr 2012 11:54:33 +0000 (13:54 +0200)]
TTY: ipwireless, add tty_port

And use count from that.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Jiri Kosina <jkosina@suse.cz>
Acked-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: ipwireless, move prints to appropriate places
Jiri Slaby [Mon, 2 Apr 2012 11:54:32 +0000 (13:54 +0200)]
TTY: ipwireless, move prints to appropriate places

There are two functions which only print a status. Let us do that
directly at places where they are called.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Jiri Kosina <jkosina@suse.cz>
Acked-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: ipwireless, use synchronous hangup
Jiri Slaby [Mon, 2 Apr 2012 11:54:31 +0000 (13:54 +0200)]
TTY: ipwireless, use synchronous hangup

Do not touch internal workqueue. Call tty_vhangup instead.

Note that finished hangup does not necessarily mean that all processes
are dead. Especially when the tty is a console. The code assumes that
right now.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Jiri Kosina <jkosina@suse.cz>
Acked-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: hvsi, use tty from tty_port
Jiri Slaby [Mon, 2 Apr 2012 11:54:30 +0000 (13:54 +0200)]
TTY: hvsi, use tty from tty_port

Now, we switch to the refcounted model and do not need hp->lock to
protect hp->tty anymore.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: hvsi, sanitize uses of tty
Jiri Slaby [Mon, 2 Apr 2012 11:54:29 +0000 (13:54 +0200)]
TTY: hvsi, sanitize uses of tty

- use tty, not hp->tty wherever possible
- pass tty down to some functions and go to step one
- do not defer tty_hangup calls -- it is as simple as schedule_work,
  so might be called with hp->lock held
- do not defer tty buffer flips -- since the driver does not use
  low_latency (it cannot actually), the flip is a simple tail move
  plus schedule_work. It will make our life easier in the next patch.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: hvsi, add tty_port
Jiri Slaby [Mon, 2 Apr 2012 11:54:28 +0000 (13:54 +0200)]
TTY: hvsi, add tty_port

And use count from there.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: hvsi, CLOCAL is not in tty->flags
Jiri Slaby [Mon, 2 Apr 2012 11:54:27 +0000 (13:54 +0200)]
TTY: hvsi, CLOCAL is not in tty->flags

It is in termios cflags. So change the test in hvsi_recv_control to do
the right thing. Previously it was actually testing TTY_LDISC_OPEN
bit, i.e. whether an ldisc is active. And yes, it is most of the time.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: hvcs, use tty from tty_port
Jiri Slaby [Mon, 2 Apr 2012 11:54:26 +0000 (13:54 +0200)]
TTY: hvcs, use tty from tty_port

No refcounting, just a switch. The locking in the driver prevents
races, so in fact the refcounting is not needed. But while we have a
tty in tty_port, don't duplicate that and remove the one from
hvcs_struct.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: hvcs, use kref from tty_port
Jiri Slaby [Mon, 2 Apr 2012 11:54:25 +0000 (13:54 +0200)]
TTY: hvcs, use kref from tty_port

A simple switch. Except we convert destroy_hvcs_struct to be
tty_port_operations->destruct...

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: hvcs, add tty_port
Jiri Slaby [Mon, 2 Apr 2012 11:54:24 +0000 (13:54 +0200)]
TTY: hvcs, add tty_port

And use count from there.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: HVC, use count from tty_port
Jiri Slaby [Mon, 2 Apr 2012 11:54:23 +0000 (13:54 +0200)]
TTY: HVC, use count from tty_port

Now, count is used from tty_port and protected by tty_port->lock.

n_outbuf is left unprotected in hvc_hangup now, because there is no
point to hold any lock, since other uses are unprotected too.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: HVC, use tty from tty_port
Jiri Slaby [Mon, 2 Apr 2012 11:54:22 +0000 (13:54 +0200)]
TTY: HVC, use tty from tty_port

The driver already used refcounting. So we just switch it to tty_port
helpers. And switch to tty_port->lock for tty.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: HVC, add tty_port
Jiri Slaby [Mon, 2 Apr 2012 11:54:21 +0000 (13:54 +0200)]
TTY: HVC, add tty_port

And use kref from that. This means we need tty_port->ops->destruct to
properly free the structure. This is what destroy_hvc_struct used to
do so we leverage that.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: bfin_jtag_comm, use tty from tty_port
Jiri Slaby [Mon, 2 Apr 2012 11:54:20 +0000 (13:54 +0200)]
TTY: bfin_jtag_comm, use tty from tty_port

Switch from mutex to tty_port->lock and to tty refcounting. This needs
a 'continue' to be added to re-grab a tty after schedule returns.

And since tty is not protected by bfin_jc_tty_mutex remove it as well.
But this needs tty_port->count to be protected by tty_port->lock now.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: uclinux-dist-devel@blackfin.uclinux.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: bfin_jtag_comm, add tty_port
Jiri Slaby [Mon, 2 Apr 2012 11:54:19 +0000 (13:54 +0200)]
TTY: bfin_jtag_comm, add tty_port

And use open count from there. Switch to tty from there will follow.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: uclinux-dist-devel@blackfin.uclinux.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: tty3270, add tty_port
Jiri Slaby [Mon, 2 Apr 2012 11:54:18 +0000 (13:54 +0200)]
TTY: tty3270, add tty_port

And use tty from that. This means, we convert most of the users to
accept tty_port instead. This is not racy and ensures the tty to be
properly refcounted.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: linux390@de.ibm.com
Cc: linux-s390@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: tty3270, push tty down to tty3270_do_write
Jiri Slaby [Mon, 2 Apr 2012 11:54:17 +0000 (13:54 +0200)]
TTY: tty3270, push tty down to tty3270_do_write

So that we do not need to access tp->tty there. It is going away.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: linux390@de.ibm.com
Cc: linux-s390@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: tty3270, get rid of ugly aliasing
Jiri Slaby [Mon, 2 Apr 2012 11:54:16 +0000 (13:54 +0200)]
TTY: tty3270, get rid of ugly aliasing

Blah, do not assume that raw3270_view is at the beginning of tty3270.
Use proper types and container_of wherever needed.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: linux390@de.ibm.com
Cc: linux-s390@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: tty3270, move initialization to allocation
Jiri Slaby [Mon, 2 Apr 2012 11:54:15 +0000 (13:54 +0200)]
TTY: tty3270, move initialization to allocation

Let us initialize all the tty3270's members at the place where the
structure is allocated.

It cleans up tty->ops->open a bit.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: linux390@de.ibm.com
Cc: linux-s390@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: sclp_vt220, remove unused allocation
Jiri Slaby [Mon, 2 Apr 2012 11:54:14 +0000 (13:54 +0200)]
TTY: sclp_vt220, remove unused allocation

80 bytes which are allocated in tty->ops->open and assigned to
tty->driver_data are never used. Remove that.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: linux390@de.ibm.com
Cc: linux-s390@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: sclp_vt220, add tty_port
Jiri Slaby [Mon, 2 Apr 2012 11:54:13 +0000 (13:54 +0200)]
TTY: sclp_vt220, add tty_port

tty_port will hold tty buffers in the future. So we need to have it
even here. The only needed member here is tty, so let us store it in
the structure now.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: linux390@de.ibm.com
Cc: linux-s390@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: sclp_tty, add tty_port
Jiri Slaby [Mon, 2 Apr 2012 11:54:12 +0000 (13:54 +0200)]
TTY: sclp_tty, add tty_port

tty_port will hold tty buffers in the future. So we need to have it
even here. The only needed member here is tty, so let us store it in
the structure now.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: linux390@de.ibm.com
Cc: linux-s390@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: con3215, centralize allocation
Jiri Slaby [Mon, 2 Apr 2012 11:54:08 +0000 (13:54 +0200)]
TTY: con3215, centralize allocation

There are two copies of allocations of device information. One of them
is totally broken. See:
raw->cdev = cdev;
raw->inbuf = (char *) raw + sizeof(struct raw3215_info);
memset(raw, 0, sizeof(struct raw3215_info));

It suggests that this path was never executed. The code uses both
raw->cdev and raw->inbuf all over. And it is NULL due to the memset
here, so it would panic immediately. I believe nobody used that driver
without being a system console.

Either way, let us fix it by moving the allocations (and
initializations) to a single place. This will save us some double
initializations later too.

And while at it, initialize the timer properly -- once, at the
allocation.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Acked-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: linux390@de.ibm.com
Cc: linux-s390@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: hso, use tty from tty_port
Jiri Slaby [Mon, 2 Apr 2012 11:54:07 +0000 (13:54 +0200)]
TTY: hso, use tty from tty_port

We switched tty refcounting there to the one provided by tty_port
helpers. So tty_port->tty is now protected by tty_port->lock, not by
hso_serial->serial_lock.

Side note: tty->driver_data does not need the lock, so it is needed
neither in open, nor in close paths.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Jan Dumon <j.dumon@option.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: hso, remove tty NULL checks fro tty->ops
Jiri Slaby [Mon, 2 Apr 2012 11:54:06 +0000 (13:54 +0200)]
TTY: hso, remove tty NULL checks fro tty->ops

tty is never NULL in tty->ops->* while the device is open. (And they
are not called otherwise.) So remove pointless checks and use
tty->driver_data directly.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Jan Dumon <j.dumon@option.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: hso, add tty_port
Jiri Slaby [Mon, 2 Apr 2012 11:54:05 +0000 (13:54 +0200)]
TTY: hso, add tty_port

And use open count from there. Other members will follow.

Remark: port.count is (and never was) properly protected. Only a mutex
is held, so ISR and all the functions it calls may see an invalid
state.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Jan Dumon <j.dumon@option.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: hso, free tty_driver
Jiri Slaby [Mon, 2 Apr 2012 11:54:04 +0000 (13:54 +0200)]
TTY: hso, free tty_driver

Do not leak tty_driver structure on each module removal. Also do
proper frees in fail paths of module_init.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Jan Dumon <j.dumon@option.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: hso, do not set TTY MAGIC
Jiri Slaby [Mon, 2 Apr 2012 11:54:03 +0000 (13:54 +0200)]
TTY: hso, do not set TTY MAGIC

It is set in alloc_tty_driver already. No need to re-set.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Jan Dumon <j.dumon@option.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: isdn, use tty_port_block_til_ready helper
Jiri Slaby [Mon, 2 Apr 2012 11:54:02 +0000 (13:54 +0200)]
TTY: isdn, use tty_port_block_til_ready helper

This removes a bunch of duplicated code which does the same as
tty_port_block_til_ready does.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Karsten Keil <isdn@linux-pingi.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: isdn, define tty_port_operations
Jiri Slaby [Mon, 2 Apr 2012 11:54:01 +0000 (13:54 +0200)]
TTY: isdn, define tty_port_operations

Add there .carrier_raised. It is taken from current block_til_ready.
We will need tty_port->ops->carrier_raised for
tty_port_block_til_ready helper.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Karsten Keil <isdn@linux-pingi.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: isdn, use tty_port_close_end helper
Jiri Slaby [Mon, 2 Apr 2012 11:54:00 +0000 (13:54 +0200)]
TTY: isdn, use tty_port_close_end helper

The code does almost the same, so there we can leverage the helper's
code. The only difference is locking. The helper protects counts by a
spinlock. This never hurts and should be added to other code parts
too.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Karsten Keil <isdn@linux-pingi.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: isdn, define local tty_port
Jiri Slaby [Mon, 2 Apr 2012 11:53:59 +0000 (13:53 +0200)]
TTY: isdn, define local tty_port

In some functions we use tty_port much. So let us have a local pointer
to that variable instead of having info->port all over the code.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Karsten Keil <isdn@linux-pingi.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: isdn, use xmit_buf from tty_port
Jiri Slaby [Mon, 2 Apr 2012 11:53:58 +0000 (13:53 +0200)]
TTY: isdn, use xmit_buf from tty_port

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Karsten Keil <isdn@linux-pingi.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: isdn, use tty from tty_port
Jiri Slaby [Mon, 2 Apr 2012 11:53:57 +0000 (13:53 +0200)]
TTY: isdn, use tty from tty_port

No recounting this time, just a plain switch.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Karsten Keil <isdn@linux-pingi.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: isdn, use counts from tty_port
Jiri Slaby [Mon, 2 Apr 2012 11:53:56 +0000 (13:53 +0200)]
TTY: isdn, use counts from tty_port

blocked_open and count this time.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Karsten Keil <isdn@linux-pingi.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: isdn, use open/close_wait from tty_port
Jiri Slaby [Mon, 2 Apr 2012 11:53:55 +0000 (13:53 +0200)]
TTY: isdn, use open/close_wait from tty_port

Hmm, the isdn ones were initialized twice.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Karsten Keil <isdn@linux-pingi.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: isdn, add tty_port
Jiri Slaby [Mon, 2 Apr 2012 11:53:54 +0000 (13:53 +0200)]
TTY: isdn, add tty_port

And use tty_port->flags now. Other members will follow.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Karsten Keil <isdn@linux-pingi.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: isdn, remove unused members from modem_info
Jiri Slaby [Mon, 2 Apr 2012 11:53:53 +0000 (13:53 +0200)]
TTY: isdn, remove unused members from modem_info

session and pgrp are unused. Prune them.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Karsten Keil <isdn@linux-pingi.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: isdn, make some functions readable
Jiri Slaby [Mon, 2 Apr 2012 11:53:52 +0000 (13:53 +0200)]
TTY: isdn, make some functions readable

Huh, this was a mess.

* Remove the 5 indent levels by just returning from isdn_tty_try_read
  when the conditions there are not satisfied.
* Use 'continue' in loop in isdn_tty_readmodem to save 2 levels.
* Chain 'if's in isdn_tty_modem_escape.
* Use 'continue' in loop in isdn_tty_carrier_timeout to save 1 level.

Better to look at this patch with -w -b.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Karsten Keil <isdn@linux-pingi.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: isdn, do not play with module refcounts
Jiri Slaby [Mon, 2 Apr 2012 11:53:51 +0000 (13:53 +0200)]
TTY: isdn, do not play with module refcounts

The module which called allocate_tty_driver is already refcounted by
the TTY layer automatically. And since THIS_MODULE is isdn_tty and it
allocated the tty_driver, there is no need to do the counts in isdn's
tty->ops->open/close.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Karsten Keil <isdn@linux-pingi.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: isdn, remove ISDN_ASYNC_* flags
Jiri Slaby [Mon, 2 Apr 2012 11:53:50 +0000 (13:53 +0200)]
TTY: isdn, remove ISDN_ASYNC_* flags

They are the same as TTY ones. So there is no need to redefine them.
Remove ISDN_ASYNC_* and use only ASYNC_*. Except the MAGIC number, of
course.

While we are there, remove also the SERIAL_TYPE flags which are
unused.

Perhaps we should move the ASYNC flags from serial.h to tty.h given
they are used by the tty layer and tty drivers, not only serial?

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Karsten Keil <isdn@linux-pingi.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: isdn, remove callout
Jiri Slaby [Mon, 2 Apr 2012 11:53:49 +0000 (13:53 +0200)]
TTY: isdn, remove callout

I wonder how this survived there during the whole 2.6 series until now
:D.

Callouts are not used for a decade, so let us remove it also from
isdn. This means removal of ISDN_ASYNC_CALLOUT_ACTIVE which is never
raised in info->flags and callout_termios which are never used.

This will help us to get rid of ISDN_ASYNC_* flags and use ASYNC ones
from serial.h. And then we will switch to tty_port.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Karsten Keil <isdn@linux-pingi.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoISDN: i4l, remove cvs crap
Jiri Slaby [Mon, 2 Apr 2012 11:53:48 +0000 (13:53 +0200)]
ISDN: i4l, remove cvs crap

CVS $Id$ is unused and makes no sense in our tree. Get rid of that.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Karsten Keil <isdn@linux-pingi.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: deprecate linux/generic_serial.h
Jiri Slaby [Mon, 2 Apr 2012 11:53:47 +0000 (13:53 +0200)]
TTY: deprecate linux/generic_serial.h

Since nobody in the kernel includes that file, let us remove the
structs visible to the kernel.

However since the userspace sees the file, it still may include that.
hence deprecate the use of the header by an added cpp #warning.

We should remove the file completely after a couple of years.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: crisv10, initialize tty_port
Jiri Slaby [Mon, 2 Apr 2012 11:53:46 +0000 (13:53 +0200)]
TTY: crisv10, initialize tty_port

The tty_port used in the driver is left uninitialized. Add the
initialization there.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Mikael Starvik <starvik@axis.com>
Acked-by: Jesper Nilsson <jesper.nilsson@axis.com>
Cc: linux-cris-kernel@axis.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoTTY: crisv10, remove unused tmp_buf
Jiri Slaby [Mon, 2 Apr 2012 11:53:45 +0000 (13:53 +0200)]
TTY: crisv10, remove unused tmp_buf

This used to be a helper buffer for generic_serial. generic_serial is
gone, tmp_buf shall be removed.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Mikael Starvik <starvik@axis.com>
Acked-by: Jesper Nilsson <jesper.nilsson@axis.com>
Cc: linux-cris-kernel@axis.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoLinux 3.4-rc2
Linus Torvalds [Sun, 8 Apr 2012 01:30:41 +0000 (18:30 -0700)]
Linux 3.4-rc2

12 years agoMerge tag 'regmap-3.4-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie...
Linus Torvalds [Sat, 7 Apr 2012 16:56:00 +0000 (09:56 -0700)]
Merge tag 'regmap-3.4-fixes' of git://git./linux/kernel/git/broonie/regmap

Pull two more small regmap fixes from Mark Brown:
 - Now we have users for it that aren't running Android it turns out
   that regcache_sync_region() is much more useful to drivers if it's
   exported for use by modules.  Who knew?
 - Make sure we don't divide by zero when doing debugfs dumps of
   rbtrees, not visible up until now because everything was providing at
   least some cache on startup.

* tag 'regmap-3.4-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap:
  regmap: prevent division by zero in rbtree_show
  regmap: Export regcache_sync_region()

12 years agoMerge branch 'kvm-updates/3.4' of git://git.kernel.org/pub/scm/virt/kvm/kvm
Linus Torvalds [Sat, 7 Apr 2012 16:53:33 +0000 (09:53 -0700)]
Merge branch 'kvm-updates/3.4' of git://git./virt/kvm/kvm

Pull a few KVM fixes from Avi Kivity:
 "A bunch of powerpc KVM fixes, a guest and a host RCU fix (unrelated),
  and a small build fix."

* 'kvm-updates/3.4' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
  KVM: Resolve RCU vs. async page fault problem
  KVM: VMX: vmx_set_cr0 expects kvm->srcu locked
  KVM: PMU: Fix integer constant is too large warning in kvm_pmu_set_msr()
  KVM: PPC: Book3S: PR: Fix preemption
  KVM: PPC: Save/Restore CR over vcpu_run
  KVM: PPC: Book3S HV: Save and restore CR in __kvmppc_vcore_entry
  KVM: PPC: Book3S HV: Fix kvm_alloc_linear in case where no linears exist
  KVM: PPC: Book3S: Compile fix for ppc32 in HIOR access code

12 years agoMerge tag 'sh-for-linus' of git://github.com/pmundt/linux-sh
Linus Torvalds [Sat, 7 Apr 2012 16:52:46 +0000 (09:52 -0700)]
Merge tag 'sh-for-linus' of git://github.com/pmundt/linux-sh

Pull SuperH fixes from Paul Mundt.

* tag 'sh-for-linus' of git://github.com/pmundt/linux-sh:
  sh: fix clock-sh7757 for the latest sh_mobile_sdhi driver
  serial: sh-sci: use serial_port_in/out vs sci_in/out.
  sh: vsyscall: Fix up .eh_frame generation.
  sh: dma: Fix up device attribute mismatch from sysdev fallout.
  sh: dwarf unwinder depends on SHcompact.
  sh: fix up fallout from system.h disintegration.

12 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris...
Linus Torvalds [Sat, 7 Apr 2012 16:51:36 +0000 (09:51 -0700)]
Merge branch 'for-linus' of git://git./linux/kernel/git/jmorris/linux-security

Pull security layer fixlet from James Morris.

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security:
  sysctl: fix write access to dmesg_restrict/kptr_restrict

12 years agoMerge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux
Linus Torvalds [Sat, 7 Apr 2012 02:56:04 +0000 (19:56 -0700)]
Merge branch 'release' of git://git./linux/kernel/git/lenb/linux

Pull ACPI & Power Management patches from Len Brown:
 "Two fixes for cpuidle merge-window changes, plus a URL fix in
  MAINTAINERS"

* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux:
  MAINTAINERS: Update git url for ACPI
  cpuidle: Fix panic in CPU off-lining with no idle driver
  ACPI processor: Use safe_halt() rather than halt() in acpi_idle_play_dead()

12 years agoMerge branch '3.4-rc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/nab...
Linus Torvalds [Sat, 7 Apr 2012 02:54:26 +0000 (19:54 -0700)]
Merge branch '3.4-rc-fixes' of git://git./linux/kernel/git/nab/target-pending

Pull target fixes from Nicholas Bellinger:
 "Pull two tcm_fc fabric related fixes for -rc2:

  Note that both have been CC'ed to stable, and patch #1 is the
  important one that addresses a memory corruption bug related to FC
  exchange timeouts + command abort.

  Thanks again to MDR for tracking down this issue!"

* '3.4-rc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending:
  tcm_fc: Do not free tpg structure during wq allocation failure
  tcm_fc: Add abort flag for gracefully handling exchange timeout

12 years agotcm_fc: Do not free tpg structure during wq allocation failure
Mark Rustad [Tue, 3 Apr 2012 17:24:52 +0000 (10:24 -0700)]
tcm_fc: Do not free tpg structure during wq allocation failure

Avoid freeing a registered tpg structure if an alloc_workqueue call
fails.  This fixes a bug where the failure was leaking memory associated
with se_portal_group setup during the original core_tpg_register() call.

Signed-off-by: Mark Rustad <mark.d.rustad@intel.com>
Acked-by: Kiran Patil <Kiran.patil@intel.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
12 years agotcm_fc: Add abort flag for gracefully handling exchange timeout
Mark Rustad [Tue, 3 Apr 2012 17:24:41 +0000 (10:24 -0700)]
tcm_fc: Add abort flag for gracefully handling exchange timeout

Add abort flag and use it to terminate processing when an exchange
is timed out or is reset. The abort flag is used in place of the
transport_generic_free_cmd function call in the reset and timeout
cases, because calling that function in that context would free
memory that was in use. The aborted flag allows the lifetime to
be managed in a more normal way, while truncating the processing.

This change eliminates a source of memory corruption which
manifested in a variety of ugly ways.

(nab: Drop unused struct fc_exch *ep in ft_recv_seq)

Signed-off-by: Mark Rustad <mark.d.rustad@intel.com>
Acked-by: Kiran Patil <Kiran.patil@intel.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
12 years agoMerge branches 'idle-fix' and 'misc' into release
Len Brown [Sat, 7 Apr 2012 01:48:59 +0000 (21:48 -0400)]
Merge branches 'idle-fix' and 'misc' into release

12 years agoMAINTAINERS: Update git url for ACPI
Igor Murzov [Fri, 30 Mar 2012 18:40:12 +0000 (22:40 +0400)]
MAINTAINERS: Update git url for ACPI

Signed-off-by: Igor Murzov <e-mail@date.by>
Signed-off-by: Len Brown <len.brown@intel.com>
12 years agoMerge branch 'stable' of git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux...
Linus Torvalds [Sat, 7 Apr 2012 00:56:20 +0000 (17:56 -0700)]
Merge branch 'stable' of git://git./linux/kernel/git/cmetcalf/linux-tile

Pull arch/tile bug fixes from Chris Metcalf:
 "This includes Paul Gortmaker's change to fix the <asm/system.h>
  disintegration issues on tile, a fix to unbreak the tilepro ethernet
  driver, and a backlog of bugfix-only changes from internal Tilera
  development over the last few months.

  They have all been to LKML and on linux-next for the last few days.
  The EDAC change to MAINTAINERS is an oddity but discussion on the
  linux-edac list suggested I ask you to pull that change through my
  tree since they don't have a tree to pull edac changes from at the
  moment."

* 'stable' of git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile: (39 commits)
  drivers/net/ethernet/tile: fix netdev_alloc_skb() bombing
  MAINTAINERS: update EDAC information
  tilepro ethernet driver: fix a few minor issues
  tile-srom.c driver: minor code cleanup
  edac: say "TILEGx" not "TILEPro" for the tilegx edac driver
  arch/tile: avoid accidentally unmasking NMI-type interrupt accidentally
  arch/tile: remove bogus performance optimization
  arch/tile: return SIGBUS for addresses that are unaligned AND invalid
  arch/tile: fix finv_buffer_remote() for tilegx
  arch/tile: use atomic exchange in arch_write_unlock()
  arch/tile: stop mentioning the "kvm" subdirectory
  arch/tile: export the page_home() function.
  arch/tile: fix pointer cast in cacheflush.c
  arch/tile: fix single-stepping over swint1 instructions on tilegx
  arch/tile: implement panic_smp_self_stop()
  arch/tile: add "nop" after "nap" to help GX idle power draw
  arch/tile: use proper memparse() for "maxmem" options
  arch/tile: fix up locking in pgtable.c slightly
  arch/tile: don't leak kernel memory when we unload modules
  arch/tile: fix bug in delay_backoff()
  ...

12 years agoMerge tag 'stable/for-linus-3.4-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sat, 7 Apr 2012 00:54:53 +0000 (17:54 -0700)]
Merge tag 'stable/for-linus-3.4-rc1-tag' of git://git./linux/kernel/git/konrad/xen

Pull xen fixes from Konrad Rzeszutek Wilk:
 "Two fixes for regressions:
   * one is a workaround that will be removed in v3.5 with proper fix in
     the tip/x86 tree,
   * the other is to fix drivers to load on PV (a previous patch made
     them only load in PVonHVM mode).

  The rest are just minor fixes in the various drivers and some cleanup
  in the core code."

* tag 'stable/for-linus-3.4-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen:
  xen/pcifront: avoid pci_frontend_enable_msix() falsely returning success
  xen/pciback: fix XEN_PCI_OP_enable_msix result
  xen/smp: Remove unnecessary call to smp_processor_id()
  xen/x86: Workaround 'x86/ioapic: Add register level checks to detect bogus io-apic entries'
  xen: only check xen_platform_pci_unplug if hvm

12 years agoMerge tag 'mmc-fixes-for-3.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sat, 7 Apr 2012 00:22:23 +0000 (17:22 -0700)]
Merge tag 'mmc-fixes-for-3.4-rc2' of git://git./linux/kernel/git/cjb/mmc

Pull MMC fixes from Chris Ball:
 - Disable use of MSI in sdhci-pci, which caused multiple chipsets to
   stop working in 3.4-rc1.  I'll wait to turn this on again until we
   have a chipset whitelist for it.
 - Fix a libertas SDIO powered-resume regression introduced in 3.3;
   thanks to Neil Brown and Rafael Wysocki for this fix.
 - Fix module reloading on omap_hsmmc.
 - Stop trusting the spec/card's specified maximum data timeout length,
   and use three seconds instead.  Previously we used 300ms.

Also cleanups and fixes for s3c, atmel, sh_mmcif and omap_hsmmc.

* tag 'mmc-fixes-for-3.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc: (28 commits)
  mmc: use really long write timeout to deal with crappy cards
  mmc: sdhci-dove: Fix compile error by including module.h
  mmc: Prevent 1.8V switch for SD hosts that don't support UHS modes.
  Revert "mmc: sdhci-pci: Add MSI support"
  Revert "mmc: sdhci-pci: add quirks for broken MSI on O2Micro controllers"
  mmc: core: fix power class selection
  mmc: omap_hsmmc: fix module re-insertion
  mmc: omap_hsmmc: convert to module_platform_driver
  mmc: omap_hsmmc: make it behave well as a module
  mmc: omap_hsmmc: trivial cleanups
  mmc: omap_hsmmc: context save after enabling runtime pm
  mmc: omap_hsmmc: use runtime put sync in probe error patch
  mmc: sdio: Use empty system suspend/resume callbacks at the bus level
  mmc: bus: print bus speed mode of UHS-I card
  mmc: sdhci-pci: add quirks for broken MSI on O2Micro controllers
  mmc: sh_mmcif: Simplify calculation of mmc->f_min
  mmc: sh_mmcif: mmc->f_max should be half of the bus clock
  mmc: sh_mmcif: double clock speed
  mmc: block: Remove use of mmc_blk_set_blksize
  mmc: atmel-mci: add support for odd clock dividers
  ...

12 years agoMake the "word-at-a-time" helper functions more commonly usable
Linus Torvalds [Fri, 6 Apr 2012 20:54:56 +0000 (13:54 -0700)]
Make the "word-at-a-time" helper functions more commonly usable

I have a new optimized x86 "strncpy_from_user()" that will use these
same helper functions for all the same reasons the name lookup code uses
them.  This is preparation for that.

This moves them into an architecture-specific header file.  It's
architecture-specific for two reasons:

 - some of the functions are likely to want architecture-specific
   implementations.  Even if the current code happens to be "generic" in
   the sense that it should work on any little-endian machine, it's
   likely that the "multiply by a big constant and shift" implementation
   is less than optimal for an architecture that has a guaranteed fast
   bit count instruction, for example.

 - I expect that if architectures like sparc want to start playing
   around with this, we'll need to abstract out a few more details (in
   particular the actual unaligned accesses).  So we're likely to have
   more architecture-specific stuff if non-x86 architectures start using
   this.

   (and if it turns out that non-x86 architectures don't start using
   this, then having it in an architecture-specific header is still the
   right thing to do, of course)

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agocpuidle: Fix panic in CPU off-lining with no idle driver
Toshi Kani [Sun, 1 Apr 2012 03:37:02 +0000 (21:37 -0600)]
cpuidle: Fix panic in CPU off-lining with no idle driver

Fix a NULL pointer dereference panic in cpuidle_play_dead() during
CPU off-lining when no cpuidle driver is registered.  A cpuidle
driver may be registered at boot-time based on CPU type.  This patch
allows an off-lined CPU to enter HLT-based idle in this condition.

Signed-off-by: Toshi Kani <toshi.kani@hp.com>
Cc: Boris Ostrovsky <boris.ostrovsky@amd.com>
Reviewed-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Tested-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Signed-off-by: Len Brown <len.brown@intel.com>
12 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Linus Torvalds [Fri, 6 Apr 2012 17:37:38 +0000 (10:37 -0700)]
Merge git://git./linux/kernel/git/davem/net

Pull networking updates from David Miller:

 1) Fix inaccuracies in network driver interface documentation, from Ben
    Hutchings.

 2) Fix handling of negative offsets in BPF JITs, from Jan Seiffert.

 3) Compile warning, locking, and refcounting fixes in netfilter's
    xt_CT, from Pablo Neira Ayuso.

 4) phonet sendmsg needs to validate user length just like any other
    datagram protocol, fix from Sasha Levin.

 5) Ipv6 multicast code uses wrong loop index, from RongQing Li.

 6) Link handling and firmware fixes in bnx2x driver from Yaniv Rosner
    and Yuval Mintz.

 7) mlx4 erroneously allocates 4 pages at a time, regardless of page
    size, fix from Thadeu Lima de Souza Cascardo.

 8) SCTP socket option wasn't extended in a backwards compatible way,
    fix from Thomas Graf.

 9) Add missing address change event emissions to bonding, from Shlomo
    Pongratz.

10) /proc/net/dev regressed because it uses a private offset to track
    where we are in the hash table, but this doesn't track the offset
    pullback that the seq_file code does resulting in some entries being
    missed in large dumps.

    Fix from Eric Dumazet.

11) do_tcp_sendpage() unloads the send queue way too fast, because it
    invokes tcp_push() when it shouldn't.  Let the natural sequence
    generated by the splice paths, and the assosciated MSG_MORE
    settings, guide the tcp_push() calls.

    Otherwise what goes out of TCP is spaghetti and doesn't batch
    effectively into GSO/TSO clusters.

    From Eric Dumazet.

12) Once we put a SKB into either the netlink receiver's queue or a
    socket error queue, it can be consumed and freed up, therefore we
    cannot touch it after queueing it like that.

    Fixes from Eric Dumazet.

13) PPP has this annoying behavior in that for every transmit call it
    immediately stops the TX queue, then calls down into the next layer
    to transmit the PPP frame.

    But if that next layer can take it immediately, it just un-stops the
    TX queue right before returning from the transmit method.

    Besides being useless work, it makes several facilities unusable, in
    particular things like the equalizers.  Well behaved devices should
    only stop the TX queue when they really are full, and in PPP's case
    when it gets backlogged to the downstream device.

    David Woodhouse therefore fixed PPP to not stop the TX queue until
    it's downstream can't take data any more.

14) IFF_UNICAST_FLT got accidently lost in some recent stmmac driver
    changes, re-add.  From Marc Kleine-Budde.

15) Fix link flaps in ixgbe, from Eric W. Multanen.

16) Descriptor writeback fixes in e1000e from Matthew Vick.

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (47 commits)
  net: fix a race in sock_queue_err_skb()
  netlink: fix races after skb queueing
  doc, net: Update ndo_start_xmit return type and values
  doc, net: Remove instruction to set net_device::trans_start
  doc, net: Update netdev operation names
  doc, net: Update documentation of synchronisation for TX multiqueue
  doc, net: Remove obsolete reference to dev->poll
  ethtool: Remove exception to the requirement of holding RTNL lock
  MAINTAINERS: update for Marvell Ethernet drivers
  bonding: properly unset current_arp_slave on slave link up
  phonet: Check input from user before allocating
  tcp: tcp_sendpages() should call tcp_push() once
  ipv6: fix array index in ip6_mc_add_src()
  mlx4: allocate just enough pages instead of always 4 pages
  stmmac: re-add IFF_UNICAST_FLT for dwmac1000
  bnx2x: Clear MDC/MDIO warning message
  bnx2x: Fix BCM57711+BCM84823 link issue
  bnx2x: Clear BCM84833 LED after fan failure
  bnx2x: Fix BCM84833 PHY FW version presentation
  bnx2x: Fix link issue for BCM8727 boards.
  ...

12 years agoxen/pcifront: avoid pci_frontend_enable_msix() falsely returning success
Jan Beulich [Mon, 2 Apr 2012 14:22:39 +0000 (15:22 +0100)]
xen/pcifront: avoid pci_frontend_enable_msix() falsely returning success

The original XenoLinux code has always had things this way, and for
compatibility reasons (in particular with a subsequent pciback
adjustment) upstream Linux should behave the same way (allowing for two
distinct error indications to be returned by the backend).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
12 years agoxen/pciback: fix XEN_PCI_OP_enable_msix result
Jan Beulich [Mon, 2 Apr 2012 14:32:22 +0000 (15:32 +0100)]
xen/pciback: fix XEN_PCI_OP_enable_msix result

Prior to 2.6.19 and as of 2.6.31, pci_enable_msix() can return a
positive value to indicate the number of vectors (less than the amount
requested) that can be set up for a given device. Returning this as an
operation value (secondary result) is fine, but (primary) operation
results are expected to be negative (error) or zero (success) according
to the protocol. With the frontend fixed to match the XenoLinux
behavior, the backend can now validly return zero (success) here,
passing the upper limit on the number of vectors in op->value.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>