[SPARC64]: Fix build with CONFIG_NET disabled.
[safe/jmp/linux-2.6] / drivers / char / riscom8.c
index 722dd3e..102ece4 100644 (file)
 
 #define RS_EVENT_WRITE_WAKEUP  0
 
-static struct riscom_board * IRQ_to_board[16];
 static struct tty_driver *riscom_driver;
 
-static unsigned long baud_table[] =  {
-       0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800,
-       9600, 19200, 38400, 57600, 76800, 0, 
-};
-
 static struct riscom_board rc_board[RC_NBOARD] =  {
        {
                .base   = RC_IOBASE1,
@@ -218,14 +212,6 @@ static inline void rc_release_io_range(struct riscom_board * const bp)
                release_region(RC_TO_ISA(rc_ioport[i]) + bp->base, 1);
 }
        
-/* Must be called with enabled interrupts */
-static inline void rc_long_delay(unsigned long delay)
-{
-       unsigned long i;
-       
-       for (i = jiffies + delay; time_after(i,jiffies); ) ;
-}
-
 /* Reset and setup CD180 chip */
 static void __init rc_init_CD180(struct riscom_board const * bp)
 {
@@ -236,7 +222,7 @@ static void __init rc_init_CD180(struct riscom_board const * bp)
        rc_wait_CCR(bp);                           /* Wait for CCR ready        */
        rc_out(bp, CD180_CCR, CCR_HARDRESET);      /* Reset CD180 chip          */
        sti();
-       rc_long_delay(HZ/20);                      /* Delay 0.05 sec            */
+       msleep(50);                                /* Delay 0.05 sec            */
        cli();
        rc_out(bp, CD180_GIVR, RC_ID);             /* Set ID for this chip      */
        rc_out(bp, CD180_GICR, 0);                 /* Clear all bits            */
@@ -285,7 +271,7 @@ static int __init rc_probe(struct riscom_board *bp)
                rc_wait_CCR(bp);
                rc_out(bp, CD180_CCR, CCR_TXEN);        /* Enable transmitter     */
                rc_out(bp, CD180_IER, IER_TXRDY);       /* Enable tx empty intr   */
-               rc_long_delay(HZ/20);                   
+               msleep(50);
                irqs = probe_irq_off(irqs);
                val1 = rc_in(bp, RC_BSR);               /* Get Board Status reg   */
                val2 = rc_in(bp, RC_ACK_TINT);          /* ACK interrupt          */
@@ -550,16 +536,14 @@ static inline void rc_check_modem(struct riscom_board const * bp)
 }
 
 /* The main interrupt processing routine */
-static irqreturn_t rc_interrupt(int irq, void * dev_id)
+static irqreturn_t rc_interrupt(int dummy, void * dev_id)
 {
        unsigned char status;
        unsigned char ack;
-       struct riscom_board *bp;
+       struct riscom_board *bp = dev_id;
        unsigned long loop = 0;
        int handled = 0;
 
-       bp = IRQ_to_board[irq];
-
        if (!(bp->flags & RC_BOARD_ACTIVE))
                return IRQ_NONE;
 
@@ -616,7 +600,7 @@ static irqreturn_t rc_interrupt(int irq, void * dev_id)
  */
 
 /* Called with disabled interrupts */
-static inline int rc_setup_board(struct riscom_board * bp)
+static int rc_setup_board(struct riscom_board * bp)
 {
        int error;
 
@@ -624,7 +608,7 @@ static inline int rc_setup_board(struct riscom_board * bp)
                return 0;
        
        error = request_irq(bp->irq, rc_interrupt, IRQF_DISABLED,
-                           "RISCom/8", NULL);
+                           "RISCom/8", bp);
        if (error) 
                return error;
        
@@ -632,14 +616,13 @@ static inline int rc_setup_board(struct riscom_board * bp)
        bp->DTR = ~0;
        rc_out(bp, RC_DTR, bp->DTR);            /* Drop DTR on all ports */
        
-       IRQ_to_board[bp->irq] = bp;
        bp->flags |= RC_BOARD_ACTIVE;
        
        return 0;
 }
 
 /* Called with disabled interrupts */
-static inline void rc_shutdown_board(struct riscom_board *bp)
+static void rc_shutdown_board(struct riscom_board *bp)
 {
        if (!(bp->flags & RC_BOARD_ACTIVE))
                return;
@@ -647,7 +630,6 @@ static inline void rc_shutdown_board(struct riscom_board *bp)
        bp->flags &= ~RC_BOARD_ACTIVE;
        
        free_irq(bp->irq, NULL);
-       IRQ_to_board[bp->irq] = NULL;
        
        bp->DTR = ~0;
        rc_out(bp, RC_DTR, bp->DTR);           /* Drop DTR on all ports */
@@ -985,7 +967,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
                }
                schedule();
        }
-       current->state = TASK_RUNNING;
+       __set_current_state(TASK_RUNNING);
        remove_wait_queue(&port->open_wait, &wait);
        if (!tty_hung_up_p(filp))
                port->count++;
@@ -1234,7 +1216,6 @@ static void rc_flush_buffer(struct tty_struct *tty)
        port->xmit_cnt = port->xmit_head = port->xmit_tail = 0;
        restore_flags(flags);
        
-       wake_up_interruptible(&tty->write_wait);
        tty_wakeup(tty);
 }
 
@@ -1544,7 +1525,7 @@ static void rc_hangup(struct tty_struct * tty)
        wake_up_interruptible(&port->open_wait);
 }
 
-static void rc_set_termios(struct tty_struct * tty, struct termios * old_termios)
+static void rc_set_termios(struct tty_struct * tty, struct ktermios * old_termios)
 {
        struct riscom_port *port = (struct riscom_port *)tty->driver_data;
        unsigned long flags;
@@ -1575,10 +1556,8 @@ static void do_softint(struct work_struct *ugly_api)
        if(!(tty = port->tty)) 
                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);
-       }
 }
 
 static const struct tty_operations riscom_ops = {
@@ -1610,7 +1589,6 @@ static inline int rc_init_drivers(void)
        if (!riscom_driver)     
                return -ENOMEM;
        
-       memset(IRQ_to_board, 0, sizeof(IRQ_to_board));
        riscom_driver->owner = THIS_MODULE;
        riscom_driver->name = "ttyL";
        riscom_driver->major = RISCOM8_NORMAL_MAJOR;
@@ -1619,6 +1597,8 @@ static inline int rc_init_drivers(void)
        riscom_driver->init_termios = tty_std_termios;
        riscom_driver->init_termios.c_cflag =
                B9600 | CS8 | CREAD | HUPCL | CLOCAL;
+       riscom_driver->init_termios.c_ispeed = 9600;
+       riscom_driver->init_termios.c_ospeed = 9600;
        riscom_driver->flags = TTY_DRIVER_REAL_RAW;
        tty_set_operations(riscom_driver, &riscom_ops);
        if ((error = tty_register_driver(riscom_driver)))  {