Commit eb0ea8b4 authored by Geert Uytterhoeven's avatar Geert Uytterhoeven Committed by Linus Torvalds

[PATCH] M68k char local_irq*() updates

Convert m68k char drivers to new local_irq*() framework:
  - Amiga builtin serial
  - Amiga A2232 multiserial
  - MVME167 serial
  - MVME147/162 and BVME6000 SCC
parent a04d620c
...@@ -213,7 +213,7 @@ static void rs_stop(struct tty_struct *tty) ...@@ -213,7 +213,7 @@ static void rs_stop(struct tty_struct *tty)
if (serial_paranoia_check(info, tty->device, "rs_stop")) if (serial_paranoia_check(info, tty->device, "rs_stop"))
return; return;
save_flags(flags); cli(); local_irq_save(flags);
if (info->IER & UART_IER_THRI) { if (info->IER & UART_IER_THRI) {
info->IER &= ~UART_IER_THRI; info->IER &= ~UART_IER_THRI;
/* disable Tx interrupt and remove any pending interrupts */ /* disable Tx interrupt and remove any pending interrupts */
...@@ -222,7 +222,7 @@ static void rs_stop(struct tty_struct *tty) ...@@ -222,7 +222,7 @@ static void rs_stop(struct tty_struct *tty)
custom.intreq = IF_TBE; custom.intreq = IF_TBE;
mb(); mb();
} }
restore_flags(flags); local_irq_restore(flags);
} }
static void rs_start(struct tty_struct *tty) static void rs_start(struct tty_struct *tty)
...@@ -233,7 +233,7 @@ static void rs_start(struct tty_struct *tty) ...@@ -233,7 +233,7 @@ static void rs_start(struct tty_struct *tty)
if (serial_paranoia_check(info, tty->device, "rs_start")) if (serial_paranoia_check(info, tty->device, "rs_start"))
return; return;
save_flags(flags); cli(); local_irq_save(flags);
if (info->xmit.head != info->xmit.tail if (info->xmit.head != info->xmit.tail
&& info->xmit.buf && info->xmit.buf
&& !(info->IER & UART_IER_THRI)) { && !(info->IER & UART_IER_THRI)) {
...@@ -244,7 +244,7 @@ static void rs_start(struct tty_struct *tty) ...@@ -244,7 +244,7 @@ static void rs_start(struct tty_struct *tty)
custom.intreq = IF_SETCLR | IF_TBE; custom.intreq = IF_SETCLR | IF_TBE;
mb(); mb();
} }
restore_flags(flags); local_irq_restore(flags);
} }
/* /*
...@@ -601,7 +601,7 @@ static int startup(struct async_struct * info) ...@@ -601,7 +601,7 @@ static int startup(struct async_struct * info)
if (!page) if (!page)
return -ENOMEM; return -ENOMEM;
save_flags(flags); cli(); local_irq_save(flags);
if (info->flags & ASYNC_INITIALIZED) { if (info->flags & ASYNC_INITIALIZED) {
free_page(page); free_page(page);
...@@ -672,11 +672,11 @@ static int startup(struct async_struct * info) ...@@ -672,11 +672,11 @@ static int startup(struct async_struct * info)
change_speed(info, 0); change_speed(info, 0);
info->flags |= ASYNC_INITIALIZED; info->flags |= ASYNC_INITIALIZED;
restore_flags(flags); local_irq_restore(flags);
return 0; return 0;
errout: errout:
restore_flags(flags); local_irq_restore(flags);
return retval; return retval;
} }
...@@ -698,7 +698,7 @@ static void shutdown(struct async_struct * info) ...@@ -698,7 +698,7 @@ static void shutdown(struct async_struct * info)
printk("Shutting down serial port %d ....\n", info->line); printk("Shutting down serial port %d ....\n", info->line);
#endif #endif
save_flags(flags); cli(); /* Disable interrupts */ local_irq_save(flags); /* Disable interrupts */
/* /*
* clear delta_msr_wait queue to avoid mem leaks: we may free the irq * clear delta_msr_wait queue to avoid mem leaks: we may free the irq
...@@ -734,7 +734,7 @@ static void shutdown(struct async_struct * info) ...@@ -734,7 +734,7 @@ static void shutdown(struct async_struct * info)
set_bit(TTY_IO_ERROR, &info->tty->flags); set_bit(TTY_IO_ERROR, &info->tty->flags);
info->flags &= ~ASYNC_INITIALIZED; info->flags &= ~ASYNC_INITIALIZED;
restore_flags(flags); local_irq_restore(flags);
} }
...@@ -862,7 +862,7 @@ static void change_speed(struct async_struct *info, ...@@ -862,7 +862,7 @@ static void change_speed(struct async_struct *info,
*/ */
if ((cflag & CREAD) == 0) if ((cflag & CREAD) == 0)
info->ignore_status_mask |= UART_LSR_DR; info->ignore_status_mask |= UART_LSR_DR;
save_flags(flags); cli(); local_irq_save(flags);
{ {
short serper; short serper;
...@@ -880,7 +880,7 @@ static void change_speed(struct async_struct *info, ...@@ -880,7 +880,7 @@ static void change_speed(struct async_struct *info,
} }
info->LCR = cval; /* Save LCR */ info->LCR = cval; /* Save LCR */
restore_flags(flags); local_irq_restore(flags);
} }
static void rs_put_char(struct tty_struct *tty, unsigned char ch) static void rs_put_char(struct tty_struct *tty, unsigned char ch)
...@@ -894,17 +894,17 @@ static void rs_put_char(struct tty_struct *tty, unsigned char ch) ...@@ -894,17 +894,17 @@ static void rs_put_char(struct tty_struct *tty, unsigned char ch)
if (!tty || !info->xmit.buf) if (!tty || !info->xmit.buf)
return; return;
save_flags(flags); cli(); local_irq_save(flags);
if (CIRC_SPACE(info->xmit.head, if (CIRC_SPACE(info->xmit.head,
info->xmit.tail, info->xmit.tail,
SERIAL_XMIT_SIZE) == 0) { SERIAL_XMIT_SIZE) == 0) {
restore_flags(flags); local_irq_restore(flags);
return; return;
} }
info->xmit.buf[info->xmit.head++] = ch; info->xmit.buf[info->xmit.head++] = ch;
info->xmit.head &= SERIAL_XMIT_SIZE-1; info->xmit.head &= SERIAL_XMIT_SIZE-1;
restore_flags(flags); local_irq_restore(flags);
} }
static void rs_flush_chars(struct tty_struct *tty) static void rs_flush_chars(struct tty_struct *tty)
...@@ -921,14 +921,14 @@ static void rs_flush_chars(struct tty_struct *tty) ...@@ -921,14 +921,14 @@ static void rs_flush_chars(struct tty_struct *tty)
|| !info->xmit.buf) || !info->xmit.buf)
return; return;
save_flags(flags); cli(); local_irq_save(flags);
info->IER |= UART_IER_THRI; info->IER |= UART_IER_THRI;
custom.intena = IF_SETCLR | IF_TBE; custom.intena = IF_SETCLR | IF_TBE;
mb(); mb();
/* set a pending Tx Interrupt, transmitter should restart now */ /* set a pending Tx Interrupt, transmitter should restart now */
custom.intreq = IF_SETCLR | IF_TBE; custom.intreq = IF_SETCLR | IF_TBE;
mb(); mb();
restore_flags(flags); local_irq_restore(flags);
} }
static int rs_write(struct tty_struct * tty, int from_user, static int rs_write(struct tty_struct * tty, int from_user,
...@@ -944,7 +944,7 @@ static int rs_write(struct tty_struct * tty, int from_user, ...@@ -944,7 +944,7 @@ static int rs_write(struct tty_struct * tty, int from_user,
if (!tty || !info->xmit.buf || !tmp_buf) if (!tty || !info->xmit.buf || !tmp_buf)
return 0; return 0;
save_flags(flags); local_save_flags(flags);
if (from_user) { if (from_user) {
down(&tmp_buf_sem); down(&tmp_buf_sem);
while (1) { while (1) {
...@@ -961,7 +961,7 @@ static int rs_write(struct tty_struct * tty, int from_user, ...@@ -961,7 +961,7 @@ static int rs_write(struct tty_struct * tty, int from_user,
ret = -EFAULT; ret = -EFAULT;
break; break;
} }
cli(); local_irq_disable();
c1 = CIRC_SPACE_TO_END(info->xmit.head, c1 = CIRC_SPACE_TO_END(info->xmit.head,
info->xmit.tail, info->xmit.tail,
SERIAL_XMIT_SIZE); SERIAL_XMIT_SIZE);
...@@ -970,14 +970,14 @@ static int rs_write(struct tty_struct * tty, int from_user, ...@@ -970,14 +970,14 @@ static int rs_write(struct tty_struct * tty, int from_user,
memcpy(info->xmit.buf + info->xmit.head, tmp_buf, c); memcpy(info->xmit.buf + info->xmit.head, tmp_buf, c);
info->xmit.head = ((info->xmit.head + c) & info->xmit.head = ((info->xmit.head + c) &
(SERIAL_XMIT_SIZE-1)); (SERIAL_XMIT_SIZE-1));
restore_flags(flags); local_irq_restore(flags);
buf += c; buf += c;
count -= c; count -= c;
ret += c; ret += c;
} }
up(&tmp_buf_sem); up(&tmp_buf_sem);
} else { } else {
cli(); local_irq_disable();
while (1) { while (1) {
c = CIRC_SPACE_TO_END(info->xmit.head, c = CIRC_SPACE_TO_END(info->xmit.head,
info->xmit.tail, info->xmit.tail,
...@@ -994,20 +994,20 @@ static int rs_write(struct tty_struct * tty, int from_user, ...@@ -994,20 +994,20 @@ static int rs_write(struct tty_struct * tty, int from_user,
count -= c; count -= c;
ret += c; ret += c;
} }
restore_flags(flags); local_irq_restore(flags);
} }
if (info->xmit.head != info->xmit.tail if (info->xmit.head != info->xmit.tail
&& !tty->stopped && !tty->stopped
&& !tty->hw_stopped && !tty->hw_stopped
&& !(info->IER & UART_IER_THRI)) { && !(info->IER & UART_IER_THRI)) {
info->IER |= UART_IER_THRI; info->IER |= UART_IER_THRI;
cli(); local_irq_disable();
custom.intena = IF_SETCLR | IF_TBE; custom.intena = IF_SETCLR | IF_TBE;
mb(); mb();
/* set a pending Tx Interrupt, transmitter should restart now */ /* set a pending Tx Interrupt, transmitter should restart now */
custom.intreq = IF_SETCLR | IF_TBE; custom.intreq = IF_SETCLR | IF_TBE;
mb(); mb();
restore_flags(flags); local_irq_restore(flags);
} }
return ret; return ret;
} }
...@@ -1037,9 +1037,9 @@ static void rs_flush_buffer(struct tty_struct *tty) ...@@ -1037,9 +1037,9 @@ static void rs_flush_buffer(struct tty_struct *tty)
if (serial_paranoia_check(info, tty->device, "rs_flush_buffer")) if (serial_paranoia_check(info, tty->device, "rs_flush_buffer"))
return; return;
save_flags(flags); cli(); local_irq_save(flags);
info->xmit.head = info->xmit.tail = 0; info->xmit.head = info->xmit.tail = 0;
restore_flags(flags); local_irq_restore(flags);
wake_up_interruptible(&tty->write_wait); wake_up_interruptible(&tty->write_wait);
if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
tty->ldisc.write_wakeup) tty->ldisc.write_wakeup)
...@@ -1063,8 +1063,7 @@ static void rs_send_xchar(struct tty_struct *tty, char ch) ...@@ -1063,8 +1063,7 @@ static void rs_send_xchar(struct tty_struct *tty, char ch)
/* Make sure transmit interrupts are on */ /* Make sure transmit interrupts are on */
/* Check this ! */ /* Check this ! */
save_flags(flags); local_irq_save(flags);
cli();
if(!(custom.intenar & IF_TBE)) { if(!(custom.intenar & IF_TBE)) {
custom.intena = IF_SETCLR | IF_TBE; custom.intena = IF_SETCLR | IF_TBE;
mb(); mb();
...@@ -1072,7 +1071,7 @@ static void rs_send_xchar(struct tty_struct *tty, char ch) ...@@ -1072,7 +1071,7 @@ static void rs_send_xchar(struct tty_struct *tty, char ch)
custom.intreq = IF_SETCLR | IF_TBE; custom.intreq = IF_SETCLR | IF_TBE;
mb(); mb();
} }
restore_flags(flags); local_irq_restore(flags);
info->IER |= UART_IER_THRI; info->IER |= UART_IER_THRI;
} }
...@@ -1106,9 +1105,9 @@ static void rs_throttle(struct tty_struct * tty) ...@@ -1106,9 +1105,9 @@ static void rs_throttle(struct tty_struct * tty)
if (tty->termios->c_cflag & CRTSCTS) if (tty->termios->c_cflag & CRTSCTS)
info->MCR &= ~SER_RTS; info->MCR &= ~SER_RTS;
save_flags(flags); cli(); local_irq_save(flags);
rtsdtr_ctrl(info->MCR); rtsdtr_ctrl(info->MCR);
restore_flags(flags); local_irq_restore(flags);
} }
static void rs_unthrottle(struct tty_struct * tty) static void rs_unthrottle(struct tty_struct * tty)
...@@ -1133,9 +1132,9 @@ static void rs_unthrottle(struct tty_struct * tty) ...@@ -1133,9 +1132,9 @@ static void rs_unthrottle(struct tty_struct * tty)
} }
if (tty->termios->c_cflag & CRTSCTS) if (tty->termios->c_cflag & CRTSCTS)
info->MCR |= SER_RTS; info->MCR |= SER_RTS;
save_flags(flags); cli(); local_irq_save(flags);
rtsdtr_ctrl(info->MCR); rtsdtr_ctrl(info->MCR);
restore_flags(flags); local_irq_restore(flags);
} }
/* /*
...@@ -1256,10 +1255,10 @@ static int get_lsr_info(struct async_struct * info, unsigned int *value) ...@@ -1256,10 +1255,10 @@ static int get_lsr_info(struct async_struct * info, unsigned int *value)
unsigned int result; unsigned int result;
unsigned long flags; unsigned long flags;
save_flags(flags); cli(); local_irq_save(flags);
status = custom.serdatr; status = custom.serdatr;
mb(); mb();
restore_flags(flags); local_irq_restore(flags);
result = ((status & SDR_TSRE) ? TIOCSER_TEMT : 0); result = ((status & SDR_TSRE) ? TIOCSER_TEMT : 0);
if (copy_to_user(value, &result, sizeof(int))) if (copy_to_user(value, &result, sizeof(int)))
return -EFAULT; return -EFAULT;
...@@ -1274,9 +1273,9 @@ static int get_modem_info(struct async_struct * info, unsigned int *value) ...@@ -1274,9 +1273,9 @@ static int get_modem_info(struct async_struct * info, unsigned int *value)
unsigned long flags; unsigned long flags;
control = info->MCR; control = info->MCR;
save_flags(flags); cli(); local_irq_save(flags);
status = ciab.pra; status = ciab.pra;
restore_flags(flags); local_irq_restore(flags);
result = ((control & SER_RTS) ? TIOCM_RTS : 0) result = ((control & SER_RTS) ? TIOCM_RTS : 0)
| ((control & SER_DTR) ? TIOCM_DTR : 0) | ((control & SER_DTR) ? TIOCM_DTR : 0)
| (!(status & SER_DCD) ? TIOCM_CAR : 0) | (!(status & SER_DCD) ? TIOCM_CAR : 0)
...@@ -1317,9 +1316,9 @@ static int set_modem_info(struct async_struct * info, unsigned int cmd, ...@@ -1317,9 +1316,9 @@ static int set_modem_info(struct async_struct * info, unsigned int cmd,
default: default:
return -EINVAL; return -EINVAL;
} }
save_flags(flags); cli(); local_irq_save(flags);
rtsdtr_ctrl(info->MCR); rtsdtr_ctrl(info->MCR);
restore_flags(flags); local_irq_restore(flags);
return 0; return 0;
} }
...@@ -1334,13 +1333,13 @@ static void rs_break(struct tty_struct *tty, int break_state) ...@@ -1334,13 +1333,13 @@ static void rs_break(struct tty_struct *tty, int break_state)
if (serial_paranoia_check(info, tty->device, "rs_break")) if (serial_paranoia_check(info, tty->device, "rs_break"))
return; return;
save_flags(flags); cli(); local_irq_save(flags);
if (break_state == -1) if (break_state == -1)
custom.adkcon = AC_SETCLR | AC_UARTBRK; custom.adkcon = AC_SETCLR | AC_UARTBRK;
else else
custom.adkcon = AC_UARTBRK; custom.adkcon = AC_UARTBRK;
mb(); mb();
restore_flags(flags); local_irq_restore(flags);
} }
...@@ -1394,18 +1393,18 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file, ...@@ -1394,18 +1393,18 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file,
* Caller should use TIOCGICOUNT to see which one it was * Caller should use TIOCGICOUNT to see which one it was
*/ */
case TIOCMIWAIT: case TIOCMIWAIT:
save_flags(flags); cli(); local_irq_save(flags);
/* note the counters on entry */ /* note the counters on entry */
cprev = info->state->icount; cprev = info->state->icount;
restore_flags(flags); local_irq_restore(flags);
while (1) { while (1) {
interruptible_sleep_on(&info->delta_msr_wait); interruptible_sleep_on(&info->delta_msr_wait);
/* see if a signal did it */ /* see if a signal did it */
if (signal_pending(current)) if (signal_pending(current))
return -ERESTARTSYS; return -ERESTARTSYS;
save_flags(flags); cli(); local_irq_save(flags);
cnow = info->state->icount; /* atomic copy */ cnow = info->state->icount; /* atomic copy */
restore_flags(flags); local_irq_restore(flags);
if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr &&
cnow.dcd == cprev.dcd && cnow.cts == cprev.cts) cnow.dcd == cprev.dcd && cnow.cts == cprev.cts)
return -EIO; /* no change => error */ return -EIO; /* no change => error */
...@@ -1426,9 +1425,9 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file, ...@@ -1426,9 +1425,9 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file,
* RI where only 0->1 is counted. * RI where only 0->1 is counted.
*/ */
case TIOCGICOUNT: case TIOCGICOUNT:
save_flags(flags); cli(); local_irq_save(flags);
cnow = info->state->icount; cnow = info->state->icount;
restore_flags(flags); local_irq_restore(flags);
icount.cts = cnow.cts; icount.cts = cnow.cts;
icount.dsr = cnow.dsr; icount.dsr = cnow.dsr;
icount.rng = cnow.rng; icount.rng = cnow.rng;
...@@ -1473,9 +1472,9 @@ static void rs_set_termios(struct tty_struct *tty, struct termios *old_termios) ...@@ -1473,9 +1472,9 @@ static void rs_set_termios(struct tty_struct *tty, struct termios *old_termios)
if ((old_termios->c_cflag & CBAUD) && if ((old_termios->c_cflag & CBAUD) &&
!(cflag & CBAUD)) { !(cflag & CBAUD)) {
info->MCR &= ~(SER_DTR|SER_RTS); info->MCR &= ~(SER_DTR|SER_RTS);
save_flags(flags); cli(); local_irq_save(flags);
rtsdtr_ctrl(info->MCR); rtsdtr_ctrl(info->MCR);
restore_flags(flags); local_irq_restore(flags);
} }
/* Handle transition away from B0 status */ /* Handle transition away from B0 status */
...@@ -1486,9 +1485,9 @@ static void rs_set_termios(struct tty_struct *tty, struct termios *old_termios) ...@@ -1486,9 +1485,9 @@ static void rs_set_termios(struct tty_struct *tty, struct termios *old_termios)
!test_bit(TTY_THROTTLED, &tty->flags)) { !test_bit(TTY_THROTTLED, &tty->flags)) {
info->MCR |= SER_RTS; info->MCR |= SER_RTS;
} }
save_flags(flags); cli(); local_irq_save(flags);
rtsdtr_ctrl(info->MCR); rtsdtr_ctrl(info->MCR);
restore_flags(flags); local_irq_restore(flags);
} }
/* Handle turning off CRTSCTS */ /* Handle turning off CRTSCTS */
...@@ -1532,12 +1531,12 @@ static void rs_close(struct tty_struct *tty, struct file * filp) ...@@ -1532,12 +1531,12 @@ static void rs_close(struct tty_struct *tty, struct file * filp)
state = info->state; state = info->state;
save_flags(flags); cli(); local_irq_save(flags);
if (tty_hung_up_p(filp)) { if (tty_hung_up_p(filp)) {
DBG_CNT("before DEC-hung"); DBG_CNT("before DEC-hung");
MOD_DEC_USE_COUNT; MOD_DEC_USE_COUNT;
restore_flags(flags); local_irq_restore(flags);
return; return;
} }
...@@ -1564,7 +1563,7 @@ static void rs_close(struct tty_struct *tty, struct file * filp) ...@@ -1564,7 +1563,7 @@ static void rs_close(struct tty_struct *tty, struct file * filp)
if (state->count) { if (state->count) {
DBG_CNT("before DEC-2"); DBG_CNT("before DEC-2");
MOD_DEC_USE_COUNT; MOD_DEC_USE_COUNT;
restore_flags(flags); local_irq_restore(flags);
return; return;
} }
info->flags |= ASYNC_CLOSING; info->flags |= ASYNC_CLOSING;
...@@ -1624,7 +1623,7 @@ static void rs_close(struct tty_struct *tty, struct file * filp) ...@@ -1624,7 +1623,7 @@ static void rs_close(struct tty_struct *tty, struct file * filp)
ASYNC_CLOSING); ASYNC_CLOSING);
wake_up_interruptible(&info->close_wait); wake_up_interruptible(&info->close_wait);
MOD_DEC_USE_COUNT; MOD_DEC_USE_COUNT;
restore_flags(flags); local_irq_restore(flags);
} }
/* /*
...@@ -1797,19 +1796,19 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, ...@@ -1797,19 +1796,19 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
printk("block_til_ready before block: ttys%d, count = %d\n", printk("block_til_ready before block: ttys%d, count = %d\n",
state->line, state->count); state->line, state->count);
#endif #endif
save_flags(flags); cli(); local_irq_save(flags);
if (!tty_hung_up_p(filp)) { if (!tty_hung_up_p(filp)) {
extra_count = 1; extra_count = 1;
state->count--; state->count--;
} }
restore_flags(flags); local_irq_restore(flags);
info->blocked_open++; info->blocked_open++;
while (1) { while (1) {
save_flags(flags); cli(); local_irq_save(flags);
if (!(info->flags & ASYNC_CALLOUT_ACTIVE) && if (!(info->flags & ASYNC_CALLOUT_ACTIVE) &&
(tty->termios->c_cflag & CBAUD)) (tty->termios->c_cflag & CBAUD))
rtsdtr_ctrl(SER_DTR|SER_RTS); rtsdtr_ctrl(SER_DTR|SER_RTS);
restore_flags(flags); local_irq_restore(flags);
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
if (tty_hung_up_p(filp) || if (tty_hung_up_p(filp) ||
!(info->flags & ASYNC_INITIALIZED)) { !(info->flags & ASYNC_INITIALIZED)) {
...@@ -2009,10 +2008,10 @@ static inline int line_info(char *buf, struct serial_state *state) ...@@ -2009,10 +2008,10 @@ static inline int line_info(char *buf, struct serial_state *state)
info->quot = 0; info->quot = 0;
info->tty = 0; info->tty = 0;
} }
save_flags(flags); cli(); local_irq_save(flags);
status = ciab.pra; status = ciab.pra;
control = info ? info->MCR : status; control = info ? info->MCR : status;
restore_flags(flags); local_irq_restore(flags);
stat_buf[0] = 0; stat_buf[0] = 0;
stat_buf[1] = 0; stat_buf[1] = 0;
...@@ -2207,8 +2206,7 @@ static int __init rs_init(void) ...@@ -2207,8 +2206,7 @@ static int __init rs_init(void)
state->baud_base = amiga_colorclock; state->baud_base = amiga_colorclock;
state->xmit_fifo_size = 1; state->xmit_fifo_size = 1;
save_flags (flags); local_irq_save(flags);
cli();
/* set ISRs, and then disable the rx interrupts */ /* set ISRs, and then disable the rx interrupts */
request_irq(IRQ_AMIGA_TBE, ser_tx_int, 0, "serial TX", state); request_irq(IRQ_AMIGA_TBE, ser_tx_int, 0, "serial TX", state);
...@@ -2222,7 +2220,7 @@ static int __init rs_init(void) ...@@ -2222,7 +2220,7 @@ static int __init rs_init(void)
custom.intreq = IF_RBF | IF_TBE; custom.intreq = IF_RBF | IF_TBE;
mb(); mb();
restore_flags (flags); local_irq_restore(flags);
/* /*
* set the appropriate directions for the modem control flags, * set the appropriate directions for the modem control flags,
......
...@@ -201,10 +201,9 @@ static void a2232_disable_tx_interrupts(void *ptr) ...@@ -201,10 +201,9 @@ static void a2232_disable_tx_interrupts(void *ptr)
stat->OutDisable = -1; stat->OutDisable = -1;
/* Does this here really have to be? */ /* Does this here really have to be? */
save_flags(flags); local_irq_save(flags);
cli();
port->gs.flags &= ~GS_TX_INTEN; port->gs.flags &= ~GS_TX_INTEN;
restore_flags(flags); local_irq_restore(flags);
} }
static void a2232_enable_tx_interrupts(void *ptr) static void a2232_enable_tx_interrupts(void *ptr)
...@@ -218,10 +217,9 @@ static void a2232_enable_tx_interrupts(void *ptr) ...@@ -218,10 +217,9 @@ static void a2232_enable_tx_interrupts(void *ptr)
stat->OutDisable = 0; stat->OutDisable = 0;
/* Does this here really have to be? */ /* Does this here really have to be? */
save_flags(flags); local_irq_save(flags);
cli();
port->gs.flags |= GS_TX_INTEN; port->gs.flags |= GS_TX_INTEN;
restore_flags(flags); local_irq_restore(flags);
} }
static void a2232_disable_rx_interrupts(void *ptr) static void a2232_disable_rx_interrupts(void *ptr)
...@@ -252,8 +250,7 @@ static void a2232_shutdown_port(void *ptr) ...@@ -252,8 +250,7 @@ static void a2232_shutdown_port(void *ptr)
port = ptr; port = ptr;
stat = a2232stat(port->which_a2232, port->which_port_on_a2232); stat = a2232stat(port->which_a2232, port->which_port_on_a2232);
save_flags(flags); local_irq_save(flags);
cli();
port->gs.flags &= ~GS_ACTIVE; port->gs.flags &= ~GS_ACTIVE;
...@@ -266,7 +263,7 @@ static void a2232_shutdown_port(void *ptr) ...@@ -266,7 +263,7 @@ static void a2232_shutdown_port(void *ptr)
stat->Setup = -1; stat->Setup = -1;
} }
restore_flags(flags); local_irq_restore(flags);
/* After analyzing control flow, I think a2232_shutdown_port /* After analyzing control flow, I think a2232_shutdown_port
is actually the last call from the system when at application is actually the last call from the system when at application
...@@ -300,15 +297,14 @@ static int a2232_set_real_termios(void *ptr) ...@@ -300,15 +297,14 @@ static int a2232_set_real_termios(void *ptr)
baud = port->gs.baud; baud = port->gs.baud;
if (baud == 0) { if (baud == 0) {
/* speed == 0 -> drop DTR, do nothing else */ /* speed == 0 -> drop DTR, do nothing else */
save_flags(flags); local_irq_save(flags);
cli();
// Clear DTR (and RTS... mhhh). // Clear DTR (and RTS... mhhh).
status->Command = ( (status->Command & ~A2232CMD_CMask) | status->Command = ( (status->Command & ~A2232CMD_CMask) |
A2232CMD_Close ); A2232CMD_Close );
status->OutFlush = -1; status->OutFlush = -1;
status->Setup = -1; status->Setup = -1;
restore_flags(flags); local_irq_restore(flags);
return 0; return 0;
} }
...@@ -387,8 +383,7 @@ static int a2232_set_real_termios(void *ptr) ...@@ -387,8 +383,7 @@ static int a2232_set_real_termios(void *ptr)
/* Now we have all parameters and can go to set them: */ /* Now we have all parameters and can go to set them: */
save_flags(flags); local_irq_save(flags);
cli();
status->Param = a2232_param | A2232PARAM_RcvBaud; status->Param = a2232_param | A2232PARAM_RcvBaud;
status->Command = a2232_cmd | A2232CMD_Open | A2232CMD_Enable; status->Command = a2232_cmd | A2232CMD_Open | A2232CMD_Enable;
...@@ -396,7 +391,7 @@ static int a2232_set_real_termios(void *ptr) ...@@ -396,7 +391,7 @@ static int a2232_set_real_termios(void *ptr)
status->OutDisable = 0; status->OutDisable = 0;
status->Setup = -1; status->Setup = -1;
restore_flags(flags); local_irq_restore(flags);
return 0; return 0;
} }
......
...@@ -274,18 +274,18 @@ serial_paranoia_check(struct cyclades_port *info, kdev_t device, ...@@ -274,18 +274,18 @@ serial_paranoia_check(struct cyclades_port *info, kdev_t device,
void void
SP(char *data){ SP(char *data){
unsigned long flags; unsigned long flags;
save_flags(flags); cli(); local_irq_save(flags);
console_print(data); console_print(data);
restore_flags(flags); local_irq_restore(flags);
} }
char scrn[2]; char scrn[2];
void void
CP(char data){ CP(char data){
unsigned long flags; unsigned long flags;
save_flags(flags); cli(); local_irq_save(flags);
scrn[0] = data; scrn[0] = data;
console_print(scrn); console_print(scrn);
restore_flags(flags); local_irq_restore(flags);
}/* CP */ }/* CP */
void CP1(int data) { (data<10)? CP(data+'0'): CP(data+'A'-10); }/* CP1 */ void CP1(int data) { (data<10)? CP(data+'0'): CP(data+'A'-10); }/* CP1 */
...@@ -305,7 +305,7 @@ write_cy_cmd(volatile u_char *base_addr, u_char cmd) ...@@ -305,7 +305,7 @@ write_cy_cmd(volatile u_char *base_addr, u_char cmd)
unsigned long flags; unsigned long flags;
volatile int i; volatile int i;
save_flags(flags); cli(); local_irq_save(flags);
/* Check to see that the previous command has completed */ /* Check to see that the previous command has completed */
for(i = 0 ; i < 100 ; i++){ for(i = 0 ; i < 100 ; i++){
if (base_addr[CyCCR] == 0){ if (base_addr[CyCCR] == 0){
...@@ -316,13 +316,13 @@ write_cy_cmd(volatile u_char *base_addr, u_char cmd) ...@@ -316,13 +316,13 @@ write_cy_cmd(volatile u_char *base_addr, u_char cmd)
/* if the CCR never cleared, the previous command /* if the CCR never cleared, the previous command
didn't finish within the "reasonable time" */ didn't finish within the "reasonable time" */
if ( i == 10 ) { if ( i == 10 ) {
restore_flags(flags); local_irq_restore(flags);
return (-1); return (-1);
} }
/* Issue the new command */ /* Issue the new command */
base_addr[CyCCR] = cmd; base_addr[CyCCR] = cmd;
restore_flags(flags); local_irq_restore(flags);
return(0); return(0);
} /* write_cy_cmd */ } /* write_cy_cmd */
...@@ -347,10 +347,10 @@ cy_stop(struct tty_struct *tty) ...@@ -347,10 +347,10 @@ cy_stop(struct tty_struct *tty)
channel = info->line; channel = info->line;
save_flags(flags); cli(); local_irq_save(flags);
base_addr[CyCAR] = (u_char)(channel); /* index channel */ base_addr[CyCAR] = (u_char)(channel); /* index channel */
base_addr[CyIER] &= ~(CyTxMpty|CyTxRdy); base_addr[CyIER] &= ~(CyTxMpty|CyTxRdy);
restore_flags(flags); local_irq_restore(flags);
return; return;
} /* cy_stop */ } /* cy_stop */
...@@ -372,10 +372,10 @@ cy_start(struct tty_struct *tty) ...@@ -372,10 +372,10 @@ cy_start(struct tty_struct *tty)
channel = info->line; channel = info->line;
save_flags(flags); cli(); local_irq_save(flags);
base_addr[CyCAR] = (u_char)(channel); base_addr[CyCAR] = (u_char)(channel);
base_addr[CyIER] |= CyTxMpty; base_addr[CyIER] |= CyTxMpty;
restore_flags(flags); local_irq_restore(flags);
return; return;
} /* cy_start */ } /* cy_start */
...@@ -816,7 +816,7 @@ startup(struct cyclades_port * info) ...@@ -816,7 +816,7 @@ startup(struct cyclades_port * info)
printk("startup channel %d\n", channel); printk("startup channel %d\n", channel);
#endif #endif
save_flags(flags); cli(); local_irq_save(flags);
base_addr[CyCAR] = (u_char)channel; base_addr[CyCAR] = (u_char)channel;
write_cy_cmd(base_addr,CyENB_RCVR|CyENB_XMTR); write_cy_cmd(base_addr,CyENB_RCVR|CyENB_XMTR);
...@@ -838,7 +838,7 @@ startup(struct cyclades_port * info) ...@@ -838,7 +838,7 @@ startup(struct cyclades_port * info)
} }
info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; info->xmit_cnt = info->xmit_head = info->xmit_tail = 0;
restore_flags(flags); local_irq_restore(flags);
#ifdef SERIAL_DEBUG_OPEN #ifdef SERIAL_DEBUG_OPEN
printk(" done\n"); printk(" done\n");
...@@ -854,10 +854,10 @@ start_xmit( struct cyclades_port *info ) ...@@ -854,10 +854,10 @@ start_xmit( struct cyclades_port *info )
int channel; int channel;
channel = info->line; channel = info->line;
save_flags(flags); cli(); local_irq_save(flags);
base_addr[CyCAR] = channel; base_addr[CyCAR] = channel;
base_addr[CyIER] |= CyTxMpty; base_addr[CyIER] |= CyTxMpty;
restore_flags(flags); local_irq_restore(flags);
} /* start_xmit */ } /* start_xmit */
/* /*
...@@ -888,7 +888,7 @@ shutdown(struct cyclades_port * info) ...@@ -888,7 +888,7 @@ shutdown(struct cyclades_port * info)
Other choices are to delay some fixed interval Other choices are to delay some fixed interval
or schedule some later processing. or schedule some later processing.
*/ */
save_flags(flags); cli(); local_irq_save(flags);
if (info->xmit_buf){ if (info->xmit_buf){
free_page((unsigned long) info->xmit_buf); free_page((unsigned long) info->xmit_buf);
info->xmit_buf = 0; info->xmit_buf = 0;
...@@ -912,7 +912,7 @@ shutdown(struct cyclades_port * info) ...@@ -912,7 +912,7 @@ shutdown(struct cyclades_port * info)
set_bit(TTY_IO_ERROR, &info->tty->flags); set_bit(TTY_IO_ERROR, &info->tty->flags);
} }
info->flags &= ~ASYNC_INITIALIZED; info->flags &= ~ASYNC_INITIALIZED;
restore_flags(flags); local_irq_restore(flags);
#ifdef SERIAL_DEBUG_OPEN #ifdef SERIAL_DEBUG_OPEN
printk(" done\n"); printk(" done\n");
...@@ -1079,7 +1079,7 @@ config_setup(struct cyclades_port * info) ...@@ -1079,7 +1079,7 @@ config_setup(struct cyclades_port * info)
channel = info->line; channel = info->line;
save_flags(flags); cli(); local_irq_save(flags);
base_addr[CyCAR] = (u_char)channel; base_addr[CyCAR] = (u_char)channel;
/* CyCMR set once only in mvme167_init_serial() */ /* CyCMR set once only in mvme167_init_serial() */
...@@ -1159,7 +1159,7 @@ config_setup(struct cyclades_port * info) ...@@ -1159,7 +1159,7 @@ config_setup(struct cyclades_port * info)
clear_bit(TTY_IO_ERROR, &info->tty->flags); clear_bit(TTY_IO_ERROR, &info->tty->flags);
} }
restore_flags(flags); local_irq_restore(flags);
} /* config_setup */ } /* config_setup */
...@@ -1180,16 +1180,16 @@ cy_put_char(struct tty_struct *tty, unsigned char ch) ...@@ -1180,16 +1180,16 @@ cy_put_char(struct tty_struct *tty, unsigned char ch)
if (!tty || !info->xmit_buf) if (!tty || !info->xmit_buf)
return; return;
save_flags(flags); cli(); local_irq_save(flags);
if (info->xmit_cnt >= PAGE_SIZE - 1) { if (info->xmit_cnt >= PAGE_SIZE - 1) {
restore_flags(flags); local_irq_restore(flags);
return; return;
} }
info->xmit_buf[info->xmit_head++] = ch; info->xmit_buf[info->xmit_head++] = ch;
info->xmit_head &= PAGE_SIZE - 1; info->xmit_head &= PAGE_SIZE - 1;
info->xmit_cnt++; info->xmit_cnt++;
restore_flags(flags); local_irq_restore(flags);
} /* cy_put_char */ } /* cy_put_char */
...@@ -1214,10 +1214,10 @@ cy_flush_chars(struct tty_struct *tty) ...@@ -1214,10 +1214,10 @@ cy_flush_chars(struct tty_struct *tty)
channel = info->line; channel = info->line;
save_flags(flags); cli(); local_irq_save(flags);
base_addr[CyCAR] = channel; base_addr[CyCAR] = channel;
base_addr[CyIER] |= CyTxMpty; base_addr[CyIER] |= CyTxMpty;
restore_flags(flags); local_irq_restore(flags);
} /* cy_flush_chars */ } /* cy_flush_chars */
...@@ -1262,13 +1262,13 @@ cy_write(struct tty_struct * tty, int from_user, ...@@ -1262,13 +1262,13 @@ cy_write(struct tty_struct * tty, int from_user,
break; break;
} }
save_flags(flags); cli(); local_irq_save(flags);
c = MIN(c, MIN(SERIAL_XMIT_SIZE - info->xmit_cnt - 1, c = MIN(c, MIN(SERIAL_XMIT_SIZE - info->xmit_cnt - 1,
SERIAL_XMIT_SIZE - info->xmit_head)); SERIAL_XMIT_SIZE - info->xmit_head));
memcpy(info->xmit_buf + info->xmit_head, tmp_buf, c); memcpy(info->xmit_buf + info->xmit_head, tmp_buf, c);
info->xmit_head = (info->xmit_head + c) & (SERIAL_XMIT_SIZE-1); info->xmit_head = (info->xmit_head + c) & (SERIAL_XMIT_SIZE-1);
info->xmit_cnt += c; info->xmit_cnt += c;
restore_flags(flags); local_irq_restore(flags);
buf += c; buf += c;
count -= c; count -= c;
...@@ -1277,18 +1277,18 @@ cy_write(struct tty_struct * tty, int from_user, ...@@ -1277,18 +1277,18 @@ cy_write(struct tty_struct * tty, int from_user,
up(&tmp_buf_sem); up(&tmp_buf_sem);
} else { } else {
while (1) { while (1) {
save_flags(flags); cli(); local_irq_save(flags);
c = MIN(count, MIN(SERIAL_XMIT_SIZE - info->xmit_cnt - 1, c = MIN(count, MIN(SERIAL_XMIT_SIZE - info->xmit_cnt - 1,
SERIAL_XMIT_SIZE - info->xmit_head)); SERIAL_XMIT_SIZE - info->xmit_head));
if (c <= 0) { if (c <= 0) {
restore_flags(flags); local_irq_restore(flags);
break; break;
} }
memcpy(info->xmit_buf + info->xmit_head, buf, c); memcpy(info->xmit_buf + info->xmit_head, buf, c);
info->xmit_head = (info->xmit_head + c) & (SERIAL_XMIT_SIZE-1); info->xmit_head = (info->xmit_head + c) & (SERIAL_XMIT_SIZE-1);
info->xmit_cnt += c; info->xmit_cnt += c;
restore_flags(flags); local_irq_restore(flags);
buf += c; buf += c;
count -= c; count -= c;
...@@ -1352,9 +1352,9 @@ cy_flush_buffer(struct tty_struct *tty) ...@@ -1352,9 +1352,9 @@ cy_flush_buffer(struct tty_struct *tty)
if (serial_paranoia_check(info, tty->device, "cy_flush_buffer")) if (serial_paranoia_check(info, tty->device, "cy_flush_buffer"))
return; return;
save_flags(flags); cli(); local_irq_save(flags);
info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; info->xmit_cnt = info->xmit_head = info->xmit_tail = 0;
restore_flags(flags); local_irq_restore(flags);
wake_up_interruptible(&tty->write_wait); wake_up_interruptible(&tty->write_wait);
if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP))
&& tty->ldisc.write_wakeup) && tty->ldisc.write_wakeup)
...@@ -1393,10 +1393,10 @@ cy_throttle(struct tty_struct * tty) ...@@ -1393,10 +1393,10 @@ cy_throttle(struct tty_struct * tty)
channel = info->line; channel = info->line;
save_flags(flags); cli(); local_irq_save(flags);
base_addr[CyCAR] = (u_char)channel; base_addr[CyCAR] = (u_char)channel;
base_addr[CyMSVR1] = 0; base_addr[CyMSVR1] = 0;
restore_flags(flags); local_irq_restore(flags);
return; return;
} /* cy_throttle */ } /* cy_throttle */
...@@ -1429,10 +1429,10 @@ cy_unthrottle(struct tty_struct * tty) ...@@ -1429,10 +1429,10 @@ cy_unthrottle(struct tty_struct * tty)
channel = info->line; channel = info->line;
save_flags(flags); cli(); local_irq_save(flags);
base_addr[CyCAR] = (u_char)channel; base_addr[CyCAR] = (u_char)channel;
base_addr[CyMSVR1] = CyRTS; base_addr[CyMSVR1] = CyRTS;
restore_flags(flags); local_irq_restore(flags);
return; return;
} /* cy_unthrottle */ } /* cy_unthrottle */
...@@ -1514,10 +1514,10 @@ get_modem_info(struct cyclades_port * info, unsigned int *value) ...@@ -1514,10 +1514,10 @@ get_modem_info(struct cyclades_port * info, unsigned int *value)
channel = info->line; channel = info->line;
save_flags(flags); cli(); local_irq_save(flags);
base_addr[CyCAR] = (u_char)channel; base_addr[CyCAR] = (u_char)channel;
status = base_addr[CyMSVR1] | base_addr[CyMSVR2]; status = base_addr[CyMSVR1] | base_addr[CyMSVR2];
restore_flags(flags); local_irq_restore(flags);
result = ((status & CyRTS) ? TIOCM_RTS : 0) result = ((status & CyRTS) ? TIOCM_RTS : 0)
| ((status & CyDTR) ? TIOCM_DTR : 0) | ((status & CyDTR) ? TIOCM_DTR : 0)
...@@ -1543,13 +1543,13 @@ set_modem_info(struct cyclades_port * info, unsigned int cmd, ...@@ -1543,13 +1543,13 @@ set_modem_info(struct cyclades_port * info, unsigned int cmd,
switch (cmd) { switch (cmd) {
case TIOCMBIS: case TIOCMBIS:
if (arg & TIOCM_RTS){ if (arg & TIOCM_RTS){
save_flags(flags); cli(); local_irq_save(flags);
base_addr[CyCAR] = (u_char)channel; base_addr[CyCAR] = (u_char)channel;
base_addr[CyMSVR1] = CyRTS; base_addr[CyMSVR1] = CyRTS;
restore_flags(flags); local_irq_restore(flags);
} }
if (arg & TIOCM_DTR){ if (arg & TIOCM_DTR){
save_flags(flags); cli(); local_irq_save(flags);
base_addr[CyCAR] = (u_char)channel; base_addr[CyCAR] = (u_char)channel;
/* CP('S');CP('2'); */ /* CP('S');CP('2'); */
base_addr[CyMSVR2] = CyDTR; base_addr[CyMSVR2] = CyDTR;
...@@ -1557,18 +1557,18 @@ set_modem_info(struct cyclades_port * info, unsigned int cmd, ...@@ -1557,18 +1557,18 @@ set_modem_info(struct cyclades_port * info, unsigned int cmd,
printk("cyc: %d: raising DTR\n", __LINE__); printk("cyc: %d: raising DTR\n", __LINE__);
printk(" status: 0x%x, 0x%x\n", base_addr[CyMSVR1], base_addr[CyMSVR2]); printk(" status: 0x%x, 0x%x\n", base_addr[CyMSVR1], base_addr[CyMSVR2]);
#endif #endif
restore_flags(flags); local_irq_restore(flags);
} }
break; break;
case TIOCMBIC: case TIOCMBIC:
if (arg & TIOCM_RTS){ if (arg & TIOCM_RTS){
save_flags(flags); cli(); local_irq_save(flags);
base_addr[CyCAR] = (u_char)channel; base_addr[CyCAR] = (u_char)channel;
base_addr[CyMSVR1] = 0; base_addr[CyMSVR1] = 0;
restore_flags(flags); local_irq_restore(flags);
} }
if (arg & TIOCM_DTR){ if (arg & TIOCM_DTR){
save_flags(flags); cli(); local_irq_save(flags);
base_addr[CyCAR] = (u_char)channel; base_addr[CyCAR] = (u_char)channel;
/* CP('C');CP('2'); */ /* CP('C');CP('2'); */
base_addr[CyMSVR2] = 0; base_addr[CyMSVR2] = 0;
...@@ -1576,23 +1576,23 @@ set_modem_info(struct cyclades_port * info, unsigned int cmd, ...@@ -1576,23 +1576,23 @@ set_modem_info(struct cyclades_port * info, unsigned int cmd,
printk("cyc: %d: dropping DTR\n", __LINE__); printk("cyc: %d: dropping DTR\n", __LINE__);
printk(" status: 0x%x, 0x%x\n", base_addr[CyMSVR1], base_addr[CyMSVR2]); printk(" status: 0x%x, 0x%x\n", base_addr[CyMSVR1], base_addr[CyMSVR2]);
#endif #endif
restore_flags(flags); local_irq_restore(flags);
} }
break; break;
case TIOCMSET: case TIOCMSET:
if (arg & TIOCM_RTS){ if (arg & TIOCM_RTS){
save_flags(flags); cli(); local_irq_save(flags);
base_addr[CyCAR] = (u_char)channel; base_addr[CyCAR] = (u_char)channel;
base_addr[CyMSVR1] = CyRTS; base_addr[CyMSVR1] = CyRTS;
restore_flags(flags); local_irq_restore(flags);
}else{ }else{
save_flags(flags); cli(); local_irq_save(flags);
base_addr[CyCAR] = (u_char)channel; base_addr[CyCAR] = (u_char)channel;
base_addr[CyMSVR1] = 0; base_addr[CyMSVR1] = 0;
restore_flags(flags); local_irq_restore(flags);
} }
if (arg & TIOCM_DTR){ if (arg & TIOCM_DTR){
save_flags(flags); cli(); local_irq_save(flags);
base_addr[CyCAR] = (u_char)channel; base_addr[CyCAR] = (u_char)channel;
/* CP('S');CP('3'); */ /* CP('S');CP('3'); */
base_addr[CyMSVR2] = CyDTR; base_addr[CyMSVR2] = CyDTR;
...@@ -1600,9 +1600,9 @@ set_modem_info(struct cyclades_port * info, unsigned int cmd, ...@@ -1600,9 +1600,9 @@ set_modem_info(struct cyclades_port * info, unsigned int cmd,
printk("cyc: %d: raising DTR\n", __LINE__); printk("cyc: %d: raising DTR\n", __LINE__);
printk(" status: 0x%x, 0x%x\n", base_addr[CyMSVR1], base_addr[CyMSVR2]); printk(" status: 0x%x, 0x%x\n", base_addr[CyMSVR1], base_addr[CyMSVR2]);
#endif #endif
restore_flags(flags); local_irq_restore(flags);
}else{ }else{
save_flags(flags); cli(); local_irq_save(flags);
base_addr[CyCAR] = (u_char)channel; base_addr[CyCAR] = (u_char)channel;
/* CP('C');CP('3'); */ /* CP('C');CP('3'); */
base_addr[CyMSVR2] = 0; base_addr[CyMSVR2] = 0;
...@@ -1610,7 +1610,7 @@ set_modem_info(struct cyclades_port * info, unsigned int cmd, ...@@ -1610,7 +1610,7 @@ set_modem_info(struct cyclades_port * info, unsigned int cmd,
printk("cyc: %d: dropping DTR\n", __LINE__); printk("cyc: %d: dropping DTR\n", __LINE__);
printk(" status: 0x%x, 0x%x\n", base_addr[CyMSVR1], base_addr[CyMSVR2]); printk(" status: 0x%x, 0x%x\n", base_addr[CyMSVR1], base_addr[CyMSVR2]);
#endif #endif
restore_flags(flags); local_irq_restore(flags);
} }
break; break;
default: default:
...@@ -2060,7 +2060,7 @@ block_til_ready(struct tty_struct *tty, struct file * filp, ...@@ -2060,7 +2060,7 @@ block_til_ready(struct tty_struct *tty, struct file * filp,
channel = info->line; channel = info->line;
while (1) { while (1) {
save_flags(flags); cli(); local_irq_save(flags);
if (!(info->flags & ASYNC_CALLOUT_ACTIVE)){ if (!(info->flags & ASYNC_CALLOUT_ACTIVE)){
base_addr[CyCAR] = (u_char)channel; base_addr[CyCAR] = (u_char)channel;
base_addr[CyMSVR1] = CyRTS; base_addr[CyMSVR1] = CyRTS;
...@@ -2071,7 +2071,7 @@ block_til_ready(struct tty_struct *tty, struct file * filp, ...@@ -2071,7 +2071,7 @@ block_til_ready(struct tty_struct *tty, struct file * filp,
printk(" status: 0x%x, 0x%x\n", base_addr[CyMSVR1], base_addr[CyMSVR2]); printk(" status: 0x%x, 0x%x\n", base_addr[CyMSVR1], base_addr[CyMSVR2]);
#endif #endif
} }
restore_flags(flags); local_irq_restore(flags);
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
if (tty_hung_up_p(filp) if (tty_hung_up_p(filp)
|| !(info->flags & ASYNC_INITIALIZED) ){ || !(info->flags & ASYNC_INITIALIZED) ){
...@@ -2082,17 +2082,17 @@ block_til_ready(struct tty_struct *tty, struct file * filp, ...@@ -2082,17 +2082,17 @@ block_til_ready(struct tty_struct *tty, struct file * filp,
} }
break; break;
} }
save_flags(flags); cli(); local_irq_save(flags);
base_addr[CyCAR] = (u_char)channel; base_addr[CyCAR] = (u_char)channel;
/* CP('L');CP1(1 && C_CLOCAL(tty)); CP1(1 && (base_addr[CyMSVR1] & CyDCD) ); */ /* CP('L');CP1(1 && C_CLOCAL(tty)); CP1(1 && (base_addr[CyMSVR1] & CyDCD) ); */
if (!(info->flags & ASYNC_CALLOUT_ACTIVE) if (!(info->flags & ASYNC_CALLOUT_ACTIVE)
&& !(info->flags & ASYNC_CLOSING) && !(info->flags & ASYNC_CLOSING)
&& (C_CLOCAL(tty) && (C_CLOCAL(tty)
|| (base_addr[CyMSVR1] & CyDCD))) { || (base_addr[CyMSVR1] & CyDCD))) {
restore_flags(flags); local_irq_restore(flags);
break; break;
} }
restore_flags(flags); local_irq_restore(flags);
if (signal_pending(current)) { if (signal_pending(current)) {
retval = -ERESTARTSYS; retval = -ERESTARTSYS;
break; break;
...@@ -2238,7 +2238,7 @@ mvme167_serial_console_setup(int cflag) ...@@ -2238,7 +2238,7 @@ mvme167_serial_console_setup(int cflag)
u_char rcor, rbpr, badspeed = 0; u_char rcor, rbpr, badspeed = 0;
unsigned long flags; unsigned long flags;
save_flags(flags); cli(); local_irq_save(flags);
/* /*
* First probe channel zero of the chip, to see what speed has * First probe channel zero of the chip, to see what speed has
...@@ -2263,7 +2263,7 @@ mvme167_serial_console_setup(int cflag) ...@@ -2263,7 +2263,7 @@ mvme167_serial_console_setup(int cflag)
my_udelay(20000L); /* Allow time for any active o/p to complete */ my_udelay(20000L); /* Allow time for any active o/p to complete */
if(base_addr[CyCCR] != 0x00){ if(base_addr[CyCCR] != 0x00){
restore_flags(flags); local_irq_restore(flags);
/* printk(" chip is never idle (CCR != 0)\n"); */ /* printk(" chip is never idle (CCR != 0)\n"); */
return; return;
} }
...@@ -2272,7 +2272,7 @@ mvme167_serial_console_setup(int cflag) ...@@ -2272,7 +2272,7 @@ mvme167_serial_console_setup(int cflag)
my_udelay(1000L); my_udelay(1000L);
if(base_addr[CyGFRCR] == 0x00){ if(base_addr[CyGFRCR] == 0x00){
restore_flags(flags); local_irq_restore(flags);
/* printk(" chip is not responding (GFRCR stayed 0)\n"); */ /* printk(" chip is not responding (GFRCR stayed 0)\n"); */
return; return;
} }
...@@ -2331,7 +2331,7 @@ mvme167_serial_console_setup(int cflag) ...@@ -2331,7 +2331,7 @@ mvme167_serial_console_setup(int cflag)
base_addr[CyIER] = CyRxData; base_addr[CyIER] = CyRxData;
write_cy_cmd(base_addr,CyENB_RCVR|CyENB_XMTR); write_cy_cmd(base_addr,CyENB_RCVR|CyENB_XMTR);
restore_flags(flags); local_irq_restore(flags);
my_udelay(20000L); /* Let it all settle down */ my_udelay(20000L); /* Let it all settle down */
...@@ -2606,7 +2606,7 @@ show_status(int line_num) ...@@ -2606,7 +2606,7 @@ show_status(int line_num)
info->session, info->pgrp, (long)info->open_wait); info->session, info->pgrp, (long)info->open_wait);
save_flags(flags); cli(); local_irq_save(flags);
/* Global Registers */ /* Global Registers */
...@@ -2664,7 +2664,7 @@ show_status(int line_num) ...@@ -2664,7 +2664,7 @@ show_status(int line_num)
printk(" CyTBPR %x\n", base_addr[CyTBPR]); printk(" CyTBPR %x\n", base_addr[CyTBPR]);
printk(" CyTCOR %x\n", base_addr[CyTCOR]); printk(" CyTCOR %x\n", base_addr[CyTCOR]);
restore_flags(flags); local_irq_restore(flags);
} /* show_status */ } /* show_status */
#endif #endif
...@@ -2764,7 +2764,7 @@ void serial167_console_write(struct console *co, const char *str, unsigned count ...@@ -2764,7 +2764,7 @@ void serial167_console_write(struct console *co, const char *str, unsigned count
u_char do_lf = 0; u_char do_lf = 0;
int i = 0; int i = 0;
save_flags(flags); cli(); local_irq_save(flags);
/* Ensure transmitter is enabled! */ /* Ensure transmitter is enabled! */
...@@ -2811,7 +2811,7 @@ void serial167_console_write(struct console *co, const char *str, unsigned count ...@@ -2811,7 +2811,7 @@ void serial167_console_write(struct console *co, const char *str, unsigned count
base_addr[CyIER] = ier; base_addr[CyIER] = ier;
restore_flags(flags); local_irq_restore(flags);
} }
static kdev_t serial167_console_device(struct console *c) static kdev_t serial167_console_device(struct console *c)
...@@ -2855,7 +2855,7 @@ void putDebugChar (int c) ...@@ -2855,7 +2855,7 @@ void putDebugChar (int c)
u_char ier; u_char ier;
int port; int port;
save_flags(flags); cli(); local_irq_save(flags);
/* Ensure transmitter is enabled! */ /* Ensure transmitter is enabled! */
...@@ -2885,7 +2885,7 @@ void putDebugChar (int c) ...@@ -2885,7 +2885,7 @@ void putDebugChar (int c)
base_addr[CyIER] = ier; base_addr[CyIER] = ier;
restore_flags(flags); local_irq_restore(flags);
} }
int getDebugChar() int getDebugChar()
...@@ -2907,7 +2907,7 @@ int getDebugChar() ...@@ -2907,7 +2907,7 @@ int getDebugChar()
} }
/* OK, nothing in queue, wait in poll loop */ /* OK, nothing in queue, wait in poll loop */
save_flags(flags); cli(); local_irq_save(flags);
/* Ensure receiver is enabled! */ /* Ensure receiver is enabled! */
...@@ -2953,7 +2953,7 @@ int getDebugChar() ...@@ -2953,7 +2953,7 @@ int getDebugChar()
base_addr[CyIER] = ier; base_addr[CyIER] = ier;
restore_flags(flags); local_irq_restore(flags);
return (c); return (c);
} }
...@@ -2979,7 +2979,7 @@ debug_setup() ...@@ -2979,7 +2979,7 @@ debug_setup()
cflag = B19200; cflag = B19200;
save_flags(flags); cli(); local_irq_save(flags);
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
{ {
...@@ -3034,7 +3034,7 @@ debug_setup() ...@@ -3034,7 +3034,7 @@ debug_setup()
base_addr[CyIER] = CyRxData; base_addr[CyIER] = CyRxData;
restore_flags(flags); local_irq_restore(flags);
} /* debug_setup */ } /* debug_setup */
......
...@@ -624,11 +624,10 @@ static void scc_disable_tx_interrupts(void *ptr) ...@@ -624,11 +624,10 @@ static void scc_disable_tx_interrupts(void *ptr)
unsigned long flags; unsigned long flags;
SCC_ACCESS_INIT(port); SCC_ACCESS_INIT(port);
save_flags(flags); local_irq_save(flags);
cli();
SCCmod(INT_AND_DMA_REG, ~IDR_TX_INT_ENAB, 0); SCCmod(INT_AND_DMA_REG, ~IDR_TX_INT_ENAB, 0);
port->gs.flags &= ~GS_TX_INTEN; port->gs.flags &= ~GS_TX_INTEN;
restore_flags(flags); local_irq_restore(flags);
} }
...@@ -638,12 +637,11 @@ static void scc_enable_tx_interrupts(void *ptr) ...@@ -638,12 +637,11 @@ static void scc_enable_tx_interrupts(void *ptr)
unsigned long flags; unsigned long flags;
SCC_ACCESS_INIT(port); SCC_ACCESS_INIT(port);
save_flags(flags); local_irq_save(flags);
cli();
SCCmod(INT_AND_DMA_REG, 0xff, IDR_TX_INT_ENAB); SCCmod(INT_AND_DMA_REG, 0xff, IDR_TX_INT_ENAB);
/* restart the transmitter */ /* restart the transmitter */
scc_tx_int (0, port, 0); scc_tx_int (0, port, 0);
restore_flags(flags); local_irq_restore(flags);
} }
...@@ -653,11 +651,10 @@ static void scc_disable_rx_interrupts(void *ptr) ...@@ -653,11 +651,10 @@ static void scc_disable_rx_interrupts(void *ptr)
unsigned long flags; unsigned long flags;
SCC_ACCESS_INIT(port); SCC_ACCESS_INIT(port);
save_flags(flags); local_irq_save(flags);
cli();
SCCmod(INT_AND_DMA_REG, SCCmod(INT_AND_DMA_REG,
~(IDR_RX_INT_MASK|IDR_PARERR_AS_SPCOND|IDR_EXTSTAT_INT_ENAB), 0); ~(IDR_RX_INT_MASK|IDR_PARERR_AS_SPCOND|IDR_EXTSTAT_INT_ENAB), 0);
restore_flags(flags); local_irq_restore(flags);
} }
...@@ -667,11 +664,10 @@ static void scc_enable_rx_interrupts(void *ptr) ...@@ -667,11 +664,10 @@ static void scc_enable_rx_interrupts(void *ptr)
unsigned long flags; unsigned long flags;
SCC_ACCESS_INIT(port); SCC_ACCESS_INIT(port);
save_flags(flags); local_irq_save(flags);
cli();
SCCmod(INT_AND_DMA_REG, 0xff, SCCmod(INT_AND_DMA_REG, 0xff,
IDR_EXTSTAT_INT_ENAB|IDR_PARERR_AS_SPCOND|IDR_RX_INT_ALL); IDR_EXTSTAT_INT_ENAB|IDR_PARERR_AS_SPCOND|IDR_RX_INT_ALL);
restore_flags(flags); local_irq_restore(flags);
} }
...@@ -717,10 +713,9 @@ static int scc_set_real_termios (void *ptr) ...@@ -717,10 +713,9 @@ static int scc_set_real_termios (void *ptr)
if (baud == 0) { if (baud == 0) {
/* speed == 0 -> drop DTR */ /* speed == 0 -> drop DTR */
save_flags(flags); local_irq_save(flags);
cli();
SCCmod(TX_CTRL_REG, ~TCR_DTR, 0); SCCmod(TX_CTRL_REG, ~TCR_DTR, 0);
restore_flags(flags); local_irq_restore(flags);
return 0; return 0;
} }
else if ((MACH_IS_MVME16x && (baud < 50 || baud > 38400)) || else if ((MACH_IS_MVME16x && (baud < 50 || baud > 38400)) ||
...@@ -748,8 +743,7 @@ static int scc_set_real_termios (void *ptr) ...@@ -748,8 +743,7 @@ static int scc_set_real_termios (void *ptr)
brgval = (BVME_SCC_RTxC + baud/2) / (16 * 2 * baud) - 2; brgval = (BVME_SCC_RTxC + baud/2) / (16 * 2 * baud) - 2;
#endif #endif
/* Now we have all parameters and can go to set them: */ /* Now we have all parameters and can go to set them: */
save_flags(flags); local_irq_save(flags);
cli();
/* receiver's character size and auto-enables */ /* receiver's character size and auto-enables */
SCCmod(RX_CTRL_REG, ~(RCR_CHSIZE_MASK|RCR_AUTO_ENAB_MODE), SCCmod(RX_CTRL_REG, ~(RCR_CHSIZE_MASK|RCR_AUTO_ENAB_MODE),
...@@ -773,7 +767,7 @@ static int scc_set_real_termios (void *ptr) ...@@ -773,7 +767,7 @@ static int scc_set_real_termios (void *ptr)
/* BRG enable, and clock source never changes */ /* BRG enable, and clock source never changes */
SCCmod(DPLL_CTRL_REG, 0xff, DCR_BRG_ENAB); SCCmod(DPLL_CTRL_REG, 0xff, DCR_BRG_ENAB);
restore_flags(flags); local_irq_restore(flags);
return 0; return 0;
} }
...@@ -823,13 +817,12 @@ static void scc_setsignals(struct scc_port *port, int dtr, int rts) ...@@ -823,13 +817,12 @@ static void scc_setsignals(struct scc_port *port, int dtr, int rts)
unsigned char t; unsigned char t;
SCC_ACCESS_INIT(port); SCC_ACCESS_INIT(port);
save_flags(flags); local_irq_save(flags);
cli();
t = SCCread(TX_CTRL_REG); t = SCCread(TX_CTRL_REG);
if (dtr >= 0) t = dtr? (t | TCR_DTR): (t & ~TCR_DTR); if (dtr >= 0) t = dtr? (t | TCR_DTR): (t & ~TCR_DTR);
if (rts >= 0) t = rts? (t | TCR_RTS): (t & ~TCR_RTS); if (rts >= 0) t = rts? (t | TCR_RTS): (t & ~TCR_RTS);
SCCwrite(TX_CTRL_REG, t); SCCwrite(TX_CTRL_REG, t);
restore_flags(flags); local_irq_restore(flags);
} }
...@@ -914,8 +907,7 @@ static int scc_open (struct tty_struct * tty, struct file * filp) ...@@ -914,8 +907,7 @@ static int scc_open (struct tty_struct * tty, struct file * filp)
}; };
#endif #endif
if (!(port->gs.flags & ASYNC_INITIALIZED)) { if (!(port->gs.flags & ASYNC_INITIALIZED)) {
save_flags(flags); local_irq_save(flags);
cli();
#if defined(CONFIG_MVME147_SCC) || defined(CONFIG_MVME162_SCC) #if defined(CONFIG_MVME147_SCC) || defined(CONFIG_MVME162_SCC)
if (MACH_IS_MVME147 || MACH_IS_MVME16x) { if (MACH_IS_MVME147 || MACH_IS_MVME16x) {
for (i=0; i<sizeof(mvme_init_tab)/sizeof(*mvme_init_tab); ++i) for (i=0; i<sizeof(mvme_init_tab)/sizeof(*mvme_init_tab); ++i)
...@@ -934,7 +926,7 @@ static int scc_open (struct tty_struct * tty, struct file * filp) ...@@ -934,7 +926,7 @@ static int scc_open (struct tty_struct * tty, struct file * filp)
port->c_dcd = 0; /* Prevent initial 1->0 interrupt */ port->c_dcd = 0; /* Prevent initial 1->0 interrupt */
scc_setsignals (port, 1,1); scc_setsignals (port, 1,1);
restore_flags(flags); local_irq_restore(flags);
} }
tty->driver_data = port; tty->driver_data = port;
...@@ -982,10 +974,9 @@ static void scc_throttle (struct tty_struct * tty) ...@@ -982,10 +974,9 @@ static void scc_throttle (struct tty_struct * tty)
SCC_ACCESS_INIT(port); SCC_ACCESS_INIT(port);
if (tty->termios->c_cflag & CRTSCTS) { if (tty->termios->c_cflag & CRTSCTS) {
save_flags(flags); local_irq_save(flags);
cli();
SCCmod(TX_CTRL_REG, ~TCR_RTS, 0); SCCmod(TX_CTRL_REG, ~TCR_RTS, 0);
restore_flags(flags); local_irq_restore(flags);
} }
if (I_IXOFF(tty)) if (I_IXOFF(tty))
scc_send_xchar(tty, STOP_CHAR(tty)); scc_send_xchar(tty, STOP_CHAR(tty));
...@@ -999,10 +990,9 @@ static void scc_unthrottle (struct tty_struct * tty) ...@@ -999,10 +990,9 @@ static void scc_unthrottle (struct tty_struct * tty)
SCC_ACCESS_INIT(port); SCC_ACCESS_INIT(port);
if (tty->termios->c_cflag & CRTSCTS) { if (tty->termios->c_cflag & CRTSCTS) {
save_flags(flags); local_irq_save(flags);
cli();
SCCmod(TX_CTRL_REG, 0xff, TCR_RTS); SCCmod(TX_CTRL_REG, 0xff, TCR_RTS);
restore_flags(flags); local_irq_restore(flags);
} }
if (I_IXOFF(tty)) if (I_IXOFF(tty))
scc_send_xchar(tty, START_CHAR(tty)); scc_send_xchar(tty, START_CHAR(tty));
...@@ -1022,11 +1012,10 @@ static void scc_break_ctl(struct tty_struct *tty, int break_state) ...@@ -1022,11 +1012,10 @@ static void scc_break_ctl(struct tty_struct *tty, int break_state)
unsigned long flags; unsigned long flags;
SCC_ACCESS_INIT(port); SCC_ACCESS_INIT(port);
save_flags(flags); local_irq_save(flags);
cli();
SCCmod(TX_CTRL_REG, ~TCR_SEND_BREAK, SCCmod(TX_CTRL_REG, ~TCR_SEND_BREAK,
break_state ? TCR_SEND_BREAK : 0); break_state ? TCR_SEND_BREAK : 0);
restore_flags(flags); local_irq_restore(flags);
} }
...@@ -1069,8 +1058,7 @@ static void scc_console_write (struct console *co, const char *str, unsigned cou ...@@ -1069,8 +1058,7 @@ static void scc_console_write (struct console *co, const char *str, unsigned cou
{ {
unsigned long flags; unsigned long flags;
save_flags(flags); local_irq_save(flags);
cli();
while (count--) while (count--)
{ {
...@@ -1078,7 +1066,7 @@ static void scc_console_write (struct console *co, const char *str, unsigned cou ...@@ -1078,7 +1066,7 @@ static void scc_console_write (struct console *co, const char *str, unsigned cou
scc_ch_write ('\r'); scc_ch_write ('\r');
scc_ch_write (*str++); scc_ch_write (*str++);
} }
restore_flags(flags); local_irq_restore(flags);
} }
static kdev_t scc_console_device(struct console *c) static kdev_t scc_console_device(struct console *c)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment