ieee1394_core: switch to kthread API
This gets also rid of the MODPOST warning "drivers/ieee1394/ieee1394.o - Section mismatch: reference to .exit.text: from .smp_locks after '' (at offset 0x18)". Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jody McIntyre <scjody@modernduck.com> Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Ben Collins <bcollins@ubuntu.com>
This commit is contained in:
parent
dd082c6705
commit
f654240f33
@ -33,6 +33,7 @@
|
|||||||
#include <linux/kdev_t.h>
|
#include <linux/kdev_t.h>
|
||||||
#include <linux/skbuff.h>
|
#include <linux/skbuff.h>
|
||||||
#include <linux/suspend.h>
|
#include <linux/suspend.h>
|
||||||
|
#include <linux/kthread.h>
|
||||||
|
|
||||||
#include <asm/byteorder.h>
|
#include <asm/byteorder.h>
|
||||||
#include <asm/semaphore.h>
|
#include <asm/semaphore.h>
|
||||||
@ -1001,11 +1002,8 @@ void abort_timedouts(unsigned long __opaque)
|
|||||||
* packets that have a "complete" function are sent here. This way, the
|
* packets that have a "complete" function are sent here. This way, the
|
||||||
* completion is run out of kernel context, and doesn't block the rest of
|
* completion is run out of kernel context, and doesn't block the rest of
|
||||||
* the stack. */
|
* the stack. */
|
||||||
static int khpsbpkt_pid = -1, khpsbpkt_kill;
|
static struct task_struct *khpsbpkt_thread;
|
||||||
static DECLARE_COMPLETION(khpsbpkt_complete);
|
|
||||||
static struct sk_buff_head hpsbpkt_queue;
|
static struct sk_buff_head hpsbpkt_queue;
|
||||||
static DECLARE_MUTEX_LOCKED(khpsbpkt_sig);
|
|
||||||
|
|
||||||
|
|
||||||
static void queue_packet_complete(struct hpsb_packet *packet)
|
static void queue_packet_complete(struct hpsb_packet *packet)
|
||||||
{
|
{
|
||||||
@ -1015,9 +1013,7 @@ static void queue_packet_complete(struct hpsb_packet *packet)
|
|||||||
}
|
}
|
||||||
if (packet->complete_routine != NULL) {
|
if (packet->complete_routine != NULL) {
|
||||||
skb_queue_tail(&hpsbpkt_queue, packet->skb);
|
skb_queue_tail(&hpsbpkt_queue, packet->skb);
|
||||||
|
wake_up_process(khpsbpkt_thread);
|
||||||
/* Signal the kernel thread to handle this */
|
|
||||||
up(&khpsbpkt_sig);
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1029,19 +1025,9 @@ static int hpsbpkt_thread(void *__hi)
|
|||||||
void (*complete_routine)(void*);
|
void (*complete_routine)(void*);
|
||||||
void *complete_data;
|
void *complete_data;
|
||||||
|
|
||||||
daemonize("khpsbpkt");
|
|
||||||
|
|
||||||
current->flags |= PF_NOFREEZE;
|
current->flags |= PF_NOFREEZE;
|
||||||
|
|
||||||
while (1) {
|
while (!kthread_should_stop()) {
|
||||||
if (down_interruptible(&khpsbpkt_sig)) {
|
|
||||||
printk("khpsbpkt: received unexpected signal?!\n" );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (khpsbpkt_kill)
|
|
||||||
break;
|
|
||||||
|
|
||||||
while ((skb = skb_dequeue(&hpsbpkt_queue)) != NULL) {
|
while ((skb = skb_dequeue(&hpsbpkt_queue)) != NULL) {
|
||||||
packet = (struct hpsb_packet *)skb->data;
|
packet = (struct hpsb_packet *)skb->data;
|
||||||
|
|
||||||
@ -1052,9 +1038,13 @@ static int hpsbpkt_thread(void *__hi)
|
|||||||
|
|
||||||
complete_routine(complete_data);
|
complete_routine(complete_data);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
complete_and_exit(&khpsbpkt_complete, 0);
|
set_current_state(TASK_INTERRUPTIBLE);
|
||||||
|
if (!skb_peek(&hpsbpkt_queue))
|
||||||
|
schedule();
|
||||||
|
__set_current_state(TASK_RUNNING);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __init ieee1394_init(void)
|
static int __init ieee1394_init(void)
|
||||||
@ -1069,10 +1059,10 @@ static int __init ieee1394_init(void)
|
|||||||
HPSB_ERR("Some features may not be available\n");
|
HPSB_ERR("Some features may not be available\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
khpsbpkt_pid = kernel_thread(hpsbpkt_thread, NULL, CLONE_KERNEL);
|
khpsbpkt_thread = kthread_run(hpsbpkt_thread, NULL, "khpsbpkt");
|
||||||
if (khpsbpkt_pid < 0) {
|
if (IS_ERR(khpsbpkt_thread)) {
|
||||||
HPSB_ERR("Failed to start hpsbpkt thread!\n");
|
HPSB_ERR("Failed to start hpsbpkt thread!\n");
|
||||||
ret = -ENOMEM;
|
ret = PTR_ERR(khpsbpkt_thread);
|
||||||
goto exit_cleanup_config_roms;
|
goto exit_cleanup_config_roms;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1152,10 +1142,7 @@ release_all_bus:
|
|||||||
release_chrdev:
|
release_chrdev:
|
||||||
unregister_chrdev_region(IEEE1394_CORE_DEV, 256);
|
unregister_chrdev_region(IEEE1394_CORE_DEV, 256);
|
||||||
exit_release_kernel_thread:
|
exit_release_kernel_thread:
|
||||||
if (khpsbpkt_pid >= 0) {
|
kthread_stop(khpsbpkt_thread);
|
||||||
kill_proc(khpsbpkt_pid, SIGTERM, 1);
|
|
||||||
wait_for_completion(&khpsbpkt_complete);
|
|
||||||
}
|
|
||||||
exit_cleanup_config_roms:
|
exit_cleanup_config_roms:
|
||||||
hpsb_cleanup_config_roms();
|
hpsb_cleanup_config_roms();
|
||||||
return ret;
|
return ret;
|
||||||
@ -1176,12 +1163,7 @@ static void __exit ieee1394_cleanup(void)
|
|||||||
bus_remove_file(&ieee1394_bus_type, fw_bus_attrs[i]);
|
bus_remove_file(&ieee1394_bus_type, fw_bus_attrs[i]);
|
||||||
bus_unregister(&ieee1394_bus_type);
|
bus_unregister(&ieee1394_bus_type);
|
||||||
|
|
||||||
if (khpsbpkt_pid >= 0) {
|
kthread_stop(khpsbpkt_thread);
|
||||||
khpsbpkt_kill = 1;
|
|
||||||
mb();
|
|
||||||
up(&khpsbpkt_sig);
|
|
||||||
wait_for_completion(&khpsbpkt_complete);
|
|
||||||
}
|
|
||||||
|
|
||||||
hpsb_cleanup_config_roms();
|
hpsb_cleanup_config_roms();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user