Skip to content

Commit e11c675

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6
* 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 ...
2 parents 467f995 + 7bd032d commit e11c675

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+2578
-3576
lines changed

arch/mn10300/kernel/asm-offsets.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ void foo(void)
9595
OFFSET(__iobase, mn10300_serial_port, _iobase);
9696

9797
DEFINE(__UART_XMIT_SIZE, UART_XMIT_SIZE);
98-
OFFSET(__xmit_buffer, uart_info, xmit.buf);
99-
OFFSET(__xmit_head, uart_info, xmit.head);
100-
OFFSET(__xmit_tail, uart_info, xmit.tail);
98+
OFFSET(__xmit_buffer, uart_state, xmit.buf);
99+
OFFSET(__xmit_head, uart_state, xmit.head);
100+
OFFSET(__xmit_tail, uart_state, xmit.tail);
101101
}

drivers/char/cyclades.c

Lines changed: 580 additions & 1743 deletions
Large diffs are not rendered by default.

drivers/char/esp.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ static void check_modem_status(struct esp_struct *info)
572572
info->icount.dcd++;
573573
if (status & UART_MSR_DCTS)
574574
info->icount.cts++;
575-
wake_up_interruptible(&info->delta_msr_wait);
575+
wake_up_interruptible(&info->port.delta_msr_wait);
576576
}
577577

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

