TTY pull request for 3.5-rc1

Here's the big TTY/serial driver pull request for the 3.5-rc1 merge window.
 
 Nothing major in here, just lots of incremental changes from Alan and
 Jiri reworking some tty core things to behave better and to get a more
 solid grasp on some of the nasty tty locking issues.
 
 There are a few tty and serial driver updates in here as well.
 
 All of this has been in the linux-next releases for a while with no problems.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.18 (GNU/Linux)
 
 iEYEABECAAYFAk+7rBoACgkQMUfUDdst+ykXsgCfeDKx6ZgLidYy3H40Y2Pt3XEO
 TicAn1fcdGwOmMR/mowa+kTA68D/J6i2
 =S7tG
 -----END PGP SIGNATURE-----

Merge tag 'tty-3.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty

Pull TTY updates from Greg Kroah-Hartman:
 "Here's the big TTY/serial driver pull request for the 3.5-rc1 merge
  window.

  Nothing major in here, just lots of incremental changes from Alan and
  Jiri reworking some tty core things to behave better and to get a more
  solid grasp on some of the nasty tty locking issues.

  There are a few tty and serial driver updates in here as well.

  All of this has been in the linux-next releases for a while with no
  problems.

  Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>"

* tag 'tty-3.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: (115 commits)
  serial: bfin_uart: Make MMR access compatible with 32 bits bf609 style controller.
  serial: bfin_uart: RTS and CTS MMRs can be either 16-bit width or 32-bit width.
  serial: bfin_uart: narrow the reboot condition in DMA tx interrupt
  serial: bfin_uart: Adapt bf5xx serial driver to bf60x serial4 controller.
  Revert "serial_core: Update buffer overrun statistics."
  tty: hvc_xen: NULL dereference on allocation failure
  tty: Fix LED error return
  tty: Allow uart_register/unregister/register
  tty: move global ldisc idle waitqueue to the individual ldisc
  serial8250-em: Add DT support
  serial8250-em: clk_get() IS_ERR() error handling fix
  serial_core: Update buffer overrun statistics.
  tty: drop the pty lock during hangup
  cris: fix missing tty arg in wait_event_interruptible_tty call
  tty/amiserial: Add missing argument for tty_unlock()
  tty_lock: Localise the lock
  pty: Lock the devpts bits privately
  tty_lock: undo the old tty_lock use on the ctty
  serial8250-em: Emma Mobile UART driver V2
  Add missing call to uart_update_timeout()
  ...
This commit is contained in:
Linus Torvalds 2012-05-22 16:12:24 -07:00
commit 94b5aff4c6
67 changed files with 1899 additions and 1979 deletions

View file

@ -4,7 +4,6 @@
* Copyright (C) 1998 R.E.Wolff@BitWizard.nl
*
* written for the SX serial driver.
* Contains the code that should be shared over all the serial drivers.
*
* Version 0.1 -- December, 1998.
*/
@ -12,45 +11,8 @@
#ifndef GENERIC_SERIAL_H
#define GENERIC_SERIAL_H
#ifdef __KERNEL__
#include <linux/mutex.h>
#include <linux/tty.h>
struct real_driver {
void (*disable_tx_interrupts) (void *);
void (*enable_tx_interrupts) (void *);
void (*disable_rx_interrupts) (void *);
void (*enable_rx_interrupts) (void *);
void (*shutdown_port) (void*);
int (*set_real_termios) (void*);
int (*chars_in_buffer) (void*);
void (*close) (void*);
void (*hungup) (void*);
void (*getserial) (void*, struct serial_struct *sp);
};
struct gs_port {
int magic;
struct tty_port port;
unsigned char *xmit_buf;
int xmit_head;
int xmit_tail;
int xmit_cnt;
struct mutex port_write_mutex;
unsigned long event;
unsigned short closing_wait;
int close_delay;
struct real_driver *rd;
int wakeup_chars;
int baud_base;
int baud;
int custom_divisor;
spinlock_t driver_lock;
};
#endif /* __KERNEL__ */
#warning Use of this header is deprecated.
#warning Since nobody sets the constants defined here for you, you should not, in any case, use them. Including the header is thus pointless.
/* Flags */
/* Warning: serial.h defines some ASYNC_ flags, they say they are "only"
@ -60,8 +22,6 @@ struct gs_port {
#define GS_RX_INTEN 0x00400000
#define GS_ACTIVE 0x00200000
#define GS_TYPE_NORMAL 1
#define GS_DEBUG_FLUSH 0x00000001
@ -72,24 +32,4 @@ struct gs_port {
#define GS_DEBUG_FLOW 0x00000020
#define GS_DEBUG_WRITE 0x00000040
#ifdef __KERNEL__
int gs_put_char(struct tty_struct *tty, unsigned char ch);
int gs_write(struct tty_struct *tty,
const unsigned char *buf, int count);
int gs_write_room(struct tty_struct *tty);
int gs_chars_in_buffer(struct tty_struct *tty);
void gs_flush_buffer(struct tty_struct *tty);
void gs_flush_chars(struct tty_struct *tty);
void gs_stop(struct tty_struct *tty);
void gs_start(struct tty_struct *tty);
void gs_hangup(struct tty_struct *tty);
int gs_block_til_ready(void *port, struct file *filp);
void gs_close(struct tty_struct *tty, struct file *filp);
void gs_set_termios (struct tty_struct * tty,
struct ktermios * old_termios);
int gs_init_port(struct gs_port *port);
int gs_setserial(struct gs_port *port, struct serial_struct __user *sp);
int gs_getserial(struct gs_port *port, struct serial_struct __user *sp);
void gs_got_break(struct gs_port *port);
#endif /* __KERNEL__ */
#endif

