Merge branch 'intx' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/misc-2.6
[pandora-kernel.git] / drivers / char / riscom8.c
index 214d850..0a77bfc 100644 (file)
 
 static struct riscom_board * IRQ_to_board[16];
 static struct tty_driver *riscom_driver;
-static unsigned char * tmp_buf;
-
-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] =  {
        {
@@ -551,7 +545,7 @@ 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, struct pt_regs * regs)
+static irqreturn_t rc_interrupt(int irq, void * dev_id)
 {
        unsigned char status;
        unsigned char ack;
@@ -560,11 +554,10 @@ static irqreturn_t rc_interrupt(int irq, void * dev_id, struct pt_regs * regs)
        int handled = 0;
 
        bp = IRQ_to_board[irq];
-       
-       if (!bp || !(bp->flags & RC_BOARD_ACTIVE))  {
+
+       if (!(bp->flags & RC_BOARD_ACTIVE))
                return IRQ_NONE;
-       }
-       
+
        while ((++loop < 16) && ((status = ~(rc_in(bp, RC_BSR))) &
                                 (RC_BSR_TOUT | RC_BSR_TINT |
                                  RC_BSR_MINT | RC_BSR_RINT))) {
@@ -1124,7 +1117,7 @@ static int rc_write(struct tty_struct * tty,
        
        bp = port_Board(port);
 
-       if (!tty || !port->xmit_buf || !tmp_buf)
+       if (!tty || !port->xmit_buf)
                return 0;
 
        save_flags(flags);
@@ -1518,9 +1511,9 @@ static void rc_start(struct tty_struct * tty)
  *     do_rc_hangup() -> tty->hangup() -> rc_hangup()
  * 
  */
-static void do_rc_hangup(void *private_)
+static void do_rc_hangup(struct work_struct *ugly_api)
 {
-       struct riscom_port      *port = (struct riscom_port *) private_;
+       struct riscom_port      *port = container_of(ugly_api, struct riscom_port, tqueue_hangup);
        struct tty_struct       *tty;
        
        tty = port->tty;
@@ -1569,9 +1562,9 @@ static void rc_set_termios(struct tty_struct * tty, struct termios * old_termios
        }
 }
 
-static void do_softint(void *private_)
+static void do_softint(struct work_struct *ugly_api)
 {
-       struct riscom_port      *port = (struct riscom_port *) private_;
+       struct riscom_port      *port = container_of(ugly_api, struct riscom_port, tqueue);
        struct tty_struct       *tty;
        
        if(!(tty = port->tty)) 
@@ -1612,11 +1605,6 @@ static inline int rc_init_drivers(void)
        if (!riscom_driver)     
                return -ENOMEM;
        
-       if (!(tmp_buf = (unsigned char *) get_zeroed_page(GFP_KERNEL))) {
-               printk(KERN_ERR "rc: Couldn't get free page.\n");
-               put_tty_driver(riscom_driver);
-               return 1;
-       }
        memset(IRQ_to_board, 0, sizeof(IRQ_to_board));
        riscom_driver->owner = THIS_MODULE;
        riscom_driver->name = "ttyL";
@@ -1629,7 +1617,6 @@ static inline int rc_init_drivers(void)
        riscom_driver->flags = TTY_DRIVER_REAL_RAW;
        tty_set_operations(riscom_driver, &riscom_ops);
        if ((error = tty_register_driver(riscom_driver)))  {
-               free_page((unsigned long)tmp_buf);
                put_tty_driver(riscom_driver);
                printk(KERN_ERR "rc: Couldn't register RISCom/8 driver, "
                                "error = %d\n",
@@ -1640,8 +1627,8 @@ static inline int rc_init_drivers(void)
        memset(rc_port, 0, sizeof(rc_port));
        for (i = 0; i < RC_NPORT * RC_NBOARD; i++)  {
                rc_port[i].magic = RISCOM8_MAGIC;
-               INIT_WORK(&rc_port[i].tqueue, do_softint, &rc_port[i]);
-               INIT_WORK(&rc_port[i].tqueue_hangup, do_rc_hangup, &rc_port[i]);
+               INIT_WORK(&rc_port[i].tqueue, do_softint);
+               INIT_WORK(&rc_port[i].tqueue_hangup, do_rc_hangup);
                rc_port[i].close_delay = 50 * HZ/100;
                rc_port[i].closing_wait = 3000 * HZ/100;
                init_waitqueue_head(&rc_port[i].open_wait);
@@ -1657,7 +1644,6 @@ static void rc_release_drivers(void)
 
        save_flags(flags);
        cli();
-       free_page((unsigned long)tmp_buf);
        tty_unregister_driver(riscom_driver);
        put_tty_driver(riscom_driver);
        restore_flags(flags);