933933
/* stop a DMA transfer on the port being closed */
@@ -1800,7 +1800,7 @@ static int rs_ioctl(struct tty_struct *tty, struct file *file,
18001800
spin_unlock_irqrestore(&info->lock, flags);
18011801
while (1) {
18021802
/* FIXME: convert to new style wakeup */
1803-
interruptible_sleep_on(&info->delta_msr_wait);
1803+
interruptible_sleep_on(&info->port.delta_msr_wait);
18041804
/* see if a signal did it */
18051805
if (signal_pending(current))
18061806
return -ERESTARTSYS;
@@ -2452,7 +2452,6 @@ static int __init espserial_init(void)
24522452
info->config.flow_off = flow_off;
24532453
info->config.pio_threshold = pio_threshold;
24542454
info->next_port = ports;
2455-
init_waitqueue_head(&info->delta_msr_wait);
24562455
init_waitqueue_head(&info->break_wait);
24572456
ports = info;
24582457
printk(KERN_INFO "ttyP%d at 0x%04x (irq = %d) is an ESP ",

drivers/char/isicom.c

Lines changed: 38 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -846,37 +846,53 @@ static int isicom_carrier_raised(struct tty_port *port)
846846
return (ip->status & ISI_DCD)?1 : 0;
847847
}
848848

849-
static int isicom_open(struct tty_struct *tty, struct file *filp)
849+
static struct tty_port *isicom_find_port(struct tty_struct *tty)
850850
{
851851
struct isi_port *port;
852852
struct isi_board *card;
853853
unsigned int board;
854-
int error, line;
854+
int line = tty->index;
855855

856-
line = tty->index;
857856
if (line < 0 || line > PORT_COUNT-1)
858-
return -ENODEV;
857+
return NULL;
859858
board = BOARD(line);
860859
card = &isi_card[board];
861860

862861
if (!(card->status & FIRMWARE_LOADED))
863-
return -ENODEV;
862+
return NULL;
864863

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

869868
port = &isi_ports[line];
870869
if (isicom_paranoia_check(port, tty->name, "isicom_open"))
871-
return -ENODEV;
870+
return NULL;
872871

872+
return &port->port;
873+
}
874+
875+
static int isicom_open(struct tty_struct *tty, struct file *filp)
876+
{
877+
struct isi_port *port;
878+
struct isi_board *card;
879+
struct tty_port *tport;
880+
int error = 0;
881+
882+
tport = isicom_find_port(tty);
883+
if (tport == NULL)
884+
return -ENODEV;
885+
port = container_of(tport, struct isi_port, port);
886+
card = &isi_card[BOARD(tty->index)];
873887
isicom_setup_board(card);
874888

875889
/* FIXME: locking on port.count etc */
876890
port->port.count++;
877891
tty->driver_data = port;
878892
tty_port_tty_set(&port->port, tty);
879-
error = isicom_setup_port(tty);
893+
/* FIXME: Locking on Initialized flag */
894+
if (!test_bit(ASYNCB_INITIALIZED, &tport->flags))
895+
error = isicom_setup_port(tty);
880896
if (error == 0)
881897
error = tty_port_block_til_ready(&port->port, tty, filp);
882898
return error;
@@ -952,19 +968,12 @@ static void isicom_flush_buffer(struct tty_struct *tty)
952968
tty_wakeup(tty);
953969
}
954970

955-
static void isicom_close(struct tty_struct *tty, struct file *filp)
971+
static void isicom_close_port(struct tty_port *port)
956972
{
957-
struct isi_port *ip = tty->driver_data;
958-
struct tty_port *port = &ip->port;
959-
struct isi_board *card;
973+
struct isi_port *ip = container_of(port, struct isi_port, port);
974+
struct isi_board *card = ip->card;
960975
unsigned long flags;
961976

962-
BUG_ON(!ip);
963-
964-
card = ip->card;
965-
if (isicom_paranoia_check(ip, tty->name, "isicom_close"))
966-
return;
967-
968977
/* indicate to the card that no more data can be received
969978
on this port */
970979
spin_lock_irqsave(&card->card_lock, flags);
@@ -974,9 +983,19 @@ static void isicom_close(struct tty_struct *tty, struct file *filp)
974983
}
975984
isicom_shutdown_port(ip);
976985
spin_unlock_irqrestore(&card->card_lock, flags);
986+
}
987+
988+
static void isicom_close(struct tty_struct *tty, struct file *filp)
989+
{
990+
struct isi_port *ip = tty->driver_data;
991+
struct tty_port *port = &ip->port;
992+
if (isicom_paranoia_check(ip, tty->name, "isicom_close"))
993+
return;
977994

995+
if (tty_port_close_start(port, tty, filp) == 0)
996+
return;
997+
isicom_close_port(port);
978998
isicom_flush_buffer(tty);
979-
980999
tty_port_close_end(port, tty);
9811000
}
9821001

drivers/char/mxser.c

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848

4949
#include "mxser.h"
5050

51-
#define MXSER_VERSION "2.0.4" /* 1.12 */
51+
#define MXSER_VERSION "2.0.5" /* 1.14 */
5252
#define MXSERMAJOR 174
5353

5454
#define MXSER_BOARDS 4 /* Max. boards */
@@ -69,6 +69,7 @@
6969
#define PCI_DEVICE_ID_POS104UL 0x1044
7070
#define PCI_DEVICE_ID_CB108 0x1080
7171
#define PCI_DEVICE_ID_CP102UF 0x1023
72+
#define PCI_DEVICE_ID_CP112UL 0x1120
7273
#define PCI_DEVICE_ID_CB114 0x1142
7374
#define PCI_DEVICE_ID_CP114UL 0x1143
7475
#define PCI_DEVICE_ID_CB134I 0x1341
@@ -139,7 +140,8 @@ static const struct mxser_cardinfo mxser_cards[] = {
139140
{ "CP-138U series", 8, },
140141
{ "POS-104UL series", 4, },
141142
{ "CP-114UL series", 4, },
142-
/*30*/ { "CP-102UF series", 2, }
143+
/*30*/ { "CP-102UF series", 2, },
144+
{ "CP-112UL series", 2, },
143145
};
144146

145147
/* driver_data correspond to the lines in the structure above
@@ -170,6 +172,7 @@ static struct pci_device_id mxser_pcibrds[] = {
170172
{ PCI_VDEVICE(MOXA, PCI_DEVICE_ID_POS104UL), .driver_data = 28 },
171173
{ PCI_VDEVICE(MOXA, PCI_DEVICE_ID_CP114UL), .driver_data = 29 },
172174
{ PCI_VDEVICE(MOXA, PCI_DEVICE_ID_CP102UF), .driver_data = 30 },
175+
{ PCI_VDEVICE(MOXA, PCI_DEVICE_ID_CP112UL), .driver_data = 31 },
173176
{ }
174177
};
175178
MODULE_DEVICE_TABLE(pci, mxser_pcibrds);
@@ -258,7 +261,6 @@ struct mxser_port {
258261
struct mxser_mon mon_data;
259262

260263
spinlock_t slock;
261-
wait_queue_head_t delta_msr_wait;
262264
};
263265

264266
struct mxser_board {
@@ -818,7 +820,7 @@ static void mxser_check_modem_status(struct tty_struct *tty,
818820
if (status & UART_MSR_DCTS)
819821
port->icount.cts++;
820822
port->mon_data.modem_status = status;
821-
wake_up_interruptible(&port->delta_msr_wait);
823+
wake_up_interruptible(&port->port.delta_msr_wait);
822824

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

978980
/*
979981
* Free the IRQ, if necessary
@@ -1073,34 +1075,17 @@ static void mxser_flush_buffer(struct tty_struct *tty)
10731075
}
10741076

10751077

1076-
/*
1077-
* This routine is called when the serial port gets closed. First, we
1078-
* wait for the last remaining data to be sent. Then, we unlink its
1079-
* async structure from the interrupt chain if necessary, and we free
1080-
* that IRQ if nothing is left in the chain.
1081-
*/
1082-
static void mxser_close(struct tty_struct *tty, struct file *filp)
1078+
static void mxser_close_port(struct tty_struct *tty, struct tty_port *port)
10831079
{
1084-
struct mxser_port *info = tty->driver_data;
1085-
struct tty_port *port = &info->port;
1086-
1080+
struct mxser_port *info = container_of(port, struct mxser_port, port);
10871081
unsigned long timeout;
1088-
1089-
if (tty->index == MXSER_PORTS)
1090-
return;
1091-
if (!info)
1092-
return;
1093-
1094-
if (tty_port_close_start(port, tty, filp) == 0)
1095-
return;
1096-
10971082
/*
10981083
* Save the termios structure, since this port may have
10991084
* separate termios for callout and dialin.
11001085
*
11011086
* FIXME: Can this go ?
11021087
*/
1103-
if (info->port.flags & ASYNC_NORMAL_ACTIVE)
1088+
if (port->flags & ASYNC_NORMAL_ACTIVE)
11041089
info->normal_termios = *tty->termios;
11051090
/*
11061091
* At this point we stop accepting input. To do this, we
@@ -1112,7 +1097,7 @@ static void mxser_close(struct tty_struct *tty, struct file *filp)
11121097
if (info->board->chip_flag)
11131098
info->IER &= ~MOXA_MUST_RECV_ISR;
11141099

1115-
if (info->port.flags & ASYNC_INITIALIZED) {
1100+
if (port->flags & ASYNC_INITIALIZED) {
11161101
outb(info->IER, info->ioaddr + UART_IER);
11171102
/*
11181103
* Before we drop DTR, make sure the UART transmitter
@@ -1127,8 +1112,26 @@ static void mxser_close(struct tty_struct *tty, struct file *filp)
11271112
}
11281113
}
11291114
mxser_shutdown(tty);
1130-
mxser_flush_buffer(tty);
11311115

1116+
}
1117+
1118+
/*
1119+
* This routine is called when the serial port gets closed. First, we
1120+
* wait for the last remaining data to be sent. Then, we unlink its
1121+
* async structure from the interrupt chain if necessary, and we free
1122+
* that IRQ if nothing is left in the chain.
1123+
*/
1124+
static void mxser_close(struct tty_struct *tty, struct file *filp)
1125+
{
1126+
struct mxser_port *info = tty->driver_data;
1127+
struct tty_port *port = &info->port;
1128+
1129+
if (tty->index == MXSER_PORTS)
1130+
return;
1131+
if (tty_port_close_start(port, tty, filp) == 0)
1132+
return;
1133+
mxser_close_port(tty, port);
1134+
mxser_flush_buffer(tty);
11321135
/* Right now the tty_port set is done outside of the close_end helper
11331136
as we don't yet have everyone using refcounts */
11341137
tty_port_close_end(port, tty);
@@ -1761,7 +1764,7 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file,
17611764
cnow = info->icount; /* note the counters on entry */
17621765
spin_unlock_irqrestore(&info->slock, flags);
17631766

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

18041807
lock_kernel();
18051808
len = mxser_chars_in_buffer(tty);
1806-
lsr = inb(info->ioaddr + UART_LSR) & UART_LSR_TEMT;
1809+
lsr = inb(info->ioaddr + UART_LSR) & UART_LSR_THRE;
18071810
len += (lsr ? 0 : 1);
18081811
unlock_kernel();
18091812

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

0 commit comments

Comments
 (0)