intel-gtt: switch i81x to the common initialization helpers
[linux-2.6.git] / drivers / char / rio / riotty.c
index cfa5436..8a90393 100644 (file)
 **
 ** -----------------------------------------------------------------------------
 */
-#ifdef SCCS_LABELS
-static char *_riotty_c_sccs_ = "@(#)riotty.c   1.3";
-#endif
-
 
 #define __EXPLICIT_DEF_H__
 
 #include <linux/module.h>
-#include <linux/slab.h>
+#include <linux/sched.h>
 #include <linux/errno.h>
 #include <linux/tty.h>
 #include <linux/string.h>
 #include <asm/io.h>
 #include <asm/system.h>
 #include <asm/string.h>
-#include <asm/semaphore.h>
 #include <asm/uaccess.h>
 
 #include <linux/termios.h>
@@ -145,14 +140,14 @@ int riotopen(struct tty_struct *tty, struct file *filp)
 
        tty->driver_data = PortP;
 
-       PortP->gs.tty = tty;
-       PortP->gs.count++;
+       PortP->gs.port.tty = tty;
+       PortP->gs.port.count++;
 
        rio_dprintk(RIO_DEBUG_TTY, "%d bytes in tx buffer\n", PortP->gs.xmit_cnt);
 
        retval = gs_init_port(&PortP->gs);
        if (retval) {
-               PortP->gs.count--;
+               PortP->gs.port.count--;
                return -ENXIO;
        }
        /*
@@ -212,7 +207,7 @@ int riotopen(struct tty_struct *tty, struct file *filp)
                rio_dprintk(RIO_DEBUG_TTY, "Waiting for RIO_CLOSING to go away\n");
                if (repeat_this-- <= 0) {
                        rio_dprintk(RIO_DEBUG_TTY, "Waiting for not idle closed broken by signal\n");
-                       RIOPreemptiveCmd(p, PortP, FCLOSE);
+                       RIOPreemptiveCmd(p, PortP, RIOC_FCLOSE);
                        retval = -EINTR;
                        goto bombout;
                }
@@ -265,7 +260,7 @@ int riotopen(struct tty_struct *tty, struct file *filp)
                   here. If I read the docs correctly the "open"
                   command piggybacks the parameters immediately.
                   -- REW */
-               RIOParam(PortP, OPEN, 1, OK_TO_SLEEP);  /* Open the port */
+               RIOParam(PortP, RIOC_OPEN, 1, OK_TO_SLEEP); /* Open the port */
                rio_spin_lock_irqsave(&PortP->portSem, flags);
 
                /*
@@ -276,7 +271,7 @@ int riotopen(struct tty_struct *tty, struct file *filp)
                        rio_spin_unlock_irqrestore(&PortP->portSem, flags);
                        if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) {
                                rio_dprintk(RIO_DEBUG_TTY, "Waiting for open to finish broken by signal\n");
-                               RIOPreemptiveCmd(p, PortP, FCLOSE);
+                               RIOPreemptiveCmd(p, PortP, RIOC_FCLOSE);
                                func_exit();
                                return -EINTR;
                        }
@@ -298,23 +293,24 @@ int riotopen(struct tty_struct *tty, struct file *filp)
         ** insert test for carrier here. -- ???
         ** I already see that test here. What's the deal? -- REW
         */
