Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 354772
b: refs/heads/master
c: 6732c8b
h: refs/heads/master
v: v3
  • Loading branch information
Jiri Slaby authored and Greg Kroah-Hartman committed Jan 16, 2013
1 parent 242038f commit 35bf729
Show file tree
Hide file tree
Showing 12 changed files with 52 additions and 101 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2e124b4a390ca85325fae75764bef92f0547fa25
refs/heads/master: 6732c8bb8671acbdac6cdc93dd72ddd581dd5e25
17 changes: 8 additions & 9 deletions trunk/arch/alpha/kernel/srmcons.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,8 @@ typedef union _srmcons_result {

/* called with callback_lock held */
static int
srmcons_do_receive_chars(struct tty_struct *tty)
srmcons_do_receive_chars(struct tty_port *port)
{
struct tty_port *port = tty->port;
srmcons_result result;
int count = 0, loops = 0;

Expand All @@ -59,7 +58,7 @@ srmcons_do_receive_chars(struct tty_struct *tty)
} while((result.bits.status & 1) && (++loops < 10));

if (count)
tty_schedule_flip(tty);
tty_schedule_flip(port);

return count;
}
Expand All @@ -74,7 +73,7 @@ srmcons_receive_chars(unsigned long data)

local_irq_save(flags);
if (spin_trylock(&srmcons_callback_lock)) {
if (!srmcons_do_receive_chars(port->tty))
if (!srmcons_do_receive_chars(port))
incr = 100;
spin_unlock(&srmcons_callback_lock);
}
Expand All @@ -89,7 +88,7 @@ srmcons_receive_chars(unsigned long data)

/* called with callback_lock held */
static int
srmcons_do_write(struct tty_struct *tty, const char *buf, int count)
srmcons_do_write(struct tty_port *port, const char *buf, int count)
{
static char str_cr[1] = "\r";
long c, remaining = count;
Expand All @@ -114,10 +113,10 @@ srmcons_do_write(struct tty_struct *tty, const char *buf, int count)
cur += result.bits.c;

/*
* Check for pending input iff a tty was provided
* Check for pending input iff a tty port was provided
*/
if (tty)
srmcons_do_receive_chars(tty);
if (port)
srmcons_do_receive_chars(port);
}

