return 1;
}
-static void transmit_chars(struct serial_state *info, int *intr_done)
+static void transmit_chars(struct tty_struct *tty, struct serial_state *info,
+ int *intr_done)
{
int count;
unsigned long flags;
goto out;
}
- if (info->xmit.head == info->xmit.tail || info->tty->stopped || info->tty->hw_stopped) {
+ if (info->xmit.head == info->xmit.tail || tty->stopped ||
+ tty->hw_stopped) {
#ifdef SIMSERIAL_DEBUG
printk("transmit_chars: head=%d, tail=%d, stopped=%d\n",
- info->xmit.head, info->xmit.tail, info->tty->stopped);
+ info->xmit.head, info->xmit.tail, tty->stopped);
#endif
goto out;
}
!info->xmit.buf)
return;
- transmit_chars(info, NULL);
+ transmit_chars(tty, info, NULL);
}
*/
if (CIRC_CNT(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE)
&& !tty->stopped && !tty->hw_stopped) {
- transmit_chars(info, NULL);
+ transmit_chars(tty, info, NULL);
}
return ret;
}
* I guess we could call console->write() directly but
* let's do that for now.
*/
- transmit_chars(info, NULL);
+ transmit_chars(tty, info, NULL);
}
}
* This routine will shutdown a serial port; interrupts are disabled, and
* DTR is dropped if the hangup on close termio flag is on.
*/
-static void shutdown(struct serial_state *info)
+static void shutdown(struct tty_struct *tty, struct serial_state *info)
{
unsigned long flags;
info->xmit.buf = NULL;
}
- if (info->tty) set_bit(TTY_IO_ERROR, &info->tty->flags);
+ set_bit(TTY_IO_ERROR, &tty->flags);
info->flags &= ~ASYNC_INITIALIZED;
}
* Now we wait for the transmit buffer to clear; and we notify
* the line discipline to only process XON/XOFF characters.
*/
- shutdown(info);
+ shutdown(tty, info);
rs_flush_buffer(tty);
tty_ldisc_flush(tty);
info->tty = NULL;
rs_flush_buffer(tty);
if (info->flags & ASYNC_CLOSING)
return;
- shutdown(info);
+ shutdown(tty, info);
info->count = 0;
info->flags &= ~ASYNC_NORMAL_ACTIVE;
}
-static int startup(struct serial_state *state)
+static int startup(struct tty_struct *tty, struct serial_state *state)
{
unsigned long flags;
int retval=0;
}
if (!state->port || !state->type) {
- if (state->tty)
- set_bit(TTY_IO_ERROR, &state->tty->flags);
+ set_bit(TTY_IO_ERROR, &tty->flags);
free_page(page);
goto errout;
}
goto errout;
}
- if (state->tty)
- clear_bit(TTY_IO_ERROR, &state->tty->flags);
+ clear_bit(TTY_IO_ERROR, &tty->flags);
state->xmit.head = state->xmit.tail = 0;
/*
* Set up the tty->alt_speed kludge
*/
- if (state->tty) {
- if ((state->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
- state->tty->alt_speed = 57600;
- if ((state->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)
- state->tty->alt_speed = 115200;
- if ((state->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI)
- state->tty->alt_speed = 230400;
- if ((state->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP)
- state->tty->alt_speed = 460800;
- }
+ if ((state->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
+ tty->alt_speed = 57600;
+ if ((state->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)
+ tty->alt_speed = 115200;
+ if ((state->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI)
+ tty->alt_speed = 230400;
+ if ((state->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP)
+ tty->alt_speed = 460800;
state->flags |= ASYNC_INITIALIZED;
local_irq_restore(flags);
/*
* Start up serial port
*/
- retval = startup(info);
+ retval = startup(tty, info);
if (retval) {
return retval;
}