#include <linux/miscdevice.h>
#include <linux/interrupt.h>
#include <linux/timer.h>
+#include <linux/delay.h>
#include <linux/ioport.h>
#include <asm/uaccess.h>
tty = port->tty;
save_flags(flags); cli();
- txcount = MIN(TX_SIZE, port->xmit_cnt);
+ txcount = min_t(short, TX_SIZE, port->xmit_cnt);
if ((txcount <= 0) || tty->stopped || tty->hw_stopped) {
restore_flags(flags);
continue;
residue = NO;
wrd = 0;
while (1) {
- cnt = MIN(txcount, (SERIAL_XMIT_SIZE - port->xmit_tail));
+ cnt = min_t(int, txcount, (SERIAL_XMIT_SIZE - port->xmit_tail));
if (residue == YES) {
residue = NO;
if (cnt > 0) {
if (!tty)
return;
-
- if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
- tty->ldisc.write_wakeup)
- (tty->ldisc.write_wakeup)(tty);
+
+ tty_wakeup(tty);
wake_up_interruptible(&tty->write_wait);
}
}
}
else { /* Data Packet */
- count = MIN(byte_count, (TTY_FLIPBUF_SIZE - tty->flip.count));
+ count = min_t(unsigned short, byte_count, (TTY_FLIPBUF_SIZE - tty->flip.count));
#ifdef ISICOM_DEBUG
printk(KERN_DEBUG "ISICOM: Intr: Can rx %d of %d bytes.\n",
count, byte_count);
isicom_shutdown_port(port);
if (tty->driver->flush_buffer)
tty->driver->flush_buffer(tty);
- if (tty->ldisc.flush_buffer)
- tty->ldisc.flush_buffer(tty);
+
+ tty_ldisc_flush(tty);
tty->closing = 0;
port->tty = NULL;
if (port->blocked_open) {
save_flags(flags);
while(1) {
cli();
- cnt = MIN(count, MIN(SERIAL_XMIT_SIZE - port->xmit_cnt - 1,
- SERIAL_XMIT_SIZE - port->xmit_head));
+ cnt = min_t(int, count, min(SERIAL_XMIT_SIZE - port->xmit_cnt - 1,
+ SERIAL_XMIT_SIZE - port->xmit_head));
if (cnt <= 0)
break;
return -EFAULT;
}
cli();
- cnt = MIN(cnt, MIN(SERIAL_XMIT_SIZE - port->xmit_cnt - 1,
- SERIAL_XMIT_SIZE - port->xmit_head));
+ cnt = min_t(int, cnt, min(SERIAL_XMIT_SIZE - port->xmit_cnt - 1,
+ SERIAL_XMIT_SIZE - port->xmit_head));
memcpy(port->xmit_buf + port->xmit_head, tmp_buf, cnt);
}
else
restore_flags(flags);
wake_up_interruptible(&tty->write_wait);
- if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
- tty->ldisc.write_wakeup)
- (tty->ldisc.write_wakeup)(tty);
+ tty_wakeup(tty);
}
void cleanup_module(void)
{
re_schedule = 0;
- set_current_state(TASK_INTERRUPTIBLE);
- schedule_timeout(HZ);
+ msleep(1000);
#ifdef ISICOM_DEBUG
printk("ISICOM: isicom_tx tx_count = %ld.\n", tx_count);