View file

@ -15,6 +15,7 @@
#define __ISDN_H__
#include <linux/ioctl.h>
#include <linux/tty.h>
#define ISDN_MAX_DRIVERS 32
#define ISDN_MAX_CHANNELS 64
@ -392,21 +393,8 @@ typedef struct isdn_net_dev_s {
/*======================= Start of ISDN-tty stuff ===========================*/
#define ISDN_ASYNC_MAGIC 0x49344C01 /* for paranoia-checking */
#define ISDN_ASYNC_INITIALIZED 0x80000000 /* port was initialized */
#define ISDN_ASYNC_CALLOUT_ACTIVE 0x40000000 /* Call out device active */
#define ISDN_ASYNC_NORMAL_ACTIVE 0x20000000 /* Normal device active */
#define ISDN_ASYNC_CLOSING 0x08000000 /* Serial port is closing */
#define ISDN_ASYNC_CTS_FLOW 0x04000000 /* Do CTS flow control */
#define ISDN_ASYNC_CHECK_CD 0x02000000 /* i.e., CLOCAL */
#define ISDN_ASYNC_HUP_NOTIFY 0x0001 /* Notify tty on hangups/closes */
#define ISDN_ASYNC_SESSION_LOCKOUT 0x0100 /* Lock cua opens on session */
#define ISDN_ASYNC_PGRP_LOCKOUT 0x0200 /* Lock cua opens on pgrp */
#define ISDN_ASYNC_CALLOUT_NOHUP 0x0400 /* No hangup for cui */
#define ISDN_ASYNC_SPLIT_TERMIOS 0x0008 /* Sep. termios for dialin/out */
#define ISDN_SERIAL_XMIT_SIZE 1024 /* Default bufsize for write */
#define ISDN_SERIAL_XMIT_MAX 4000 /* Maximum bufsize for write */
#define ISDN_SERIAL_TYPE_NORMAL 1
#define ISDN_SERIAL_TYPE_CALLOUT 2
#ifdef CONFIG_ISDN_AUDIO
/* For using sk_buffs with audio we need some private variables
@ -448,17 +436,12 @@ typedef struct atemu {
/* Private data (similar to async_struct in <linux/serial.h>) */
typedef struct modem_info {
int magic;
struct module *owner;
int flags; /* defined in tty.h */
struct tty_port port;
int x_char; /* xon/xoff character */
int mcr; /* Modem control register */
int msr; /* Modem status register */
int lsr; /* Line status register */
int line;
int count; /* # of fd on device */
int blocked_open; /* # of blocked opens */
long session; /* Session of opening process */
long pgrp; /* pgrp of opening process */
int online; /* 1 = B-Channel is up, drop data */
/* 2 = B-Channel is up, deliver d.*/
int dialing; /* Dial in progress or ATA */
@ -478,7 +461,6 @@ typedef struct modem_info {
int send_outstanding;/* # of outstanding send-requests */
int xmit_size; /* max. # of chars in xmit_buf */
int xmit_count; /* # of chars in xmit_buf */
unsigned char *xmit_buf; /* transmit buffer */
struct sk_buff_head xmit_queue; /* transmit queue */
atomic_t xmit_lock; /* Semaphore for isdn_tty_write */
#ifdef CONFIG_ISDN_AUDIO
@ -496,11 +478,7 @@ typedef struct modem_info {
struct T30_s *fax; /* T30 Fax Group 3 data/interface */
int faxonline; /* Fax-channel status */
#endif
struct tty_struct *tty; /* Pointer to corresponding tty */
atemu emu; /* AT-emulator data */
struct ktermios normal_termios; /* For saving termios structs */
struct ktermios callout_termios;
wait_queue_head_t open_wait, close_wait;
spinlock_t readlock;
} modem_info;

17
include/linux/of_serial.h Normal file
View file

@ -0,0 +1,17 @@
#ifndef __LINUX_OF_SERIAL_H
#define __LINUX_OF_SERIAL_H
/*
* FIXME remove this file when tegra finishes conversion to open firmware,
* expectation is that all quirks will then be self-contained in
* drivers/tty/serial/of_serial.c.
*/
#ifdef CONFIG_ARCH_TEGRA
extern void tegra_serial_handle_break(struct uart_port *port);
#else
static inline void tegra_serial_handle_break(struct uart_port *port)
{
}
#endif
#endif /* __LINUX_OF_SERIAL */

View file

@ -38,6 +38,7 @@ struct plat_serial8250_port {
int (*handle_irq)(struct uart_port *);
void (*pm)(struct uart_port *, unsigned int state,
unsigned old);
void (*handle_break)(struct uart_port *);
};
/*
@ -68,6 +69,7 @@ enum {
struct uart_port;
struct uart_8250_port;
int serial8250_register_8250_port(struct uart_8250_port *);
int serial8250_register_port(struct uart_port *);
void serial8250_unregister_port(int line);
void serial8250_suspend_port(int line);

View file

@ -310,6 +310,7 @@ struct uart_port {
int (*handle_irq)(struct uart_port *);
void (*pm)(struct uart_port *, unsigned int state,
unsigned int old);
void (*handle_break)(struct uart_port *);
unsigned int irq; /* irq number */
unsigned long irqflags; /* irq flags */
unsigned int uartclk; /* base uart clock */
@ -533,6 +534,10 @@ uart_handle_sysrq_char(struct uart_port *port, unsigned int ch)
static inline int uart_handle_break(struct uart_port *port)
{
struct uart_state *state = port->state;
if (port->handle_break)
port->handle_break(port);
#ifdef SUPPORT_SYSRQ
if (port->cons && port->cons->index == port->line) {
if (!port->sysrq) {

View file

@ -268,6 +268,7 @@ struct tty_struct {
struct mutex ldisc_mutex;
struct tty_ldisc *ldisc;
struct mutex legacy_mutex;
struct mutex termios_mutex;
spinlock_t ctrl_lock;
/* Termios values are protected by the termios mutex */
@ -605,8 +606,12 @@ extern long vt_compat_ioctl(struct tty_struct *tty,
/* tty_mutex.c */
/* functions for preparation of BKL removal */
extern void __lockfunc tty_lock(void) __acquires(tty_lock);
extern void __lockfunc tty_unlock(void) __releases(tty_lock);
extern void __lockfunc tty_lock(struct tty_struct *tty);
extern void __lockfunc tty_unlock(struct tty_struct *tty);
extern void __lockfunc tty_lock_pair(struct tty_struct *tty,
struct tty_struct *tty2);
extern void __lockfunc tty_unlock_pair(struct tty_struct *tty,
struct tty_struct *tty2);
/*
* this shall be called only from where BTM is held (like close)
@ -621,9 +626,9 @@ extern void __lockfunc tty_unlock(void) __releases(tty_lock);
static inline void tty_wait_until_sent_from_close(struct tty_struct *tty,
long timeout)
{
tty_unlock(); /* tty->ops->close holds the BTM, drop it while waiting */
tty_unlock(tty); /* tty->ops->close holds the BTM, drop it while waiting */
tty_wait_until_sent(tty, timeout);
tty_lock();
tty_lock(tty);
}
/*
@ -638,16 +643,16 @@ static inline void tty_wait_until_sent_from_close(struct tty_struct *tty,
*
* Do not use in new code.
*/
#define wait_event_interruptible_tty(wq, condition) \
#define wait_event_interruptible_tty(tty, wq, condition) \
({ \
int __ret = 0; \
if (!(condition)) { \
__wait_event_interruptible_tty(wq, condition, __ret); \
__wait_event_interruptible_tty(tty, wq, condition, __ret); \
} \
__ret; \
})
#define __wait_event_interruptible_tty(wq, condition, ret) \
#define __wait_event_interruptible_tty(tty, wq, condition, ret) \
do { \
DEFINE_WAIT(__wait); \
\
@ -656,9 +661,9 @@ do { \
if (condition) \
break; \
if (!signal_pending(current)) { \
tty_unlock(); \
tty_unlock(tty); \
schedule(); \
tty_lock(); \
tty_lock(tty); \
continue; \
} \
ret = -ERESTARTSYS; \

View file

@ -110,6 +110,7 @@
#include <linux/fs.h>
#include <linux/wait.h>
#include <linux/pps_kernel.h>
#include <linux/wait.h>
struct tty_ldisc_ops {
int magic;
@ -154,6 +155,7 @@ struct tty_ldisc_ops {
struct tty_ldisc {
struct tty_ldisc_ops *ops;
atomic_t users;
wait_queue_head_t wq_idle;
};
#define TTY_LDISC_MAGIC 0x5403

View file

@ -70,7 +70,6 @@ int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list);
int con_get_unimap(struct vc_data *vc, ushort ct, ushort __user *uct, struct unipair __user *list);
int con_set_default_unimap(struct vc_data *vc);
void con_free_unimap(struct vc_data *vc);
void con_protect_unimap(struct vc_data *vc, int rdonly);
int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc);
#define vc_translate(vc, c) ((vc)->vc_translate[(c) | \