]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/char/specialix.c
[SCSI] add supported_mode and active_mode attributes to the host
[linux-2.6-omap-h63xx.git] / drivers / char / specialix.c
index 99137ab66b625f0e9e4d16dc836f6b13ac088aa2..455855631aeff70f441e26be40f3a745a4cb5609 100644 (file)
@@ -345,18 +345,6 @@ static inline void sx_release_io_range(struct specialix_board * bp)
 }
 
 
-/* Must be called with enabled interrupts */
-/* Ugly. Very ugly. Don't use this for anything else than initialization
-   code */
-static inline void sx_long_delay(unsigned long delay)
-{
-       unsigned long i;
-
-       for (i = jiffies + delay; time_after(i, jiffies); ) ;
-}
-
-
-
 /* Set the IRQ using the RTS lines that run to the PAL on the board.... */
 static int sx_set_irq ( struct specialix_board *bp)
 {
@@ -397,7 +385,7 @@ static int sx_init_CD186x(struct specialix_board  * bp)
        spin_lock_irqsave(&bp->lock, flags);
        sx_out_off(bp, CD186x_CCR, CCR_HARDRESET);      /* Reset CD186x chip          */
        spin_unlock_irqrestore(&bp->lock, flags);
-       sx_long_delay(HZ/20);                      /* Delay 0.05 sec            */
+       msleep(50);                                     /* Delay 0.05 sec            */
        spin_lock_irqsave(&bp->lock, flags);
        sx_out_off(bp, CD186x_GIVR, SX_ID);             /* Set ID for this chip      */
        sx_out_off(bp, CD186x_GICR, 0);                 /* Clear all bits            */
@@ -459,10 +447,9 @@ void missed_irq (unsigned long data)
        if (irq) {
                printk (KERN_INFO "Missed interrupt... Calling int from timer. \n");
                sx_interrupt (((struct specialix_board *)data)->irq,
-                             (void*)data, NULL);
+                               (void*)data);
        }
-       missed_irq_timer.expires = jiffies + sx_poll;
-       add_timer (&missed_irq_timer);
+       mod_timer(&missed_irq_timer, jiffies + sx_poll);
 }
 #endif
 
@@ -534,7 +521,7 @@ static int sx_probe(struct specialix_board *bp)
                sx_wait_CCR(bp);
                sx_out(bp, CD186x_CCR, CCR_TXEN);        /* Enable transmitter     */
                sx_out(bp, CD186x_IER, IER_TXRDY);       /* Enable tx empty intr   */
-               sx_long_delay(HZ/20);
+               msleep(50);
                irqs = probe_irq_off(irqs);
 
                dprintk (SX_DEBUG_INIT, "SRSR = %02x, ", sx_in(bp, CD186x_SRSR));
@@ -597,11 +584,8 @@ static int sx_probe(struct specialix_board *bp)
        dprintk (SX_DEBUG_INIT, " GFCR = 0x%02x\n", sx_in_off(bp, CD186x_GFRCR) );
 
 #ifdef SPECIALIX_TIMER
-       init_timer (&missed_irq_timer);
-       missed_irq_timer.function = missed_irq;
-       missed_irq_timer.data = (unsigned long) bp;
-       missed_irq_timer.expires = jiffies + sx_poll;
-       add_timer (&missed_irq_timer);
+       setup_timer(&missed_irq_timer, missed_irq, (unsigned long)bp);
+       mod_timer(&missed_irq_timer, jiffies + sx_poll);
 #endif
 
        printk(KERN_INFO"sx%d: specialix IO8+ board detected at 0x%03x, IRQ %d, CD%d Rev. %c.\n",
@@ -2311,7 +2295,7 @@ static void sx_hangup(struct tty_struct * tty)
 }
 
 
-static void sx_set_termios(struct tty_struct * tty, struct termios * old_termios)
+static void sx_set_termios(struct tty_struct * tty, struct ktermios * old_termios)
 {
        struct specialix_port *port = (struct specialix_port *)tty->driver_data;
        unsigned long flags;
@@ -2350,10 +2334,8 @@ static void do_softint(struct work_struct *work)
                return;
        }
 
-       if (test_and_clear_bit(RS_EVENT_WRITE_WAKEUP, &port->event)) {
+       if (test_and_clear_bit(RS_EVENT_WRITE_WAKEUP, &port->event))
                tty_wakeup(tty);
-               //wake_up_interruptible(&tty->write_wait);
-       }
 
        func_exit();
 }
@@ -2400,6 +2382,8 @@ static int sx_init_drivers(void)
        specialix_driver->init_termios = tty_std_termios;
        specialix_driver->init_termios.c_cflag =
                B9600 | CS8 | CREAD | HUPCL | CLOCAL;
+       specialix_driver->init_termios.c_ispeed = 9600;
+       specialix_driver->init_termios.c_ospeed = 9600;
        specialix_driver->flags = TTY_DRIVER_REAL_RAW;
        tty_set_operations(specialix_driver, &sx_ops);
 
@@ -2475,7 +2459,7 @@ static int __init specialix_init(void)
                                i++;
                                continue;
                        }
-                       pdev = pci_find_device (PCI_VENDOR_ID_SPECIALIX,
+                       pdev = pci_get_device (PCI_VENDOR_ID_SPECIALIX,
                                                PCI_DEVICE_ID_SPECIALIX_IO8,
                                                pdev);
                        if (!pdev) break;
@@ -2491,6 +2475,9 @@ static int __init specialix_init(void)
                        if (!sx_probe(&sx_board[i]))
                                found ++;
                }
+               /* May exit pci_get sequence early with lots of boards */
+               if (pdev != NULL)
+                       pci_dev_put(pdev);
        }
 #endif
 
@@ -2556,7 +2543,7 @@ static void __exit specialix_exit_module(void)
                if (sx_board[i].flags & SX_BOARD_PRESENT)
                        sx_release_io_range(&sx_board[i]);
 #ifdef SPECIALIX_TIMER
-       del_timer (&missed_irq_timer);
+       del_timer_sync(&missed_irq_timer);
 #endif
 
        func_exit();