]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/serial/mcfserial.c
Fix compile errors in SGI console drivers (linux-next tree)
[linux-2.6-omap-h63xx.git] / drivers / serial / mcfserial.c
index ddd3aa50d4adef5de5e136df8fbd5fa3a8738ad8..fbe3835f6b77c5fc5be02a1f22564f6b0e3345ce 100644 (file)
@@ -1,3 +1,4 @@
+#warning This driver is deprecated. Check Kconfig for details.
 /*
  * mcfserial.c -- serial driver for ColdFire internal UARTS.
  *
@@ -326,7 +327,7 @@ static void mcfrs_start(struct tty_struct *tty)
 static inline void receive_chars(struct mcf_serial *info)
 {
        volatile unsigned char  *uartp;
-       struct tty_struct       *tty = info->tty;
+       struct tty_struct       *tty = info->port.tty;
        unsigned char           status, ch, flag;
 
        if (!tty)
@@ -381,7 +382,7 @@ static inline void transmit_chars(struct mcf_serial *info)
                info->stats.tx++;
        }
 
-       if ((info->xmit_cnt <= 0) || info->tty->stopped) {
+       if ((info->xmit_cnt <= 0) || info->port.tty->stopped) {
                info->imr &= ~MCFUART_UIR_TXREADY;
                uartp[MCFUART_UIMR] = info->imr;
                return;
@@ -427,7 +428,7 @@ irqreturn_t mcfrs_interrupt(int irq, void *dev_id)
 static void mcfrs_offintr(struct work_struct *work)
 {
        struct mcf_serial *info = container_of(work, struct mcf_serial, tqueue);
-       struct tty_struct *tty = info->tty;
+       struct tty_struct *tty = info->port.tty;
        
        if (tty)
                tty_wakeup(tty);
@@ -497,7 +498,7 @@ static void mcfrs_timer(void)
 static void do_serial_hangup(struct work_struct *work)
 {
        struct mcf_serial *info = container_of(work, struct mcf_serial, tqueue_hangup);
-       struct tty_struct *tty = info->tty;
+       struct tty_struct *tty = info->port.tty;
        
        if (tty)
                tty_hangup(tty);
@@ -531,8 +532,8 @@ static int startup(struct mcf_serial * info)
        uartp[MCFUART_UCR] = MCFUART_UCR_CMDRESETTX;  /* reset TX */
        mcfrs_setsignals(info, 1, 1);
 
-       if (info->tty)
-               clear_bit(TTY_IO_ERROR, &info->tty->flags);
+       if (info->port.tty)
+               clear_bit(TTY_IO_ERROR, &info->port.tty->flags);
        info->xmit_cnt = info->xmit_head = info->xmit_tail = 0;
 
        /*
@@ -577,7 +578,7 @@ static void shutdown(struct mcf_serial * info)
        uartp[MCFUART_UCR] = MCFUART_UCR_CMDRESETRX;  /* reset RX */
        uartp[MCFUART_UCR] = MCFUART_UCR_CMDRESETTX;  /* reset TX */
 
-       if (!info->tty || (info->tty->termios->c_cflag & HUPCL))
+       if (!info->port.tty || (info->port.tty->termios->c_cflag & HUPCL))
                mcfrs_setsignals(info, 0, 0);
 
        if (info->xmit_buf) {
@@ -585,8 +586,8 @@ static void shutdown(struct mcf_serial * info)
                info->xmit_buf = 0;
        }
 
-       if (info->tty)
-               set_bit(TTY_IO_ERROR, &info->tty->flags);
+       if (info->port.tty)
+               set_bit(TTY_IO_ERROR, &info->port.tty->flags);
        
        info->flags &= ~ASYNC_INITIALIZED;
        local_irq_restore(flags);
@@ -608,9 +609,9 @@ static void mcfrs_change_speed(struct mcf_serial *info)
        unsigned int            fraction;
 #endif
 
-       if (!info->tty || !info->tty->termios)
+       if (!info->port.tty || !info->port.tty->termios)
                return;
-       cflag = info->tty->termios->c_cflag;
+       cflag = info->port.tty->termios->c_cflag;
        if (info->addr == 0)
                return;
 
