diff options
author | Dan Williams <dcbw@redhat.com> | 2007-08-02 11:32:25 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:49:44 -0400 |
commit | fe3361507af44d00d5b42b91c1626321765a11bc (patch) | |
tree | db61afba5378e70a387465f4425e29f766e644ed /drivers/net/wireless | |
parent | 2ca10e6d6a3052e7a8380b20588a7b1985ea1197 (diff) |
[PATCH] libertas: remove thread.h and make kthread usage clearer
Remove the thread.h abstractions and opencode kthread stuff
to make it clearer.
Signed-off-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/libertas/cmd.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/debugfs.c | 26 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/dev.h | 4 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/fw.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/if_usb.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/main.c | 36 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/thread.h | 52 |
7 files changed, 37 insertions, 89 deletions
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index e0eab6e3a9b0..401a630ed4e5 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c | |||
@@ -1134,7 +1134,7 @@ int libertas_prepare_and_send_command(wlan_private * priv, | |||
1134 | lbs_deb_cmd("PREP_CMD: No free cmdnode\n"); | 1134 | lbs_deb_cmd("PREP_CMD: No free cmdnode\n"); |
1135 | 1135 | ||
1136 | /* Wake up main thread to execute next command */ | 1136 | /* Wake up main thread to execute next command */ |
1137 | wake_up_interruptible(&priv->mainthread.waitq); | 1137 | wake_up_interruptible(&priv->waitq); |
1138 | ret = -1; | 1138 | ret = -1; |
1139 | goto done; | 1139 | goto done; |
1140 | } | 1140 | } |
@@ -1402,7 +1402,7 @@ int libertas_prepare_and_send_command(wlan_private * priv, | |||
1402 | 1402 | ||
1403 | libertas_queue_cmd(adapter, cmdnode, 1); | 1403 | libertas_queue_cmd(adapter, cmdnode, 1); |
1404 | adapter->nr_cmd_pending++; | 1404 | adapter->nr_cmd_pending++; |
1405 | wake_up_interruptible(&priv->mainthread.waitq); | 1405 | wake_up_interruptible(&priv->waitq); |
1406 | 1406 | ||
1407 | if (wait_option & CMD_OPTION_WAITFORRSP) { | 1407 | if (wait_option & CMD_OPTION_WAITFORRSP) { |
1408 | lbs_deb_cmd("PREP_CMD: Wait for CMD response\n"); | 1408 | lbs_deb_cmd("PREP_CMD: Wait for CMD response\n"); |
diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c index a206f49f810c..9439005db4e6 100644 --- a/drivers/net/wireless/libertas/debugfs.c +++ b/drivers/net/wireless/libertas/debugfs.c | |||
@@ -432,7 +432,7 @@ static ssize_t libertas_lowrssi_read(struct file *file, char __user *userbuf, | |||
432 | event->action = cpu_to_le16(CMD_ACT_GET); | 432 | event->action = cpu_to_le16(CMD_ACT_GET); |
433 | pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN); | 433 | pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN); |
434 | libertas_queue_cmd(adapter, pcmdnode, 1); | 434 | libertas_queue_cmd(adapter, pcmdnode, 1); |
435 | wake_up_interruptible(&priv->mainthread.waitq); | 435 | wake_up_interruptible(&priv->waitq); |
436 | 436 | ||
437 | /* Sleep until response is generated by FW */ | 437 | /* Sleep until response is generated by FW */ |
438 | wait_event_interruptible(pcmdnode->cmdwait_q, | 438 | wait_event_interruptible(pcmdnode->cmdwait_q, |
@@ -496,7 +496,7 @@ static u16 libertas_get_events_bitmap(wlan_private *priv) | |||
496 | event->action = cpu_to_le16(CMD_ACT_GET); | 496 | event->action = cpu_to_le16(CMD_ACT_GET); |
497 | pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN); | 497 | pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN); |
498 | libertas_queue_cmd(adapter, pcmdnode, 1); | 498 | libertas_queue_cmd(adapter, pcmdnode, 1); |
499 | wake_up_interruptible(&priv->mainthread.waitq); | 499 | wake_up_interruptible(&priv->waitq); |
500 | 500 | ||
501 | /* Sleep until response is generated by FW */ | 501 | /* Sleep until response is generated by FW */ |
502 | wait_event_interruptible(pcmdnode->cmdwait_q, | 502 | wait_event_interruptible(pcmdnode->cmdwait_q, |
@@ -575,7 +575,7 @@ static ssize_t libertas_lowrssi_write(struct file *file, | |||
575 | event->events = cpu_to_le16(event_bitmap); | 575 | event->events = cpu_to_le16(event_bitmap); |
576 | 576 | ||
577 | libertas_queue_cmd(adapter, pcmdnode, 1); | 577 | libertas_queue_cmd(adapter, pcmdnode, 1); |
578 | wake_up_interruptible(&priv->mainthread.waitq); | 578 | wake_up_interruptible(&priv->waitq); |
579 | 579 | ||
580 | /* Sleep until response is generated by FW */ | 580 | /* Sleep until response is generated by FW */ |
581 | wait_event_interruptible(pcmdnode->cmdwait_q, | 581 | wait_event_interruptible(pcmdnode->cmdwait_q, |
@@ -628,7 +628,7 @@ static ssize_t libertas_lowsnr_read(struct file *file, char __user *userbuf, | |||
628 | event->action = cpu_to_le16(CMD_ACT_GET); | 628 | event->action = cpu_to_le16(CMD_ACT_GET); |
629 | pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN); | 629 | pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN); |
630 | libertas_queue_cmd(adapter, pcmdnode, 1); | 630 | libertas_queue_cmd(adapter, pcmdnode, 1); |
631 | wake_up_interruptible(&priv->mainthread.waitq); | 631 | wake_up_interruptible(&priv->waitq); |
632 | 632 | ||
633 | /* Sleep until response is generated by FW */ | 633 | /* Sleep until response is generated by FW */ |
634 | wait_event_interruptible(pcmdnode->cmdwait_q, | 634 | wait_event_interruptible(pcmdnode->cmdwait_q, |
@@ -727,7 +727,7 @@ static ssize_t libertas_lowsnr_write(struct file *file, | |||
727 | event->events = cpu_to_le16(event_bitmap); | 727 | event->events = cpu_to_le16(event_bitmap); |
728 | 728 | ||
729 | libertas_queue_cmd(adapter, pcmdnode, 1); | 729 | libertas_queue_cmd(adapter, pcmdnode, 1); |
730 | wake_up_interruptible(&priv->mainthread.waitq); | 730 | wake_up_interruptible(&priv->waitq); |
731 | 731 | ||
732 | /* Sleep until response is generated by FW */ | 732 | /* Sleep until response is generated by FW */ |
733 | wait_event_interruptible(pcmdnode->cmdwait_q, | 733 | wait_event_interruptible(pcmdnode->cmdwait_q, |
@@ -781,7 +781,7 @@ static ssize_t libertas_failcount_read(struct file *file, char __user *userbuf, | |||
781 | event->action = cpu_to_le16(CMD_ACT_GET); | 781 | event->action = cpu_to_le16(CMD_ACT_GET); |
782 | pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN); | 782 | pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN); |
783 | libertas_queue_cmd(adapter, pcmdnode, 1); | 783 | libertas_queue_cmd(adapter, pcmdnode, 1); |
784 | wake_up_interruptible(&priv->mainthread.waitq); | 784 | wake_up_interruptible(&priv->waitq); |
785 | 785 | ||
786 | /* Sleep until response is generated by FW */ | 786 | /* Sleep until response is generated by FW */ |
787 | wait_event_interruptible(pcmdnode->cmdwait_q, | 787 | wait_event_interruptible(pcmdnode->cmdwait_q, |
@@ -879,7 +879,7 @@ static ssize_t libertas_failcount_write(struct file *file, | |||
879 | event->events = cpu_to_le16(event_bitmap); | 879 | event->events = cpu_to_le16(event_bitmap); |
880 | 880 | ||
881 | libertas_queue_cmd(adapter, pcmdnode, 1); | 881 | libertas_queue_cmd(adapter, pcmdnode, 1); |
882 | wake_up_interruptible(&priv->mainthread.waitq); | 882 | wake_up_interruptible(&priv->waitq); |
883 | 883 | ||
884 | /* Sleep until response is generated by FW */ | 884 | /* Sleep until response is generated by FW */ |
885 | wait_event_interruptible(pcmdnode->cmdwait_q, | 885 | wait_event_interruptible(pcmdnode->cmdwait_q, |
@@ -932,7 +932,7 @@ static ssize_t libertas_bcnmiss_read(struct file *file, char __user *userbuf, | |||
932 | event->action = cpu_to_le16(CMD_ACT_GET); | 932 | event->action = cpu_to_le16(CMD_ACT_GET); |
933 | pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN); | 933 | pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN); |
934 | libertas_queue_cmd(adapter, pcmdnode, 1); | 934 | libertas_queue_cmd(adapter, pcmdnode, 1); |
935 | wake_up_interruptible(&priv->mainthread.waitq); | 935 | wake_up_interruptible(&priv->waitq); |
936 | 936 | ||
937 | /* Sleep until response is generated by FW */ | 937 | /* Sleep until response is generated by FW */ |
938 | wait_event_interruptible(pcmdnode->cmdwait_q, | 938 | wait_event_interruptible(pcmdnode->cmdwait_q, |
@@ -1029,7 +1029,7 @@ static ssize_t libertas_bcnmiss_write(struct file *file, | |||
1029 | event->events = cpu_to_le16(event_bitmap); | 1029 | event->events = cpu_to_le16(event_bitmap); |
1030 | 1030 | ||
1031 | libertas_queue_cmd(adapter, pcmdnode, 1); | 1031 | libertas_queue_cmd(adapter, pcmdnode, 1); |
1032 | wake_up_interruptible(&priv->mainthread.waitq); | 1032 | wake_up_interruptible(&priv->waitq); |
1033 | 1033 | ||
1034 | /* Sleep until response is generated by FW */ | 1034 | /* Sleep until response is generated by FW */ |
1035 | wait_event_interruptible(pcmdnode->cmdwait_q, | 1035 | wait_event_interruptible(pcmdnode->cmdwait_q, |
@@ -1082,7 +1082,7 @@ static ssize_t libertas_highrssi_read(struct file *file, char __user *userbuf, | |||
1082 | event->action = cpu_to_le16(CMD_ACT_GET); | 1082 | event->action = cpu_to_le16(CMD_ACT_GET); |
1083 | pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN); | 1083 | pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN); |
1084 | libertas_queue_cmd(adapter, pcmdnode, 1); | 1084 | libertas_queue_cmd(adapter, pcmdnode, 1); |
1085 | wake_up_interruptible(&priv->mainthread.waitq); | 1085 | wake_up_interruptible(&priv->waitq); |
1086 | 1086 | ||
1087 | /* Sleep until response is generated by FW */ | 1087 | /* Sleep until response is generated by FW */ |
1088 | wait_event_interruptible(pcmdnode->cmdwait_q, | 1088 | wait_event_interruptible(pcmdnode->cmdwait_q, |
@@ -1181,7 +1181,7 @@ static ssize_t libertas_highrssi_write(struct file *file, | |||
1181 | event->events = cpu_to_le16(event_bitmap); | 1181 | event->events = cpu_to_le16(event_bitmap); |
1182 | 1182 | ||
1183 | libertas_queue_cmd(adapter, pcmdnode, 1); | 1183 | libertas_queue_cmd(adapter, pcmdnode, 1); |
1184 | wake_up_interruptible(&priv->mainthread.waitq); | 1184 | wake_up_interruptible(&priv->waitq); |
1185 | 1185 | ||
1186 | /* Sleep until response is generated by FW */ | 1186 | /* Sleep until response is generated by FW */ |
1187 | wait_event_interruptible(pcmdnode->cmdwait_q, | 1187 | wait_event_interruptible(pcmdnode->cmdwait_q, |
@@ -1232,7 +1232,7 @@ static ssize_t libertas_highsnr_read(struct file *file, char __user *userbuf, | |||
1232 | event->action = cpu_to_le16(CMD_ACT_GET); | 1232 | event->action = cpu_to_le16(CMD_ACT_GET); |
1233 | pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN); | 1233 | pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN); |
1234 | libertas_queue_cmd(adapter, pcmdnode, 1); | 1234 | libertas_queue_cmd(adapter, pcmdnode, 1); |
1235 | wake_up_interruptible(&priv->mainthread.waitq); | 1235 | wake_up_interruptible(&priv->waitq); |
1236 | 1236 | ||
1237 | /* Sleep until response is generated by FW */ | 1237 | /* Sleep until response is generated by FW */ |
1238 | wait_event_interruptible(pcmdnode->cmdwait_q, | 1238 | wait_event_interruptible(pcmdnode->cmdwait_q, |
@@ -1331,7 +1331,7 @@ static ssize_t libertas_highsnr_write(struct file *file, | |||
1331 | event->events = cpu_to_le16(event_bitmap); | 1331 | event->events = cpu_to_le16(event_bitmap); |
1332 | 1332 | ||
1333 | libertas_queue_cmd(adapter, pcmdnode, 1); | 1333 | libertas_queue_cmd(adapter, pcmdnode, 1); |
1334 | wake_up_interruptible(&priv->mainthread.waitq); | 1334 | wake_up_interruptible(&priv->waitq); |
1335 | 1335 | ||
1336 | /* Sleep until response is generated by FW */ | 1336 | /* Sleep until response is generated by FW */ |
1337 | wait_event_interruptible(pcmdnode->cmdwait_q, | 1337 | wait_event_interruptible(pcmdnode->cmdwait_q, |
diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h index 184eee548572..c6fb703f665b 100644 --- a/drivers/net/wireless/libertas/dev.h +++ b/drivers/net/wireless/libertas/dev.h | |||
@@ -14,7 +14,6 @@ | |||
14 | 14 | ||
15 | #include "defs.h" | 15 | #include "defs.h" |
16 | #include "scan.h" | 16 | #include "scan.h" |
17 | #include "thread.h" | ||
18 | 17 | ||
19 | extern struct ethtool_ops libertas_ethtool_ops; | 18 | extern struct ethtool_ops libertas_ethtool_ops; |
20 | 19 | ||
@@ -146,7 +145,8 @@ struct _wlan_private { | |||
146 | struct device *hotplug_device; | 145 | struct device *hotplug_device; |
147 | 146 | ||
148 | /** thread to service interrupts */ | 147 | /** thread to service interrupts */ |
149 | struct wlan_thread mainthread; | 148 | struct task_struct *main_thread; |
149 | wait_queue_head_t waitq; | ||
150 | 150 | ||
151 | struct delayed_work assoc_work; | 151 | struct delayed_work assoc_work; |
152 | struct workqueue_struct *assoc_thread; | 152 | struct workqueue_struct *assoc_thread; |
diff --git a/drivers/net/wireless/libertas/fw.c b/drivers/net/wireless/libertas/fw.c index 39b0a094b626..e7177598f94b 100644 --- a/drivers/net/wireless/libertas/fw.c +++ b/drivers/net/wireless/libertas/fw.c | |||
@@ -341,7 +341,7 @@ static void command_timer_fn(unsigned long data) | |||
341 | lbs_deb_fw("re-sending same command because of timeout\n"); | 341 | lbs_deb_fw("re-sending same command because of timeout\n"); |
342 | libertas_queue_cmd(adapter, ptempnode, 0); | 342 | libertas_queue_cmd(adapter, ptempnode, 0); |
343 | 343 | ||
344 | wake_up_interruptible(&priv->mainthread.waitq); | 344 | wake_up_interruptible(&priv->waitq); |
345 | 345 | ||
346 | return; | 346 | return; |
347 | } | 347 | } |
diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index cf522c6ef57a..a3334f63a80d 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c | |||
@@ -77,7 +77,7 @@ static void if_usb_write_bulk_callback(struct urb *urb) | |||
77 | priv->dnld_sent = DNLD_RES_RECEIVED; | 77 | priv->dnld_sent = DNLD_RES_RECEIVED; |
78 | /* Wake main thread if commands are pending */ | 78 | /* Wake main thread if commands are pending */ |
79 | if (!adapter->cur_cmd) | 79 | if (!adapter->cur_cmd) |
80 | wake_up_interruptible(&priv->mainthread.waitq); | 80 | wake_up_interruptible(&priv->waitq); |
81 | if ((adapter->connect_status == LIBERTAS_CONNECTED)) { | 81 | if ((adapter->connect_status == LIBERTAS_CONNECTED)) { |
82 | netif_wake_queue(dev); | 82 | netif_wake_queue(dev); |
83 | netif_wake_queue(priv->mesh_dev); | 83 | netif_wake_queue(priv->mesh_dev); |
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 2315eb61836e..e24875de8dc8 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/etherdevice.h> | 10 | #include <linux/etherdevice.h> |
11 | #include <linux/netdevice.h> | 11 | #include <linux/netdevice.h> |
12 | #include <linux/if_arp.h> | 12 | #include <linux/if_arp.h> |
13 | #include <linux/kthread.h> | ||
13 | 14 | ||
14 | #include <net/iw_handler.h> | 15 | #include <net/iw_handler.h> |
15 | #include <net/ieee80211.h> | 16 | #include <net/ieee80211.h> |
@@ -438,7 +439,7 @@ static void wlan_tx_timeout(struct net_device *dev) | |||
438 | priv->adapter->eventcause = 0x01000000; | 439 | priv->adapter->eventcause = 0x01000000; |
439 | libertas_send_tx_feedback(priv); | 440 | libertas_send_tx_feedback(priv); |
440 | } else | 441 | } else |
441 | wake_up_interruptible(&priv->mainthread.waitq); | 442 | wake_up_interruptible(&priv->waitq); |
442 | } else if (priv->adapter->connect_status == LIBERTAS_CONNECTED) { | 443 | } else if (priv->adapter->connect_status == LIBERTAS_CONNECTED) { |
443 | netif_wake_queue(priv->dev); | 444 | netif_wake_queue(priv->dev); |
444 | netif_wake_queue(priv->mesh_dev); | 445 | netif_wake_queue(priv->mesh_dev); |
@@ -599,28 +600,25 @@ static void wlan_set_multicast_list(struct net_device *dev) | |||
599 | * @param data A pointer to wlan_thread structure | 600 | * @param data A pointer to wlan_thread structure |
600 | * @return 0 | 601 | * @return 0 |
601 | */ | 602 | */ |
602 | static int wlan_service_main_thread(void *data) | 603 | static int libertas_thread(void *data) |
603 | { | 604 | { |
604 | struct wlan_thread *thread = data; | 605 | struct net_device *dev = data; |
605 | wlan_private *priv = thread->priv; | 606 | wlan_private *priv = dev->priv; |
606 | wlan_adapter *adapter = priv->adapter; | 607 | wlan_adapter *adapter = priv->adapter; |
607 | wait_queue_t wait; | 608 | wait_queue_t wait; |
608 | u8 ireg = 0; | 609 | u8 ireg = 0; |
609 | 610 | ||
610 | lbs_deb_enter(LBS_DEB_THREAD); | 611 | lbs_deb_enter(LBS_DEB_THREAD); |
611 | 612 | ||
612 | wlan_activate_thread(thread); | ||
613 | |||
614 | init_waitqueue_entry(&wait, current); | 613 | init_waitqueue_entry(&wait, current); |
615 | 614 | ||
616 | set_freezable(); | ||
617 | for (;;) { | 615 | for (;;) { |
618 | lbs_deb_thread( "main-thread 111: intcounter=%d " | 616 | lbs_deb_thread( "main-thread 111: intcounter=%d " |
619 | "currenttxskb=%p dnld_sent=%d\n", | 617 | "currenttxskb=%p dnld_sent=%d\n", |
620 | adapter->intcounter, | 618 | adapter->intcounter, |
621 | adapter->currenttxskb, priv->dnld_sent); | 619 | adapter->currenttxskb, priv->dnld_sent); |
622 | 620 | ||
623 | add_wait_queue(&thread->waitq, &wait); | 621 | add_wait_queue(&priv->waitq, &wait); |
624 | set_current_state(TASK_INTERRUPTIBLE); | 622 | set_current_state(TASK_INTERRUPTIBLE); |
625 | spin_lock_irq(&adapter->driver_lock); | 623 | spin_lock_irq(&adapter->driver_lock); |
626 | if ((adapter->psstate == PS_STATE_SLEEP) || | 624 | if ((adapter->psstate == PS_STATE_SLEEP) || |
@@ -643,7 +641,7 @@ static int wlan_service_main_thread(void *data) | |||
643 | adapter->currenttxskb, priv->dnld_sent); | 641 | adapter->currenttxskb, priv->dnld_sent); |
644 | 642 | ||
645 | set_current_state(TASK_RUNNING); | 643 | set_current_state(TASK_RUNNING); |
646 | remove_wait_queue(&thread->waitq, &wait); | 644 | remove_wait_queue(&priv->waitq, &wait); |
647 | try_to_freeze(); | 645 | try_to_freeze(); |
648 | 646 | ||
649 | lbs_deb_thread("main-thread 333: intcounter=%d currenttxskb=%p " | 647 | lbs_deb_thread("main-thread 333: intcounter=%d currenttxskb=%p " |
@@ -758,7 +756,6 @@ static int wlan_service_main_thread(void *data) | |||
758 | del_timer(&adapter->command_timer); | 756 | del_timer(&adapter->command_timer); |
759 | adapter->nr_cmd_pending = 0; | 757 | adapter->nr_cmd_pending = 0; |
760 | wake_up_all(&adapter->cmd_pending); | 758 | wake_up_all(&adapter->cmd_pending); |
761 | wlan_deactivate_thread(thread); | ||
762 | 759 | ||
763 | lbs_deb_leave(LBS_DEB_THREAD); | 760 | lbs_deb_leave(LBS_DEB_THREAD); |
764 | return 0; | 761 | return 0; |
@@ -841,10 +838,13 @@ int libertas_activate_card(wlan_private *priv, char *fw_name) | |||
841 | 838 | ||
842 | lbs_deb_enter(LBS_DEB_MAIN); | 839 | lbs_deb_enter(LBS_DEB_MAIN); |
843 | 840 | ||
844 | lbs_deb_thread("Starting kthread...\n"); | 841 | lbs_deb_thread("Starting main thread...\n"); |
845 | priv->mainthread.priv = priv; | 842 | init_waitqueue_head(&priv->waitq); |
846 | wlan_create_thread(wlan_service_main_thread, | 843 | priv->main_thread = kthread_run(libertas_thread, dev, "libertas_main"); |
847 | &priv->mainthread, "wlan_main_service"); | 844 | if (IS_ERR(priv->main_thread)) { |
845 | lbs_deb_thread("Error creating main thread.\n"); | ||
846 | goto done; | ||
847 | } | ||
848 | 848 | ||
849 | priv->assoc_thread = | 849 | priv->assoc_thread = |
850 | create_singlethread_workqueue("libertas_assoc"); | 850 | create_singlethread_workqueue("libertas_assoc"); |
@@ -884,8 +884,8 @@ err_init_fw: | |||
884 | err_registerdev: | 884 | err_registerdev: |
885 | destroy_workqueue(priv->assoc_thread); | 885 | destroy_workqueue(priv->assoc_thread); |
886 | /* Stop the thread servicing the interrupts */ | 886 | /* Stop the thread servicing the interrupts */ |
887 | wake_up_interruptible(&priv->mainthread.waitq); | 887 | wake_up_interruptible(&priv->waitq); |
888 | wlan_terminate_thread(&priv->mainthread); | 888 | kthread_stop(priv->main_thread); |
889 | done: | 889 | done: |
890 | lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret); | 890 | lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret); |
891 | return ret; | 891 | return ret; |
@@ -1017,7 +1017,7 @@ int libertas_remove_card(wlan_private *priv) | |||
1017 | adapter->surpriseremoved = 1; | 1017 | adapter->surpriseremoved = 1; |
1018 | 1018 | ||
1019 | /* Stop the thread servicing the interrupts */ | 1019 | /* Stop the thread servicing the interrupts */ |
1020 | wlan_terminate_thread(&priv->mainthread); | 1020 | kthread_stop(priv->main_thread); |
1021 | 1021 | ||
1022 | libertas_debugfs_remove_one(priv); | 1022 | libertas_debugfs_remove_one(priv); |
1023 | 1023 | ||
@@ -1151,7 +1151,7 @@ void libertas_interrupt(struct net_device *dev) | |||
1151 | netif_wake_queue(priv->mesh_dev); | 1151 | netif_wake_queue(priv->mesh_dev); |
1152 | } | 1152 | } |
1153 | 1153 | ||
1154 | wake_up_interruptible(&priv->mainthread.waitq); | 1154 | wake_up_interruptible(&priv->waitq); |
1155 | 1155 | ||
1156 | lbs_deb_leave(LBS_DEB_THREAD); | 1156 | lbs_deb_leave(LBS_DEB_THREAD); |
1157 | } | 1157 | } |
diff --git a/drivers/net/wireless/libertas/thread.h b/drivers/net/wireless/libertas/thread.h deleted file mode 100644 index b1f34d92ff3e..000000000000 --- a/drivers/net/wireless/libertas/thread.h +++ /dev/null | |||
@@ -1,52 +0,0 @@ | |||
1 | #ifndef __WLAN_THREAD_H_ | ||
2 | #define __WLAN_THREAD_H_ | ||
3 | |||
4 | #include <linux/kthread.h> | ||
5 | |||
6 | struct wlan_thread { | ||
7 | struct task_struct *task; | ||
8 | wait_queue_head_t waitq; | ||
9 | pid_t pid; | ||
10 | void *priv; | ||
11 | }; | ||
12 | |||
13 | static inline void wlan_activate_thread(struct wlan_thread * thr) | ||
14 | { | ||
15 | /** Record the thread pid */ | ||
16 | thr->pid = current->pid; | ||
17 | |||
18 | /** Initialize the wait queue */ | ||
19 | init_waitqueue_head(&thr->waitq); | ||
20 | } | ||
21 | |||
22 | static inline void wlan_deactivate_thread(struct wlan_thread * thr) | ||
23 | { | ||
24 | lbs_deb_enter(LBS_DEB_THREAD); | ||
25 | |||
26 | thr->pid = 0; | ||
27 | |||
28 | lbs_deb_leave(LBS_DEB_THREAD); | ||
29 | } | ||
30 | |||
31 | static inline void wlan_create_thread(int (*wlanfunc) (void *), | ||
32 | struct wlan_thread * thr, char *name) | ||
33 | { | ||
34 | thr->task = kthread_run(wlanfunc, thr, "%s", name); | ||
35 | } | ||
36 | |||
37 | static inline int wlan_terminate_thread(struct wlan_thread * thr) | ||
38 | { | ||
39 | lbs_deb_enter(LBS_DEB_THREAD); | ||
40 | |||
41 | /* Check if the thread is active or not */ | ||
42 | if (!thr->pid) { | ||
43 | printk(KERN_ERR "Thread does not exist\n"); | ||
44 | return -1; | ||
45 | } | ||
46 | kthread_stop(thr->task); | ||
47 | |||
48 | lbs_deb_leave(LBS_DEB_THREAD); | ||
49 | return 0; | ||
50 | } | ||
51 | |||
52 | #endif | ||