while (need_cr) {
Expand All @@ -136,7 +135,7 @@ srmcons_write(struct tty_struct *tty,
unsigned long flags;

spin_lock_irqsave(&srmcons_callback_lock, flags);
srmcons_do_write(tty, (const char *) buf, count);
srmcons_do_write(tty->port, (const char *) buf, count);
spin_unlock_irqrestore(&srmcons_callback_lock, flags);

return count;
Expand Down
12 changes: 2 additions & 10 deletions trunk/drivers/s390/char/keyboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,14 @@ int kbd_ioctl(struct kbd_data *, unsigned int, unsigned long);
static inline void
kbd_put_queue(struct tty_port *port, int ch)
{
struct tty_struct *tty = tty_port_tty_get(port);
if (!tty)
return;
tty_insert_flip_char(port, ch, 0);
tty_schedule_flip(tty);
tty_kref_put(tty);
tty_schedule_flip(port);
}

static inline void
kbd_puts_queue(struct tty_port *port, char *cp)
{
struct tty_struct *tty = tty_port_tty_get(port);
if (!tty)
return;
while (*cp)
tty_insert_flip_char(port, *cp++, 0);
tty_schedule_flip(tty);
tty_kref_put(tty);
tty_schedule_flip(port);
}
19 changes: 6 additions & 13 deletions trunk/drivers/staging/serqt_usb2/serqt_usb2.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,6 @@ static void qt_read_bulk_callback(struct urb *urb)
struct usb_serial_port *port = urb->context;
struct usb_serial *serial = get_usb_serial(port, __func__);
struct quatech_port *qt_port = qt_get_port_private(port);
struct tty_struct *tty;
int result;

if (urb->status) {
Expand All @@ -367,27 +366,23 @@ static void qt_read_bulk_callback(struct urb *urb)
return;
}

tty = tty_port_tty_get(&port->port);
if (!tty)
return;

dev_dbg(&port->dev,
"%s - port->RxHolding = %d\n", __func__, qt_port->RxHolding);

if (port_paranoia_check(port, __func__) != 0) {
qt_port->ReadBulkStopped = 1;
goto exit;
return;
}

if (!serial)
goto exit;
return;

if (qt_port->closePending == 1) {
/* Were closing , stop reading */
dev_dbg(&port->dev,
"%s - (qt_port->closepending == 1\n", __func__);
qt_port->ReadBulkStopped = 1;
goto exit;
return;
}

/*
Expand All @@ -397,7 +392,7 @@ static void qt_read_bulk_callback(struct urb *urb)
*/
if (qt_port->RxHolding == 1) {
qt_port->ReadBulkStopped = 1;
goto exit;
return;
}

if (urb->status) {
Expand All @@ -406,7 +401,7 @@ static void qt_read_bulk_callback(struct urb *urb)
dev_dbg(&port->dev,
"%s - nonzero read bulk status received: %d\n",
__func__, urb->status);
goto exit;
return;
}

if (urb->actual_length)
Expand All @@ -427,13 +422,11 @@ static void qt_read_bulk_callback(struct urb *urb)
else {
if (urb->actual_length) {
tty_flip_buffer_push(&port->port);
tty_schedule_flip(tty);
tty_schedule_flip(&port->port);
}
}

schedule_work(&port->work);
exit:
tty_kref_put(tty);
}

/*
Expand Down
33 changes: 12 additions & 21 deletions trunk/drivers/tty/cyclades.c
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,6 @@ static void cyy_chip_rx(struct cyclades_card *cinfo, int chip,
void __iomem *base_addr)
{
struct cyclades_port *info;
struct tty_struct *tty;
struct tty_port *port;
int len, index = cinfo->bus_index;
u8 ivr, save_xir, channel, save_car, data, char_count;
Expand All @@ -458,18 +457,6 @@ static void cyy_chip_rx(struct cyclades_card *cinfo, int chip,
cyy_writeb(info, CyCAR, save_xir);
ivr = cyy_readb(info, CyRIVR) & CyIVRMask;

tty = tty_port_tty_get(port);
/* if there is nowhere to put the data, discard it */
if (tty == NULL) {
if (ivr == CyIVRRxEx) { /* exception */
data = cyy_readb(info, CyRDSR);
} else { /* normal character reception */
char_count = cyy_readb(info, CyRDCR);
while (char_count--)
data = cyy_readb(info, CyRDSR);
}
goto end;
}
/* there is an open port for this data */
if (ivr == CyIVRRxEx) { /* exception */
data = cyy_readb(info, CyRDSR);
Expand All @@ -486,7 +473,6 @@ static void cyy_chip_rx(struct cyclades_card *cinfo, int chip,

if (data & info->ignore_status_mask) {
info->icount.rx++;
tty_kref_put(tty);
return;
}
if (tty_buffer_request_room(port, 1)) {
Expand All @@ -496,8 +482,14 @@ static void cyy_chip_rx(struct cyclades_card *cinfo, int chip,
cyy_readb(info, CyRDSR),
TTY_BREAK);
info->icount.rx++;
if (port->flags & ASYNC_SAK)
do_SAK(tty);
if (port->flags & ASYNC_SAK) {
struct tty_struct *tty =
tty_port_tty_get(port);
if (tty) {
do_SAK(tty);
tty_kref_put(tty);
}
}
} else if (data & CyFRAME) {
tty_insert_flip_char(port,
cyy_readb(info, CyRDSR),
Expand Down Expand Up @@ -566,9 +558,8 @@ static void cyy_chip_rx(struct cyclades_card *cinfo, int chip,
}
info->idle_stats.recv_idle = jiffies;
}
tty_schedule_flip(tty);
tty_kref_put(tty);
end:
tty_schedule_flip(port);

/* end of service */
cyy_writeb(info, CyRIR, save_xir & 0x3f);
cyy_writeb(info, CyCAR, save_car);
Expand Down Expand Up @@ -1012,7 +1003,7 @@ static void cyz_handle_rx(struct cyclades_port *info, struct tty_struct *tty)
jiffies + 1);
#endif
info->idle_stats.recv_idle = jiffies;
tty_schedule_flip(tty);
tty_schedule_flip(&info->port);
}
/* Update rx_get */
cy_writel(&buf_ctrl->rx_get, new_rx_get);
Expand Down Expand Up @@ -1191,7 +1182,7 @@ static void cyz_handle_cmd(struct cyclades_card *cinfo)
if (delta_count)
wake_up_interruptible(&info->port.delta_msr_wait);
if (special_count)
tty_schedule_flip(tty);
tty_schedule_flip(&info->port);
tty_kref_put(tty);
}
}
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/tty/moxa.c
Original file line number Diff line number Diff line change
Expand Up @@ -1405,7 +1405,7 @@ static int moxa_poll_port(struct moxa_port *p, unsigned int handle,
if (inited && !test_bit(TTY_THROTTLED, &tty->flags) &&
MoxaPortRxQueue(p) > 0) { /* RX */
MoxaPortReadData(p);
tty_schedule_flip(tty);
tty_schedule_flip(&p->port);
}
} else {
clear_bit(EMPTYWAIT, &p->statusflags);
Expand All @@ -1430,7 +1430,7 @@ static int moxa_poll_port(struct moxa_port *p, unsigned int handle,

if (tty && (intr & IntrBreak) && !I_IGNBRK(tty)) { /* BREAK */
tty_insert_flip_char(&p->port, 0, TTY_BREAK);
tty_schedule_flip(tty);
tty_schedule_flip(&p->port);
}

if (intr & IntrLine)
Expand Down
15 changes: 4 additions & 11 deletions trunk/drivers/tty/serial/68328serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,7 @@ static void rs_start(struct tty_struct *tty)
local_irq_restore(flags);
}

static void receive_chars(struct m68k_serial *info, struct tty_struct *tty,
unsigned short rx)
static void receive_chars(struct m68k_serial *info, unsigned short rx)
{
m68328_uart *uart = &uart_addr[info->line];
unsigned char ch, flag;
Expand Down Expand Up @@ -293,9 +292,6 @@ static void receive_chars(struct m68k_serial *info, struct tty_struct *tty,
}
}

if(!tty)
goto clear_and_exit;

flag = TTY_NORMAL;

if (rx & URX_PARITY_ERROR)
Expand All @@ -310,10 +306,7 @@ static void receive_chars(struct m68k_serial *info, struct tty_struct *tty,
} while((rx = uart->urx.w) & URX_DATA_READY);
#endif

tty_schedule_flip(tty);

clear_and_exit:
return;
tty_schedule_flip(&info->tport);
}

static void transmit_chars(struct m68k_serial *info, struct tty_struct *tty)
Expand Down Expand Up @@ -367,11 +360,11 @@ irqreturn_t rs_interrupt(int irq, void *dev_id)
tx = uart->utx.w;

if (rx & URX_DATA_READY)
receive_chars(info, tty, rx);
receive_chars(info, rx);
if (tx & UTX_TX_AVAIL)
transmit_chars(info, tty);
#else
receive_chars(info, tty, rx);
receive_chars(info, rx);
#endif
tty_kref_put(tty);

Expand Down
6 changes: 1 addition & 5 deletions trunk/drivers/tty/serial/lpc32xx_hs.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,6 @@ static irqreturn_t serial_lpc32xx_interrupt(int irq, void *dev_id)
{
struct uart_port *port = dev_id;
struct tty_port *port = &port->state->port;
struct tty_struct *tty = tty_port_tty_get(tport);
u32 status;

spin_lock(&port->lock);
Expand All @@ -348,9 +347,7 @@ static irqreturn_t serial_lpc32xx_interrupt(int irq, void *dev_id)
LPC32XX_HSUART_IIR(port->membase));
port->icount.overrun++;
tty_insert_flip_char(tport, 0, TTY_OVERRUN);
if (tty) {
tty_schedule_flip(tty);
}
tty_schedule_flip(tport);
}

/* Data received? */
Expand All @@ -366,7 +363,6 @@ static irqreturn_t serial_lpc32xx_interrupt(int irq, void *dev_id)
}

spin_unlock(&port->lock);
tty_kref_put(tty);

return IRQ_HANDLED;
}
Expand Down
8 changes: 4 additions & 4 deletions trunk/drivers/tty/tty_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ EXPORT_SYMBOL(tty_insert_flip_string_flags);

/**
* tty_schedule_flip - push characters to ldisc
* @tty: tty to push from
* @port: tty port to push from
*
* Takes any pending buffers and transfers their ownership to the
* ldisc side of the queue. It then schedules those characters for
Expand All @@ -360,11 +360,11 @@ EXPORT_SYMBOL(tty_insert_flip_string_flags);
* Locking: Takes port->buf.lock
*/

void tty_schedule_flip(struct tty_struct *tty)
void tty_schedule_flip(struct tty_port *port)
{
struct tty_bufhead *buf = &tty->port->buf;
struct tty_bufhead *buf = &port->buf;
unsigned long flags;
WARN_ON(tty->port->low_latency);
WARN_ON(port->low_latency);

spin_lock_irqsave(&buf->lock, flags);
if (buf->tail != NULL)
Expand Down
Loading

0 comments on commit 35bf729

Please sign in to comment.