@@ -622,7 +623,7 @@ static void mcfrs_change_speed(struct mcf_serial *info)
        if (i & CBAUDEX) {
                i &= ~CBAUDEX;
                if (i < 1 || i > 4)
-                       info->tty->termios->c_cflag &= ~CBAUDEX;
+                       info->port.tty->termios->c_cflag &= ~CBAUDEX;
                else
                        i += 15;
        }
@@ -1072,18 +1073,6 @@ static int mcfrs_ioctl(struct tty_struct *tty, struct file * file,
                        tty_wait_until_sent(tty, 0);
                        send_break(info, arg ? arg*(HZ/10) : HZ/4);
                        return 0;
-               case TIOCGSOFTCAR:
-                       error = put_user(C_CLOCAL(tty) ? 1 : 0,
-                                   (unsigned long *) arg);
-                       if (error)
-                               return error;
-                       return 0;
-               case TIOCSSOFTCAR:
-                       get_user(arg, (unsigned long *) arg);
-                       tty->termios->c_cflag =
-                               ((tty->termios->c_cflag & ~CLOCAL) |
-                                (arg ? CLOCAL : 0));
-                       return 0;
                case TIOCGSERIAL:
                        if (access_ok(VERIFY_WRITE, (void *) arg,
                                                sizeof(struct serial_struct)))
@@ -1222,13 +1211,12 @@ static void mcfrs_close(struct tty_struct *tty, struct file * filp)
        } else
 #endif
        shutdown(info);
-       if (tty->driver->flush_buffer)
-               tty->driver->flush_buffer(tty);
+       mcfrs_flush_buffer(tty);
        tty_ldisc_flush(tty);
        
        tty->closing = 0;
        info->event = 0;
-       info->tty = 0;
+       info->port.tty = NULL;
 #if 0  
        if (tty->ldisc.num != ldiscs[N_TTY].num) {
                if (tty->ldisc.close)
@@ -1276,6 +1264,8 @@ mcfrs_wait_until_sent(struct tty_struct *tty, int timeout)
         * Note: we have to use pretty tight timings here to satisfy
         * the NIST-PCTS.
         */
+       lock_kernel();
+
        fifo_time = (MCF5272_FIFO_SIZE * HZ * 10) / info->baud;
        char_time = fifo_time / 5;
        if (char_time == 0)
@@ -1312,6 +1302,7 @@ mcfrs_wait_until_sent(struct tty_struct *tty, int timeout)
                if (timeout && time_after(jiffies, orig_jiffies + timeout))
                        break;
        }
+       unlock_kernel();
 #else
        /*
         * For the other coldfire models, assume all data has been sent
@@ -1334,7 +1325,7 @@ void mcfrs_hangup(struct tty_struct *tty)
        info->event = 0;
        info->count = 0;
        info->flags &= ~ASYNC_NORMAL_ACTIVE;
-       info->tty = 0;
+       info->port.tty = NULL;
        wake_up_interruptible(&info->open_wait);
 }
 
@@ -1461,7 +1452,7 @@ int mcfrs_open(struct tty_struct *tty, struct file * filp)
 #endif
        info->count++;
        tty->driver_data = info;
-       info->tty = tty;
+       info->port.tty = tty;
 
        /*
         * Start up serial port
@@ -1776,7 +1767,7 @@ mcfrs_init(void)
        for (i = 0, info = mcfrs_table; (i < NR_PORTS); i++, info++) {
                info->magic = SERIAL_MAGIC;
                info->line = i;
-               info->tty = 0;
+               info->port.tty = NULL;
                info->custom_divisor = 16;
                info->close_delay = 50;
                info->closing_wait = 3000;
@@ -1907,7 +1898,7 @@ static struct tty_driver *mcfrs_console_device(struct console *c, int *index)
  *     This is used for console output.
  */
 
-void mcfrs_put_char(char ch)
+int mcfrs_put_char(char ch)
 {
        volatile unsigned char  *uartp;
        unsigned long           flags;
@@ -1931,7 +1922,7 @@ void mcfrs_put_char(char ch)
                mcfrs_init_console(); /* try and get it back */
        local_irq_restore(flags);
 
-       return;
+       return 1;
 }