]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/char/isicom.c
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux-2.6
[linux-2.6-omap-h63xx.git] / drivers / char / isicom.c
index 43ab9edc76f540ce254f07f827e00414bd70abc2..4f3cefa8eb0e28cd0632983e66cebc63e5bb82ae 100644 (file)
 #include <linux/delay.h>
 #include <linux/ioport.h>
 
-#include <asm/uaccess.h>
-#include <asm/io.h>
+#include <linux/uaccess.h>
+#include <linux/io.h>
 #include <asm/system.h>
 
 #include <linux/pci.h>
 #define InterruptTheCard(base) outw(0, (base) + 0xc)
 #define ClearInterrupt(base) inw((base) + 0x0a)
 
+#define pr_dbg(str...) pr_debug("ISICOM: " str)
 #ifdef DEBUG
-#define pr_dbg(str...) printk(KERN_DEBUG "ISICOM: " str)
 #define isicom_paranoia_check(a, b, c) __isicom_paranoia_check((a), (b), (c))
 #else
-#define pr_dbg(str...) do { } while (0)
 #define isicom_paranoia_check(a, b, c) 0
 #endif
 
@@ -172,9 +171,6 @@ static struct pci_driver isicom_driver = {
 static int prev_card = 3;      /*      start servicing isi_card[0]     */
 static struct tty_driver *isicom_normal;
 
-static DECLARE_COMPLETION(isi_timerdone);
-static char re_schedule = 1;
-
 static void isicom_tx(unsigned long _data);
 static void isicom_start(struct tty_struct *tty);
 
@@ -188,12 +184,12 @@ static signed char linuxb_to_isib[] = {
 
 struct isi_board {
        unsigned long           base;
-       unsigned char           irq;
+       int                     irq;
        unsigned char           port_count;
        unsigned short          status;
        unsigned short          port_status; /* each bit for each port */
        unsigned short          shift_count;
-       struct isi_port         * ports;
+       struct isi_port         *ports;
        signed char             count;
        spinlock_t              card_lock; /* Card wide lock 11/5/00 -sameer */
        unsigned long           flags;
@@ -209,11 +205,11 @@ struct    isi_port {
        u16                     channel;
        u16                     status;
        u16                     closing_wait;
-       struct isi_board        * card;
-       struct tty_struct       * tty;
+       struct isi_board        *card;
+       struct tty_struct       *tty;
        wait_queue_head_t       close_wait;
        wait_queue_head_t       open_wait;
-       unsigned char           * xmit_buf;
+       unsigned char           *xmit_buf;
        int                     xmit_head;
        int                     xmit_tail;
        int                     xmit_cnt;
@@ -228,7 +224,7 @@ static struct isi_port  isi_ports[PORT_COUNT];
  *     it wants to talk.
  */
 
-static inline int WaitTillCardIsFree(u16 base)
+static inline int WaitTillCardIsFree(unsigned long base)
 {
        unsigned int count = 0;
        unsigned int a = in_atomic(); /* do we run under spinlock? */
@@ -244,17 +240,18 @@ static inline int WaitTillCardIsFree(u16 base)
 
 static int lock_card(struct isi_board *card)
 {
-       char            retries;
        unsigned long base = card->base;
+       unsigned int retries, a;
 
-       for (retries = 0; retries < 100; retries++) {
+       for (retries = 0; retries < 10; retries++) {
                spin_lock_irqsave(&card->card_lock, card->flags);
-               if (inw(base + 0xe) & 0x1) {
-                       return 1;
-               } else {
-                       spin_unlock_irqrestore(&card->card_lock, card->flags);
-                       udelay(1000);   /* 1ms */
+               for (a = 0; a < 10; a++) {
+                       if (inw(base + 0xe) & 0x1)
+                               return 1;
+                       udelay(10);
                }
+               spin_unlock_irqrestore(&card->card_lock, card->flags);
+               msleep(10);
        }
        printk(KERN_WARNING "ISICOM: Failed to lock Card (0x%lx)\n",
                card->base);
@@ -262,23 +259,6 @@ static int lock_card(struct isi_board *card)
        return 0;       /* Failed to acquire the card! */
 }
 
-static int lock_card_at_interrupt(struct isi_board *card)
-{
-       unsigned char           retries;
-       unsigned long base = card->base;
-
-       for (retries = 0; retries < 200; retries++) {
-               spin_lock_irqsave(&card->card_lock, card->flags);
-
-               if (inw(base + 0xe) & 0x1)
-                       return 1;
-               else
-                       spin_unlock_irqrestore(&card->card_lock, card->flags);
-       }
-       /* Failing in interrupt is an acceptable event */
-       return 0;       /* Failed to acquire the card! */
-}
-
 static void unlock_card(struct isi_board *card)
 {
        spin_unlock_irqrestore(&card->card_lock, card->flags);
@@ -416,14 +396,16 @@ static inline int __isicom_paranoia_check(struct isi_port const *port,
 
 static void isicom_tx(unsigned long _data)
 {
-       short count = (BOARD_COUNT-1), card, base;
+       unsigned long flags, base;
+       unsigned int retries;
+       short count = (BOARD_COUNT-1), card;
        short txcount, wrd, residue, word_count, cnt;
        struct isi_port *port;
        struct tty_struct *tty;
 
        /*      find next active board  */
        card = (prev_card + 1) & 0x0003;
-       while(count-- > 0) {
+       while (count-- > 0) {
                if (isi_card[card].status & BOARD_ACTIVE)
                        break;
                card = (card + 1) & 0x0003;
@@ -436,32 +418,34 @@ static void isicom_tx(unsigned long _data)
        count = isi_card[card].port_count;
        port = isi_card[card].ports;
        base = isi_card[card].base;
-       for (;count > 0;count--, port++) {
-               if (!lock_card_at_interrupt(&isi_card[card]))
-                       continue;
+
+       spin_lock_irqsave(&isi_card[card].card_lock, flags);
+       for (retries = 0; retries < 100; retries++) {
+               if (inw(base + 0xe) & 0x1)
+                       break;
+               udelay(2);
+       }
+       if (retries >= 100)
+               goto unlock;
+
+       for (; count > 0; count--, port++) {
                /* port not active or tx disabled to force flow control */
                if (!(port->flags & ASYNC_INITIALIZED) ||
                                !(port->status & ISI_TXOK))
-                       unlock_card(&isi_card[card]);
                        continue;
 
                tty = port->tty;
 
-
-               if (tty == NULL) {
-                       unlock_card(&isi_card[card]);
+               if (tty == NULL)
                        continue;
-               }
 
                txcount = min_t(short, TX_SIZE, port->xmit_cnt);
-               if (txcount <= 0 || tty->stopped || tty->hw_stopped) {
-                       unlock_card(&isi_card[card]);
+               if (txcount <= 0 || tty->stopped || tty->hw_stopped)
                        continue;
-               }
-               if (!(inw(base + 0x02) & (1 << port->channel))) {
-                       unlock_card(&isi_card[card]);
+
+               if (!(inw(base + 0x02) & (1 << port->channel)))
                        continue;
-               }
+
                pr_dbg("txing %d bytes, port%d.\n", txcount,
                        port->channel + 1);
                outw((port->channel << isi_card[card].shift_count) | txcount,
@@ -487,9 +471,10 @@ static void isicom_tx(unsigned long _data)
                                        break;
                                }
                        }
-                       if (cnt <= 0) break;
+                       if (cnt <= 0)
+                               break;
                        word_count = cnt >> 1;
-                       outsw(base, port->xmit_buf+port->xmit_tail,word_count);
+                       outsw(base, port->xmit_buf+port->xmit_tail, word_count);
                        port->xmit_tail = (port->xmit_tail
                                + (word_count << 1)) & (SERIAL_XMIT_SIZE - 1);
                        txcount -= (word_count << 1);
@@ -509,16 +494,12 @@ static void isicom_tx(unsigned long _data)
                        port->status &= ~ISI_TXOK;
                if (port->xmit_cnt <= WAKEUP_CHARS)
                        tty_wakeup(tty);
-               unlock_card(&isi_card[card]);
        }
 
+unlock:
+       spin_unlock_irqrestore(&isi_card[card].card_lock, flags);
        /*      schedule another tx for hopefully in about 10ms */
 sched_again:
-       if (!re_schedule) {
-               complete(&isi_timerdone);
-               return;
-       }
-
        mod_timer(&tx, jiffies + msecs_to_jiffies(10));
 }
 
@@ -576,7 +557,7 @@ static irqreturn_t isicom_interrupt(int irq, void *dev_id)
        tty = port->tty;
        if (tty == NULL) {
                word_count = byte_count >> 1;
-               while(byte_count > 1) {
+               while (byte_count > 1) {
                        inw(base);
                        byte_count -= 2;
                }
@@ -589,7 +570,7 @@ static irqreturn_t isicom_interrupt(int irq, void *dev_id)
 
        if (header & 0x8000) {          /* Status Packet */
                header = inw(base);
-               switch(header & 0xff) {
+               switch (header & 0xff) {
                case 0: /* Change in EIA signals */
                        if (port->flags & ASYNC_CHECK_CD) {
                                if (port->status & ISI_DCD) {
@@ -676,7 +657,8 @@ static irqreturn_t isicom_interrupt(int irq, void *dev_id)
                if (byte_count > 0) {
                        pr_dbg("Intr(0x%lx:%d): Flip buffer overflow! dropping "
                                "bytes...\n", base, channel + 1);
-                       while(byte_count > 0) { /* drain out unread xtra data */
+               /* drain out unread xtra data */
+               while (byte_count > 0) {
                                inw(base);
                                byte_count -= 2;
                        }
@@ -699,8 +681,11 @@ static void isicom_config_port(struct isi_port *port)
                shift_count = card->shift_count;
        unsigned char flow_ctrl;
 
-       if (!(tty = port->tty) || !tty->termios)
+       tty = port->tty;
+
+       if (tty == NULL)
                return;
+       /* FIXME: Switch to new tty baud API */
        baud = C_BAUD(tty);
        if (baud & CBAUDEX) {
                baud &= ~CBAUDEX;
@@ -726,7 +711,7 @@ static void isicom_config_port(struct isi_port *port)
                if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
                        baud++; /*  57.6 Kbps */
                if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)
-                       baud +=2; /*  115  Kbps */
+                       baud += 2; /*  115  Kbps */
                if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI)
                        baud += 3; /* 230 kbps*/
                if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP)
@@ -736,15 +721,14 @@ static void isicom_config_port(struct isi_port *port)
                /* hang up */
                drop_dtr(port);
                return;
-       }
-       else
+       } else
                raise_dtr(port);
 
        if (WaitTillCardIsFree(base) == 0) {
-               outw(0x8000 | (channel << shift_count) |0x03, base);
+               outw(0x8000 | (channel << shift_count) | 0x03, base);
                outw(linuxb_to_isib[baud] << 8 | 0x03, base);
                channel_setup = 0;
-               switch(C_CSIZE(tty)) {
+               switch (C_CSIZE(tty)) {
                case CS5:
                        channel_setup |= ISICOM_CS5;
                        break;
@@ -787,7 +771,7 @@ static void isicom_config_port(struct isi_port *port)
                flow_ctrl |= ISICOM_INITIATE_XONXOFF;
 
        if (WaitTillCardIsFree(base) == 0) {
-               outw(0x8000 | (channel << shift_count) |0x04, base);
+               outw(0x8000 | (channel << shift_count) | 0x04, base);
                outw(flow_ctrl << 8 | 0x05, base);
                outw((STOP_CHAR(tty)) << 8 | (START_CHAR(tty)), base);
                InterruptTheCard(base);
@@ -825,20 +809,17 @@ static int isicom_setup_port(struct isi_port *port)
        struct isi_board *card = port->card;
        unsigned long flags;
 
-       if (port->flags & ASYNC_INITIALIZED) {
+       if (port->flags & ASYNC_INITIALIZED)
                return 0;
-       }
        if (!port->xmit_buf) {
-               unsigned long page;
-
-               if (!(page = get_zeroed_page(GFP_KERNEL)))
+               /* Relies on BKL */
+               unsigned long page  = get_zeroed_page(GFP_KERNEL);
+               if (page == 0)
                        return -ENOMEM;
-
-               if (port->xmit_buf) {
+               if (port->xmit_buf)
                        free_page(page);
-                       return -ERESTARTSYS;
-               }
-               port->xmit_buf = (unsigned char *) page;
+               else
+                       port->xmit_buf = (unsigned char *) page;
        }
 
        spin_lock_irqsave(&card->card_lock, flags);
@@ -969,21 +950,18 @@ static int isicom_open(struct tty_struct *tty, struct file *filp)
        port->count++;
        tty->driver_data = port;
        port->tty = tty;
-       if ((error = isicom_setup_port(port))!=0)
-               return error;
-       if ((error = block_til_ready(tty, filp, port))!=0)
-               return error;
-
-       return 0;
+       error = isicom_setup_port(port);
+       if (error == 0)
+               error = block_til_ready(tty, filp, port);
+       return error;
 }
 
 /* close et all */
 
 static inline void isicom_shutdown_board(struct isi_board *bp)
 {
-       if (bp->status & BOARD_ACTIVE) {
+       if (bp->status & BOARD_ACTIVE)
                bp->status &= ~BOARD_ACTIVE;
-       }
 }
 
 /* card->lock HAS to be held */
@@ -1032,6 +1010,22 @@ static void isicom_shutdown_port(struct isi_port *port)
        }
 }
 
+static void isicom_flush_buffer(struct tty_struct *tty)
+{
+       struct isi_port *port = tty->driver_data;
+       struct isi_board *card = port->card;
+       unsigned long flags;
+
+       if (isicom_paranoia_check(port, tty->name, "isicom_flush_buffer"))
+               return;
+
+       spin_lock_irqsave(&card->card_lock, flags);
+       port->xmit_cnt = port->xmit_head = port->xmit_tail = 0;
+       spin_unlock_irqrestore(&card->card_lock, flags);
+
+       tty_wakeup(tty);
+}
+
 static void isicom_close(struct tty_struct *tty, struct file *filp)
 {
        struct isi_port *port = tty->driver_data;
@@ -1085,8 +1079,7 @@ static void isicom_close(struct tty_struct *tty, struct file *filp)
        isicom_shutdown_port(port);
        spin_unlock_irqrestore(&card->card_lock, flags);
 
-       if (tty->driver->flush_buffer)
-               tty->driver->flush_buffer(tty);
+       isicom_flush_buffer(tty);
        tty_ldisc_flush(tty);
 
        spin_lock_irqsave(&card->card_lock, flags);
@@ -1124,7 +1117,7 @@ static int isicom_write(struct tty_struct *tty,   const unsigned char *buf,
 
        spin_lock_irqsave(&card->card_lock, flags);
 
-       while(1) {
+       while (1) {
                cnt = min_t(int, count, min(SERIAL_XMIT_SIZE - port->xmit_cnt
                                - 1, SERIAL_XMIT_SIZE - port->xmit_head));
                if (cnt <= 0)
@@ -1145,28 +1138,29 @@ static int isicom_write(struct tty_struct *tty, const unsigned char *buf,
 }
 
 /* put_char et all */
-static void isicom_put_char(struct tty_struct *tty, unsigned char ch)
+static int isicom_put_char(struct tty_struct *tty, unsigned char ch)
 {
        struct isi_port *port = tty->driver_data;
        struct isi_board *card = port->card;
        unsigned long flags;
 
        if (isicom_paranoia_check(port, tty->name, "isicom_put_char"))
-               return;
+               return 0;
 
        if (!port->xmit_buf)
-               return;
+               return 0;
 
        spin_lock_irqsave(&card->card_lock, flags);
        if (port->xmit_cnt >= SERIAL_XMIT_SIZE - 1) {
                spin_unlock_irqrestore(&card->card_lock, flags);
-               return;
+               return 0;
        }
 
        port->xmit_buf[port->xmit_head++] = ch;
        port->xmit_head &= (SERIAL_XMIT_SIZE - 1);
        port->xmit_cnt++;
        spin_unlock_irqrestore(&card->card_lock, flags);
+       return 1;
 }
 
 /* flush_chars et all */
@@ -1278,6 +1272,8 @@ static int isicom_set_serial_info(struct isi_port *port,
        if (copy_from_user(&newinfo, info, sizeof(newinfo)))
                return -EFAULT;
 
+       lock_kernel();
+
        reconfig_port = ((port->flags & ASYNC_SPD_MASK) !=
                (newinfo.flags & ASYNC_SPD_MASK));
 
@@ -1285,12 +1281,13 @@ static int isicom_set_serial_info(struct isi_port *port,
                if ((newinfo.close_delay != port->close_delay) ||
                                (newinfo.closing_wait != port->closing_wait) ||
                                ((newinfo.flags & ~ASYNC_USR_MASK) !=
-                               (port->flags & ~ASYNC_USR_MASK)))
+                               (port->flags & ~ASYNC_USR_MASK))) {
+                       unlock_kernel();
                        return -EPERM;
-               port->flags = ((port->flags & ~ ASYNC_USR_MASK) |
+               }
+               port->flags = ((port->flags & ~ASYNC_USR_MASK) |
                                (newinfo.flags & ASYNC_USR_MASK));
-       }
-       else {
+       } else {
                port->close_delay = newinfo.close_delay;
                port->closing_wait = newinfo.closing_wait;
                port->flags = ((port->flags & ~ASYNC_FLAGS) |
@@ -1302,6 +1299,7 @@ static int isicom_set_serial_info(struct isi_port *port,
                isicom_config_port(port);
                spin_unlock_irqrestore(&port->card->card_lock, flags);
        }
+       unlock_kernel();
        return 0;
 }
 
@@ -1310,6 +1308,7 @@ static int isicom_get_serial_info(struct isi_port *port,
 {
        struct serial_struct out_info;
 
+       lock_kernel();
        memset(&out_info, 0, sizeof(out_info));
 /*     out_info.type = ? */
        out_info.line = port - isi_ports;
@@ -1319,6 +1318,7 @@ static int isicom_get_serial_info(struct isi_port *port,
 /*     out_info.baud_base = ? */
        out_info.close_delay = port->close_delay;
        out_info.closing_wait = port->closing_wait;
+       unlock_kernel();
        if (copy_to_user(info, &out_info, sizeof(out_info)))
                return -EFAULT;
        return 0;
@@ -1334,7 +1334,7 @@ static int isicom_ioctl(struct tty_struct *tty, struct file *filp,
        if (isicom_paranoia_check(port, tty->name, "isicom_ioctl"))
                return -ENODEV;
 
-       switch(cmd) {
+       switch (cmd) {
        case TCSBRK:
                retval = tty_check_change(tty);
                if (retval)
@@ -1351,19 +1351,6 @@ static int isicom_ioctl(struct tty_struct *tty, struct file *filp,
                tty_wait_until_sent(tty, 0);
                isicom_send_break(port, arg ? arg * (HZ/10) : HZ/4);
                return 0;
-
-       case TIOCGSOFTCAR:
-               return put_user(C_CLOCAL(tty) ? 1 : 0,
-                               (unsigned long __user *)argp);
-
-       case TIOCSSOFTCAR:
-               if (get_user(arg, (unsigned long __user *) argp))
-                       return -EFAULT;
-               tty->termios->c_cflag =
-                       ((tty->termios->c_cflag & ~CLOCAL) |
-                       (arg ? CLOCAL : 0));
-               return 0;
-
        case TIOCGSERIAL:
                return isicom_get_serial_info(port, argp);
 
@@ -1473,22 +1460,6 @@ static void isicom_hangup(struct tty_struct *tty)
        wake_up_interruptible(&port->open_wait);
 }
 
-/* flush_buffer et all */
-static void isicom_flush_buffer(struct tty_struct *tty)
-{
-       struct isi_port *port = tty->driver_data;
-       struct isi_board *card = port->card;
-       unsigned long flags;
-
-       if (isicom_paranoia_check(port, tty->name, "isicom_flush_buffer"))
-               return;
-
-       spin_lock_irqsave(&card->card_lock, flags);
-       port->xmit_cnt = port->xmit_head = port->xmit_tail = 0;
-       spin_unlock_irqrestore(&card->card_lock, flags);
-
-       tty_wakeup(tty);
-}
 
 /*
  * Driver init and deinit functions
@@ -1547,9 +1518,9 @@ static int __devinit reset_card(struct pci_dev *pdev,
        msleep(10);
 
        portcount = inw(base + 0x2);
-       if (!inw(base + 0xe) & 0x1 || (portcount != 0 && portcount != 4 &&
+       if (!(inw(base + 0xe) & 0x1) || (portcount != 0 && portcount != 4 &&
                                portcount != 8 && portcount != 16)) {
-               dev_err(&pdev->dev, "ISILoad:PCI Card%d reset failure.",
+               dev_err(&pdev->dev, "ISILoad:PCI Card%d reset failure.\n",
                        card + 1);
                retval = -EIO;
                goto end;
@@ -1612,7 +1583,7 @@ static int __devinit load_firmware(struct pci_dev *pdev,
        default:
                dev_err(&pdev->dev, "Unknown signature.\n");
                goto end;
-       }
+       }
 
        retval = request_firmware(&fw, name, &pdev->dev);
        if (retval)
@@ -1640,9 +1611,12 @@ static int __devinit load_firmware(struct pci_dev *pdev,
                if (WaitTillCardIsFree(base))
                        goto errrelfw;
 
-               if ((status = inw(base + 0x4)) != 0) {
+               status = inw(base + 0x4);
+               if (status != 0) {
                        dev_warn(&pdev->dev, "Card%d rejected load header:\n"
-                               "Address:0x%x\nCount:0x%x\nStatus:0x%x\n",
+                               KERN_WARNING "Address:0x%x\n"
+                               KERN_WARNING "Count:0x%x\n"
+                               KERN_WARNING "Status:0x%x\n",
                                index + 1, frame->addr, frame->count, status);
                        goto errrelfw;
                }
@@ -1655,12 +1629,13 @@ static int __devinit load_firmware(struct pci_dev *pdev,
                if (WaitTillCardIsFree(base))
                        goto errrelfw;
 
-               if ((status = inw(base + 0x4)) != 0) {
+               status = inw(base + 0x4);
+               if (status != 0) {
                        dev_err(&pdev->dev, "Card%d got out of sync.Card "
                                "Status:0x%x\n", index + 1, status);
                        goto errrelfw;
                }
-       }
+       }
 
 /* XXX: should we test it by reading it back and comparing with original like
  * in load firmware package? */
@@ -1684,9 +1659,12 @@ static int __devinit load_firmware(struct pci_dev *pdev,
                if (WaitTillCardIsFree(base))
                        goto errrelfw;
 
-               if ((status = inw(base + 0x4)) != 0) {
+               status = inw(base + 0x4);
+               if (status != 0) {
                        dev_warn(&pdev->dev, "Card%d rejected verify header:\n"
-                               "Address:0x%x\nCount:0x%x\nStatus: 0x%x\n",
+                               KERN_WARNING "Address:0x%x\n"
+                               KERN_WARNING "Count:0x%x\n"
+                               KERN_WARNING "Status: 0x%x\n",
                                index + 1, frame->addr, frame->count, status);
                        goto errrelfw;
                }
@@ -1715,7 +1693,8 @@ static int __devinit load_firmware(struct pci_dev *pdev,
                if (WaitTillCardIsFree(base))
                        goto errrelfw;
 
-               if ((status = inw(base + 0x4)) != 0) {
+               status = inw(base + 0x4);
+               if (status != 0) {
                        dev_err(&pdev->dev, "Card%d verify got out of sync. "
                                "Card Status:0x%x\n", index + 1, status);
                        goto errrelfw;
@@ -1750,17 +1729,13 @@ static unsigned int card_count;
 static int __devinit isicom_probe(struct pci_dev *pdev,
        const struct pci_device_id *ent)
 {
-       unsigned int ioaddr, signature, index;
+       unsigned int signature, index;
        int retval = -EPERM;
-       u8 pciirq;
        struct isi_board *board = NULL;
 
        if (card_count >= BOARD_COUNT)
                goto err;
 
-       ioaddr = pci_resource_start(pdev, 3);
-       /* i.e at offset 0x1c in the PCI configuration register space. */
-       pciirq = pdev->irq;
        dev_info(&pdev->dev, "ISI PCI Card(Device ID 0x%x)\n", ent->device);
 
        /* allot the first empty slot in the array */
@@ -1771,8 +1746,8 @@ static int __devinit isicom_probe(struct pci_dev *pdev,
                }
 
        board->index = index;
-       board->base = ioaddr;
-       board->irq = pciirq;
+       board->base = pci_resource_start(pdev, 3);
+       board->irq = pdev->irq;
        card_count++;
 
        pci_set_drvdata(pdev, board);
@@ -1784,7 +1759,7 @@ static int __devinit isicom_probe(struct pci_dev *pdev,
                        index + 1);
                retval = -EBUSY;
                goto errdec;
-       }
+       }
 
        retval = request_irq(board->irq, isicom_interrupt,
                        IRQF_SHARED | IRQF_DISABLED, ISICOM_NAME, board);
@@ -1838,7 +1813,7 @@ static int __init isicom_init(void)
        int retval, idx, channel;
        struct isi_port *port;
 
-       for(idx = 0; idx < BOARD_COUNT; idx++) {
+       for (idx = 0; idx < BOARD_COUNT; idx++) {
                port = &isi_ports[idx * 16];
                isi_card[idx].ports = port;
                spin_lock_init(&isi_card[idx].card_lock);
@@ -1852,7 +1827,7 @@ static int __init isicom_init(void)
                        init_waitqueue_head(&port->open_wait);
                        init_waitqueue_head(&port->close_wait);
                        /*  . . .  */
-               }
+               }
                isi_card[idx].base = 0;
                isi_card[idx].irq = 0;
        }
@@ -1902,9 +1877,7 @@ error:
 
 static void __exit isicom_exit(void)
 {
-       re_schedule = 0;
-
-       wait_for_completion_timeout(&isi_timerdone, HZ);
+       del_timer_sync(&tx);
 
        pci_unregister_driver(&isicom_driver);
        tty_unregister_driver(isicom_normal);