Skip to content

Commit

Permalink
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6
Browse files Browse the repository at this point in the history
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6: (79 commits)
  USB serial: update the console driver
  usb-serial: straighten out serial_open
  usb-serial: add missing tests and debug lines
  usb-serial: rename subroutines
  usb-serial: fix termios initialization logic
  usb-serial: acquire references when a new tty is installed
  usb-serial: change logic of serial lookups
  usb-serial: put subroutines in logical order
  usb-serial: change referencing of port and serial structures
  tty: Char: mxser, use THRE for ASPP_OQUEUE ioctl
  tty: Char: mxser, add support for CP112UL
  uartlite: support shared interrupt lines
  tty: USB: serial/mct_u232, fix tty refcnt
  tty: riscom8, fix tty refcnt
  tty: riscom8, fix shutdown declaration
  TTY: fix typos
  tty: Power: fix suspend vt regression
  tty: vt: use printk_once
  tty: handle VT specific compat ioctls in vt driver
  n_tty: move echoctl check and clean up logic
  ...
  • Loading branch information
torvalds committed Sep 20, 2009
2 parents 467f995 + 7bd032d commit e11c675
Show file tree
Hide file tree
Showing 118 changed files with 2,578 additions and 3,576 deletions.
6 changes: 3 additions & 3 deletions arch/mn10300/kernel/asm-offsets.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ void foo(void)
OFFSET(__iobase, mn10300_serial_port, _iobase);

DEFINE(__UART_XMIT_SIZE, UART_XMIT_SIZE);
OFFSET(__xmit_buffer, uart_info, xmit.buf);
OFFSET(__xmit_head, uart_info, xmit.head);
OFFSET(__xmit_tail, uart_info, xmit.tail);
OFFSET(__xmit_buffer, uart_state, xmit.buf);
OFFSET(__xmit_head, uart_state, xmit.head);
OFFSET(__xmit_tail, uart_state, xmit.tail);
}
2,323 changes: 580 additions & 1,743 deletions drivers/char/cyclades.c

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions drivers/char/esp.c
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ static void check_modem_status(struct esp_struct *info)
info->icount.dcd++;
if (status & UART_MSR_DCTS)
info->icount.cts++;
wake_up_interruptible(&info->delta_msr_wait);
wake_up_interruptible(&info->port.delta_msr_wait);
}

