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/libertas/main.c | |
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/libertas/main.c')
-rw-r--r-- | drivers/net/wireless/libertas/main.c | 36 |
1 files changed, 18 insertions, 18 deletions
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 | } |