Merge ../linus
[linux-drm-fsl-dcu.git] / drivers / char / moxa.c
index 96cb1f07332b68e5fb5b77dfb68a74d6356c6b64..f391a24a1b442c1e8eb4aaf1c1857d015dfdc89b 100644 (file)
@@ -222,7 +222,7 @@ static struct semaphore moxaBuffSem;
 /*
  * static functions:
  */
-static void do_moxa_softint(void *);
+static void do_moxa_softint(struct work_struct *);
 static int moxa_open(struct tty_struct *, struct file *);
 static void moxa_close(struct tty_struct *, struct file *);
 static int moxa_write(struct tty_struct *, const unsigned char *, int);
@@ -234,7 +234,7 @@ static void moxa_put_char(struct tty_struct *, unsigned char);
 static int moxa_ioctl(struct tty_struct *, struct file *, unsigned int, unsigned long);
 static void moxa_throttle(struct tty_struct *);
 static void moxa_unthrottle(struct tty_struct *);
-static void moxa_set_termios(struct tty_struct *, struct termios *);
+static void moxa_set_termios(struct tty_struct *, struct ktermios *);
 static void moxa_stop(struct tty_struct *);
 static void moxa_start(struct tty_struct *);
 static void moxa_hangup(struct tty_struct *);
@@ -261,7 +261,7 @@ static void MoxaPortEnable(int);
 static void MoxaPortDisable(int);
 static long MoxaPortGetMaxBaud(int);
 static long MoxaPortSetBaud(int, long);
-static int MoxaPortSetTermio(int, struct termios *, speed_t);
+static int MoxaPortSetTermio(int, struct ktermios *, speed_t);
 static int MoxaPortGetLineOut(int, int *, int *);
 static void MoxaPortLineCtrl(int, int, int);
 static void MoxaPortFlowCtrl(int, int, int, int, int, int);
@@ -355,6 +355,8 @@ static int __init moxa_init(void)
        moxaDriver->init_termios.c_oflag = 0;
        moxaDriver->init_termios.c_cflag = B9600 | CS8 | CREAD | CLOCAL | HUPCL;
        moxaDriver->init_termios.c_lflag = 0;
+       moxaDriver->init_termios.c_ispeed = 9600;
+       moxaDriver->init_termios.c_ospeed = 9600;
        moxaDriver->flags = TTY_DRIVER_REAL_RAW;
        tty_set_operations(moxaDriver, &moxa_ops);
 
@@ -363,7 +365,7 @@ static int __init moxa_init(void)
        for (i = 0, ch = moxaChannels; i < MAX_PORTS; i++, ch++) {
                ch->type = PORT_16550A;
                ch->port = i;
-               INIT_WORK(&ch->tqueue, do_moxa_softint, ch);
+               INIT_WORK(&ch->tqueue, do_moxa_softint);
                ch->tty = NULL;
                ch->close_delay = 5 * HZ / 10;
                ch->closing_wait = 30 * HZ;
@@ -498,9 +500,12 @@ static void __exit moxa_exit(void)
                printk("Couldn't unregister MOXA Intellio family serial driver\n");
        put_tty_driver(moxaDriver);
 
-       for (i = 0; i < MAX_BOARDS; i++)
+       for (i = 0; i < MAX_BOARDS; i++) {
+               if (moxaBaseAddr[i])
+                       iounmap(moxaBaseAddr[i]);
                if (moxa_boards[i].busType == MOXA_BUS_TYPE_PCI)
                        pci_dev_put(moxa_boards[i].pciInfo.pdev);
+       }
 
        if (verbose)
                printk("Done\n");
@@ -509,9 +514,9 @@ static void __exit moxa_exit(void)
 module_init(moxa_init);
 module_exit(moxa_exit);
 
-static void do_moxa_softint(void *private_)
+static void do_moxa_softint(struct work_struct *work)
 {
-       struct moxa_str *ch = (struct moxa_str *) private_;
+       struct moxa_str *ch = container_of(work, struct moxa_str, tqueue);
        struct tty_struct *tty;
 
        if (ch && (tty = ch->tty)) {
@@ -861,7 +866,7 @@ static void moxa_unthrottle(struct tty_struct *tty)
 }
 
 static void moxa_set_termios(struct tty_struct *tty,
-                            struct termios *old_termios)
+                            struct ktermios *old_termios)
 {
        struct moxa_str *ch = (struct moxa_str *) tty->driver_data;
 
@@ -975,7 +980,7 @@ static void moxa_poll(unsigned long ignored)
 
 static void set_tty_param(struct tty_struct *tty)
 {
-       register struct termios *ts;
+       register struct ktermios *ts;
        struct moxa_str *ch;
        int rts, cts, txflow, rxflow, xany;
 
@@ -1146,7 +1151,7 @@ static void shut_down(struct moxa_str *ch)
 static void receive_data(struct moxa_str *ch)
 {
        struct tty_struct *tp;
-       struct termios *ts;
+       struct ktermios *ts;
        unsigned long flags;
 
        ts = NULL;
@@ -1909,9 +1914,9 @@ int MoxaPortsOfCard(int cardno)
  *
  *      Function 12:    Configure the port.
  *      Syntax:
- *      int  MoxaPortSetTermio(int port, struct termios *termio, speed_t baud);
+ *      int  MoxaPortSetTermio(int port, struct ktermios *termio, speed_t baud);
  *           int port           : port number (0 - 127)
- *           struct termios * termio : termio structure pointer
+ *           struct ktermios * termio : termio structure pointer
  *          speed_t baud       : baud rate
  *
  *           return:    -1      : this port is invalid or termio == NULL
@@ -2192,7 +2197,7 @@ long MoxaPortSetBaud(int port, long baud)
        return (baud);
 }
 
-int MoxaPortSetTermio(int port, struct termios *termio, speed_t baud)
+int MoxaPortSetTermio(int port, struct ktermios *termio, speed_t baud)
 {
        void __iomem *ofsAddr;
        tcflag_t cflag;