Merge branch 'hwmon-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6
[pandora-kernel.git] / drivers / char / synclink.c
index 3fa625d..f02a079 100644 (file)
@@ -1148,10 +1148,8 @@ static void mgsl_bh_transmit(struct mgsl_struct *info)
                printk( "%s(%d):mgsl_bh_transmit() entry on %s\n",
                        __FILE__,__LINE__,info->device_name);
 
-       if (tty) {
+       if (tty)
                tty_wakeup(tty);
-               wake_up_interruptible(&tty->write_wait);
-       }
 
        /* if transmitter idle and loopmode_send_done_requested
         * then start echoing RxD to TxD
@@ -1800,9 +1798,7 @@ static int startup(struct mgsl_struct * info)
        
        memset(&info->icount, 0, sizeof(info->icount));
 
-       init_timer(&info->tx_timer);
-       info->tx_timer.data = (unsigned long)info;
-       info->tx_timer.function = mgsl_tx_timeout;
+       setup_timer(&info->tx_timer, mgsl_tx_timeout, (unsigned long)info);
        
        /* Allocate and claim adapter resources */
        retval = mgsl_claim_resources(info);
@@ -1853,7 +1849,7 @@ static void shutdown(struct mgsl_struct * info)
        wake_up_interruptible(&info->status_event_wait_q);
        wake_up_interruptible(&info->event_wait_q);
 
-       del_timer(&info->tx_timer);     
+       del_timer_sync(&info->tx_timer);
 
        if (info->xmit_buf) {
                free_page((unsigned long) info->xmit_buf);
@@ -2340,7 +2336,6 @@ static void mgsl_flush_buffer(struct tty_struct *tty)
        del_timer(&info->tx_timer);     
        spin_unlock_irqrestore(&info->irq_spinlock,flags);
        
-       wake_up_interruptible(&tty->write_wait);
        tty_wakeup(tty);
 }
 
@@ -4015,8 +4010,13 @@ static int mgsl_alloc_intermediate_txbuffer_memory(struct mgsl_struct *info)
        for ( i=0; i<info->num_tx_holding_buffers; ++i) {
                info->tx_holding_buffers[i].buffer =
                        kmalloc(info->max_frame_size, GFP_KERNEL);
-               if ( info->tx_holding_buffers[i].buffer == NULL )
+               if (info->tx_holding_buffers[i].buffer == NULL) {
+                       for (--i; i >= 0; i--) {
+                               kfree(info->tx_holding_buffers[i].buffer);
+                               info->tx_holding_buffers[i].buffer = NULL;
+                       }
                        return -ENOMEM;
+               }
        }
 
        return 0;
@@ -5713,8 +5713,8 @@ static void usc_start_transmitter( struct mgsl_struct *info )
                        
                        usc_TCmd( info, TCmd_SendFrame );
                        
-                       info->tx_timer.expires = jiffies + msecs_to_jiffies(5000);
-                       add_timer(&info->tx_timer);     
+                       mod_timer(&info->tx_timer, jiffies +
+                                       msecs_to_jiffies(5000));
                }
                info->tx_active = 1;
        }