if ((info->port.flags & ASYNC_CHECK_CD) && (status & UART_MSR_DDCD)) {
Expand Down Expand Up @@ -927,7 +927,7 @@ static void shutdown(struct esp_struct *info)
* clear delta_msr_wait queue to avoid mem leaks: we may free the irq
* here so the queue might never be waken up
*/
wake_up_interruptible(&info->delta_msr_wait);
wake_up_interruptible(&info->port.delta_msr_wait);
wake_up_interruptible(&info->break_wait);

/* stop a DMA transfer on the port being closed */
Expand Down Expand Up @@ -1800,7 +1800,7 @@ static int rs_ioctl(struct tty_struct *tty, struct file *file,
spin_unlock_irqrestore(&info->lock, flags);
while (1) {
/* FIXME: convert to new style wakeup */
interruptible_sleep_on(&info->delta_msr_wait);
interruptible_sleep_on(&info->port.delta_msr_wait);
/* see if a signal did it */
if (signal_pending(current))
return -ERESTARTSYS;
Expand Down Expand Up @@ -2452,7 +2452,6 @@ static int __init espserial_init(void)
info->config.flow_off = flow_off;
info->config.pio_threshold = pio_threshold;
info->next_port = ports;
init_waitqueue_head(&info->delta_msr_wait);
init_waitqueue_head(&info->break_wait);
ports = info;
printk(KERN_INFO "ttyP%d at 0x%04x (irq = %d) is an ESP ",
Expand Down
57 changes: 38 additions & 19 deletions drivers/char/isicom.c
Original file line number Diff line number Diff line change
Expand Up @@ -846,37 +846,53 @@ static int isicom_carrier_raised(struct tty_port *port)
return (ip->status & ISI_DCD)?1 : 0;
}

static int isicom_open(struct tty_struct *tty, struct file *filp)
static struct tty_port *isicom_find_port(struct tty_struct *tty)
{
struct isi_port *port;
struct isi_board *card;
unsigned int board;
int error, line;
int line = tty->index;

line = tty->index;
if (line < 0 || line > PORT_COUNT-1)
return -ENODEV;
return NULL;
board = BOARD(line);
card = &isi_card[board];

if (!(card->status & FIRMWARE_LOADED))
return -ENODEV;
return NULL;

/* open on a port greater than the port count for the card !!! */
if (line > ((board * 16) + card->port_count - 1))
return -ENODEV;
return NULL;

port = &isi_ports[line];
if (isicom_paranoia_check(port, tty->name, "isicom_open"))
return -ENODEV;
return NULL;

return &port->port;
}

static int isicom_open(struct tty_struct *tty, struct file *filp)
{
struct isi_port *port;
struct isi_board *card;
struct tty_port *tport;
int error = 0;

tport = isicom_find_port(tty);
if (tport == NULL)
return -ENODEV;
port = container_of(tport, struct isi_port, port);
card = &isi_card[BOARD(tty->index)];
isicom_setup_board(card);

/* FIXME: locking on port.count etc */
port->port.count++;
tty->driver_data = port;
tty_port_tty_set(&port->port, tty);
error = isicom_setup_port(tty);
/* FIXME: Locking on Initialized flag */
if (!test_bit(ASYNCB_INITIALIZED, &tport->flags))
error = isicom_setup_port(tty);
if (error == 0)
error = tty_port_block_til_ready(&port->port, tty, filp);
return error;
Expand Down Expand Up @@ -952,19 +968,12 @@ static void isicom_flush_buffer(struct tty_struct *tty)
tty_wakeup(tty);
}

static void isicom_close(struct tty_struct *tty, struct file *filp)
static void isicom_close_port(struct tty_port *port)
{
struct isi_port *ip = tty->driver_data;
struct tty_port *port = &ip->port;
struct isi_board *card;
struct isi_port *ip = container_of(port, struct isi_port, port);
struct isi_board *card = ip->card;
unsigned long flags;

BUG_ON(!ip);

card = ip->card;
if (isicom_paranoia_check(ip, tty->name, "isicom_close"))
return;

/* indicate to the card that no more data can be received
on this port */
spin_lock_irqsave(&card->card_lock, flags);
Expand All @@ -974,9 +983,19 @@ static void isicom_close(struct tty_struct *tty, struct file *filp)
}
isicom_shutdown_port(ip);
spin_unlock_irqrestore(&card->card_lock, flags);
}

static void isicom_close(struct tty_struct *tty, struct file *filp)
{
struct isi_port *ip = tty->driver_data;
struct tty_port *port = &ip->port;
if (isicom_paranoia_check(ip, tty->name, "isicom_close"))
return;

if (tty_port_close_start(port, tty, filp) == 0)
return;
isicom_close_port(port);
isicom_flush_buffer(tty);

tty_port_close_end(port, tty);
}

Expand Down
62 changes: 32 additions & 30 deletions drivers/char/mxser.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

#include "mxser.h"

#define MXSER_VERSION "2.0.4" /* 1.12 */
#define MXSER_VERSION "2.0.5" /* 1.14 */
#define MXSERMAJOR 174

#define MXSER_BOARDS 4 /* Max. boards */
Expand All @@ -69,6 +69,7 @@
#define PCI_DEVICE_ID_POS104UL 0x1044
#define PCI_DEVICE_ID_CB108 0x1080
#define PCI_DEVICE_ID_CP102UF 0x1023
#define PCI_DEVICE_ID_CP112UL 0x1120
#define PCI_DEVICE_ID_CB114 0x1142
#define PCI_DEVICE_ID_CP114UL 0x1143
#define PCI_DEVICE_ID_CB134I 0x1341
Expand Down Expand Up @@ -139,7 +140,8 @@ static const struct mxser_cardinfo mxser_cards[] = {
{ "CP-138U series", 8, },
{ "POS-104UL series", 4, },
{ "CP-114UL series", 4, },
/*30*/ { "CP-102UF series", 2, }
/*30*/ { "CP-102UF series", 2, },
{ "CP-112UL series", 2, },
};

/* driver_data correspond to the lines in the structure above
Expand Down Expand Up @@ -170,6 +172,7 @@ static struct pci_device_id mxser_pcibrds[] = {
{ PCI_VDEVICE(MOXA, PCI_DEVICE_ID_POS104UL), .driver_data = 28 },
{ PCI_VDEVICE(MOXA, PCI_DEVICE_ID_CP114UL), .driver_data = 29 },
{ PCI_VDEVICE(MOXA, PCI_DEVICE_ID_CP102UF), .driver_data = 30 },
{ PCI_VDEVICE(MOXA, PCI_DEVICE_ID_CP112UL), .driver_data = 31 },
{ }
};
MODULE_DEVICE_TABLE(pci, mxser_pcibrds);
Expand Down Expand Up @@ -258,7 +261,6 @@ struct mxser_port {
struct mxser_mon mon_data;

spinlock_t slock;
wait_queue_head_t delta_msr_wait;
};

struct mxser_board {
Expand Down Expand Up @@ -818,7 +820,7 @@ static void mxser_check_modem_status(struct tty_struct *tty,
if (status & UART_MSR_DCTS)
port->icount.cts++;
port->mon_data.modem_status = status;
wake_up_interruptible(&port->delta_msr_wait);
wake_up_interruptible(&port->port.delta_msr_wait);

if ((port->port.flags & ASYNC_CHECK_CD) && (status & UART_MSR_DDCD)) {
if (status & UART_MSR_DCD)
Expand Down Expand Up @@ -973,7 +975,7 @@ static void mxser_shutdown(struct tty_struct *tty)
* clear delta_msr_wait queue to avoid mem leaks: we may free the irq
* here so the queue might never be waken up
*/
wake_up_interruptible(&info->delta_msr_wait);
wake_up_interruptible(&info->port.delta_msr_wait);

/*
* Free the IRQ, if necessary
Expand Down Expand Up @@ -1073,34 +1075,17 @@ static void mxser_flush_buffer(struct tty_struct *tty)
}


/*
* This routine is called when the serial port gets closed. First, we
* wait for the last remaining data to be sent. Then, we unlink its
* async structure from the interrupt chain if necessary, and we free
* that IRQ if nothing is left in the chain.
*/
static void mxser_close(struct tty_struct *tty, struct file *filp)
static void mxser_close_port(struct tty_struct *tty, struct tty_port *port)
{
struct mxser_port *info = tty->driver_data;
struct tty_port *port = &info->port;

struct mxser_port *info = container_of(port, struct mxser_port, port);
unsigned long timeout;

if (tty->index == MXSER_PORTS)
return;
if (!info)
return;

if (tty_port_close_start(port, tty, filp) == 0)
return;

/*
* Save the termios structure, since this port may have
* separate termios for callout and dialin.
*
* FIXME: Can this go ?
*/
if (info->port.flags & ASYNC_NORMAL_ACTIVE)
if (port->flags & ASYNC_NORMAL_ACTIVE)
info->normal_termios = *tty->termios;
/*
* At this point we stop accepting input. To do this, we
Expand All @@ -1112,7 +1097,7 @@ static void mxser_close(struct tty_struct *tty, struct file *filp)
if (info->board->chip_flag)
info->IER &= ~MOXA_MUST_RECV_ISR;

if (info->port.flags & ASYNC_INITIALIZED) {
if (port->flags & ASYNC_INITIALIZED) {
outb(info->IER, info->ioaddr + UART_IER);
/*
* Before we drop DTR, make sure the UART transmitter
Expand All @@ -1127,8 +1112,26 @@ static void mxser_close(struct tty_struct *tty, struct file *filp)
}
}
mxser_shutdown(tty);
mxser_flush_buffer(tty);

}

/*
* This routine is called when the serial port gets closed. First, we
* wait for the last remaining data to be sent. Then, we unlink its
* async structure from the interrupt chain if necessary, and we free
* that IRQ if nothing is left in the chain.
*/
static void mxser_close(struct tty_struct *tty, struct file *filp)
{
struct mxser_port *info = tty->driver_data;
struct tty_port *port = &info->port;

if (tty->index == MXSER_PORTS)
return;
if (tty_port_close_start(port, tty, filp) == 0)
return;
mxser_close_port(tty, port);
mxser_flush_buffer(tty);
/* Right now the tty_port set is done outside of the close_end helper
as we don't yet have everyone using refcounts */
tty_port_close_end(port, tty);
Expand Down Expand Up @@ -1761,7 +1764,7 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file,
cnow = info->icount; /* note the counters on entry */
spin_unlock_irqrestore(&info->slock, flags);

return wait_event_interruptible(info->delta_msr_wait,
return wait_event_interruptible(info->port.delta_msr_wait,
mxser_cflags_changed(info, arg, &cnow));
/*
* Get counter of input serial line interrupts (DCD,RI,DSR,CTS)
Expand Down Expand Up @@ -1803,7 +1806,7 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file,

lock_kernel();
len = mxser_chars_in_buffer(tty);
lsr = inb(info->ioaddr + UART_LSR) & UART_LSR_TEMT;
lsr = inb(info->ioaddr + UART_LSR) & UART_LSR_THRE;
len += (lsr ? 0 : 1);
unlock_kernel();

Expand Down Expand Up @@ -2413,7 +2416,6 @@ static int __devinit mxser_initbrd(struct mxser_board *brd,
info->port.close_delay = 5 * HZ / 10;
info->port.closing_wait = 30 * HZ;
info->normal_termios = mxvar_sdriver->init_termios;
init_waitqueue_head(&info->delta_msr_wait);
memset(&info->mon_data, 0, sizeof(struct mxser_mon));
info->err_shadow = 0;
spin_lock_init(&info->slock);
Expand Down
Loading

0 comments on commit e11c675

Please sign in to comment.