aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/irda/stir4200.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2006-06-20 08:59:45 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2006-06-20 08:59:45 -0400
commitd59bf96cdde5b874a57bfd1425faa45da915d0b7 (patch)
tree351a40b72514d620e5bebea2de38c26f23277ffc /drivers/net/irda/stir4200.c
parent28df955a2ad484d602314b30183ea8496a9aa34a (diff)
parent25f42b6af09e34c3f92107b36b5aa6edc2fdba2f (diff)
Merge branch 'master' of /home/trondmy/kernel/linux-2.6/
Diffstat (limited to 'drivers/net/irda/stir4200.c')
-rw-r--r--drivers/net/irda/stir4200.c38
1 files changed, 14 insertions, 24 deletions
diff --git a/drivers/net/irda/stir4200.c b/drivers/net/irda/stir4200.c
index 31867e4b891b..d61b208b52a2 100644
--- a/drivers/net/irda/stir4200.c
+++ b/drivers/net/irda/stir4200.c
@@ -50,6 +50,7 @@
50#include <linux/delay.h> 50#include <linux/delay.h>
51#include <linux/usb.h> 51#include <linux/usb.h>
52#include <linux/crc32.h> 52#include <linux/crc32.h>
53#include <linux/kthread.h>
53#include <net/irda/irda.h> 54#include <net/irda/irda.h>
54#include <net/irda/irlap.h> 55#include <net/irda/irlap.h>
55#include <net/irda/irda_device.h> 56#include <net/irda/irda_device.h>
@@ -173,9 +174,7 @@ struct stir_cb {
173 struct qos_info qos; 174 struct qos_info qos;
174 unsigned speed; /* Current speed */ 175 unsigned speed; /* Current speed */
175 176
176 wait_queue_head_t thr_wait; /* transmit thread wakeup */ 177 struct task_struct *thread; /* transmit thread */
177 struct completion thr_exited;
178 pid_t thr_pid;
179 178
180 struct sk_buff *tx_pending; 179 struct sk_buff *tx_pending;
181 void *io_buf; /* transmit/receive buffer */ 180 void *io_buf; /* transmit/receive buffer */
@@ -577,7 +576,7 @@ static int stir_hard_xmit(struct sk_buff *skb, struct net_device *netdev)
577 SKB_LINEAR_ASSERT(skb); 576 SKB_LINEAR_ASSERT(skb);
578 577
579 skb = xchg(&stir->tx_pending, skb); 578 skb = xchg(&stir->tx_pending, skb);
580 wake_up(&stir->thr_wait); 579 wake_up_process(stir->thread);
581 580
582 /* this should never happen unless stop/wakeup problem */ 581 /* this should never happen unless stop/wakeup problem */
583 if (unlikely(skb)) { 582 if (unlikely(skb)) {
@@ -753,13 +752,7 @@ static int stir_transmit_thread(void *arg)
753 struct net_device *dev = stir->netdev; 752 struct net_device *dev = stir->netdev;
754 struct sk_buff *skb; 753 struct sk_buff *skb;
755 754
756 daemonize("%s", dev->name); 755 while (!kthread_should_stop()) {
757 allow_signal(SIGTERM);
758
759 while (netif_running(dev)
760 && netif_device_present(dev)
761 && !signal_pending(current))
762 {
763#ifdef CONFIG_PM 756#ifdef CONFIG_PM
764 /* if suspending, then power off and wait */ 757 /* if suspending, then power off and wait */
765 if (unlikely(freezing(current))) { 758 if (unlikely(freezing(current))) {
@@ -813,10 +806,11 @@ static int stir_transmit_thread(void *arg)
813 } 806 }
814 807
815 /* sleep if nothing to send */ 808 /* sleep if nothing to send */
816 wait_event_interruptible(stir->thr_wait, stir->tx_pending); 809 set_current_state(TASK_INTERRUPTIBLE);
817 } 810 schedule();
818 811
819 complete_and_exit (&stir->thr_exited, 0); 812 }
813 return 0;
820} 814}
821 815
822 816
@@ -859,7 +853,7 @@ static void stir_rcv_irq(struct urb *urb, struct pt_regs *regs)
859 warn("%s: usb receive submit error: %d", 853 warn("%s: usb receive submit error: %d",
860 stir->netdev->name, err); 854 stir->netdev->name, err);
861 stir->receiving = 0; 855 stir->receiving = 0;
862 wake_up(&stir->thr_wait); 856 wake_up_process(stir->thread);
863 } 857 }
864} 858}
865 859
@@ -928,10 +922,10 @@ static int stir_net_open(struct net_device *netdev)
928 } 922 }
929 923
930 /** Start kernel thread for transmit. */ 924 /** Start kernel thread for transmit. */
931 stir->thr_pid = kernel_thread(stir_transmit_thread, stir, 925 stir->thread = kthread_run(stir_transmit_thread, stir,
932 CLONE_FS|CLONE_FILES); 926 "%s", stir->netdev->name);
933 if (stir->thr_pid < 0) { 927 if (IS_ERR(stir->thread)) {
934 err = stir->thr_pid; 928 err = PTR_ERR(stir->thread);
935 err("stir4200: unable to start kernel thread"); 929 err("stir4200: unable to start kernel thread");
936 goto err_out6; 930 goto err_out6;
937 } 931 }
@@ -968,8 +962,7 @@ static int stir_net_close(struct net_device *netdev)
968 netif_stop_queue(netdev); 962 netif_stop_queue(netdev);
969 963
970 /* Kill transmit thread */ 964 /* Kill transmit thread */
971 kill_proc(stir->thr_pid, SIGTERM, 1); 965 kthread_stop(stir->thread);
972 wait_for_completion(&stir->thr_exited);
973 kfree(stir->fifo_status); 966 kfree(stir->fifo_status);
974 967
975 /* Mop up receive urb's */ 968 /* Mop up receive urb's */
@@ -1084,9 +1077,6 @@ static int stir_probe(struct usb_interface *intf,
1084 stir->qos.min_turn_time.bits &= qos_mtt_bits; 1077 stir->qos.min_turn_time.bits &= qos_mtt_bits;
1085 irda_qos_bits_to_value(&stir->qos); 1078 irda_qos_bits_to_value(&stir->qos);
1086 1079
1087 init_completion (&stir->thr_exited);
1088 init_waitqueue_head (&stir->thr_wait);
1089
1090 /* Override the network functions we need to use */ 1080 /* Override the network functions we need to use */
1091 net->hard_start_xmit = stir_hard_xmit; 1081 net->hard_start_xmit = stir_hard_xmit;
1092 net->open = stir_net_open; 1082 net->open = stir_net_open;