-       if ((PortP->gs.tty->termios->c_cflag & CLOCAL) || (PortP->ModemState & MSVR1_CD)) {
+       if ((PortP->gs.port.tty->termios->c_cflag & CLOCAL) ||
+                       (PortP->ModemState & RIOC_MSVR1_CD)) {
                rio_dprintk(RIO_DEBUG_TTY, "open(%d) Modem carr on\n", SysPort);
                /*
                   tp->tm.c_state |= CARR_ON;
                   wakeup((caddr_t) &tp->tm.c_canq);
                 */
                PortP->State |= RIO_CARR_ON;
-               wake_up_interruptible(&PortP->gs.open_wait);
+               wake_up_interruptible(&PortP->gs.port.open_wait);
        } else {        /* no carrier - wait for DCD */
                        /*
-                  while (!(PortP->gs.tty->termios->c_state & CARR_ON) &&
+                  while (!(PortP->gs.port.tty->termios->c_state & CARR_ON) &&
                   !(filp->f_flags & O_NONBLOCK) && !p->RIOHalted )
                 */
                while (!(PortP->State & RIO_CARR_ON) && !(filp->f_flags & O_NONBLOCK) && !p->RIOHalted) {
                                rio_dprintk(RIO_DEBUG_TTY, "open(%d) sleeping for carr on\n", SysPort);
                        /*
-                          PortP->gs.tty->termios->c_state |= WOPEN;
+                          PortP->gs.port.tty->termios->c_state |= WOPEN;
                         */
                        PortP->State |= RIO_WOPEN;
                        rio_spin_unlock_irqrestore(&PortP->portSem, flags);
@@ -326,7 +322,7 @@ int riotopen(struct tty_struct *tty, struct file *filp)
                                 ** I think it's OK. -- REW
                                 */
                                rio_dprintk(RIO_DEBUG_TTY, "open(%d) sleeping for carr broken by signal\n", SysPort);
-                               RIOPreemptiveCmd(p, PortP, FCLOSE);
+                               RIOPreemptiveCmd(p, PortP, RIOC_FCLOSE);
                                /*
                                   tp->tm.c_state &= ~WOPEN;
                                 */
@@ -384,7 +380,7 @@ int riotclose(void *ptr)
        /* PortP = p->RIOPortp[SysPort]; */
        rio_dprintk(RIO_DEBUG_TTY, "Port is at address %p\n", PortP);
        /* tp = PortP->TtyP; *//* Get tty */
-       tty = PortP->gs.tty;
+       tty = PortP->gs.port.tty;
        rio_dprintk(RIO_DEBUG_TTY, "TTY is at address %p\n", tty);
 
        if (PortP->gs.closing_wait)
@@ -417,7 +413,7 @@ int riotclose(void *ptr)
         */
        PortP->State &= ~RIO_MOPEN;
        PortP->State &= ~RIO_CARR_ON;
-       PortP->ModemState &= ~MSVR1_CD;
+       PortP->ModemState &= ~RIOC_MSVR1_CD;
        /*
         ** If the device was open as both a Modem and a tty line
         ** then we need to wimp out here, as the port has not really
@@ -454,7 +450,7 @@ int riotclose(void *ptr)
                        if (repeat_this-- <= 0) {
                                rv = -EINTR;
                                rio_dprintk(RIO_DEBUG_TTY, "Waiting for not idle closed broken by signal\n");
-                               RIOPreemptiveCmd(p, PortP, FCLOSE);
+                               RIOPreemptiveCmd(p, PortP, RIOC_FCLOSE);
                                goto close_end;
                        }
                        rio_dprintk(RIO_DEBUG_TTY, "Calling timeout to flush in closing\n");
@@ -493,8 +489,8 @@ int riotclose(void *ptr)
        /* Can't call RIOShortCommand with the port locked. */
        rio_spin_unlock_irqrestore(&PortP->portSem, flags);
 
-       if (RIOShortCommand(p, PortP, CLOSE, 1, 0) == RIO_FAIL) {
-               RIOPreemptiveCmd(p, PortP, FCLOSE);
+       if (RIOShortCommand(p, PortP, RIOC_CLOSE, 1, 0) == RIO_FAIL) {
+               RIOPreemptiveCmd(p, PortP, RIOC_FCLOSE);
                rio_spin_lock_irqsave(&PortP->portSem, flags);
                goto close_end;
        }
@@ -504,7 +500,7 @@ int riotclose(void *ptr)
                        try--;
                        if (time_after(jiffies, end_time)) {
                                rio_dprintk(RIO_DEBUG_TTY, "Run out of tries - force the bugger shut!\n");
-                               RIOPreemptiveCmd(p, PortP, FCLOSE);
+                               RIOPreemptiveCmd(p, PortP, RIOC_FCLOSE);
                                break;
                        }
                        rio_dprintk(RIO_DEBUG_TTY, "Close: PortState:ISOPEN is %d\n", PortP->PortState & PORT_ISOPEN);
@@ -516,14 +512,14 @@ int riotclose(void *ptr)
                        }
                        if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) {
                                rio_dprintk(RIO_DEBUG_TTY, "RTA EINTR in delay \n");
-                               RIOPreemptiveCmd(p, PortP, FCLOSE);
+                               RIOPreemptiveCmd(p, PortP, RIOC_FCLOSE);
                                break;
                        }
                }
        rio_spin_lock_irqsave(&PortP->portSem, flags);
        rio_dprintk(RIO_DEBUG_TTY, "Close: try was %d on completion\n", try);
 
-       /* RIOPreemptiveCmd(p, PortP, FCLOSE); */
+       /* RIOPreemptiveCmd(p, PortP, RIOC_FCLOSE); */
 
 /*
 ** 15.10.1998 ARG - ESIL 0761 part fix