diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2007-05-08 03:30:17 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-08 14:15:11 -0400 |
commit | db9c02fa8bd50eb104781a9f78cae923d8da1e74 (patch) | |
tree | 33d1433549bcc6a38de624dfa5220a7523e60c16 /drivers/pnp | |
parent | 1bd0cf1fc78e59e1d2b4e44348a85d39b983c80d (diff) |
pnpbios: convert to use the kthread API
This patches modifies the pnpbios kernel thread to start with ktrhead_run
not kernel_thread and deamonize. Doing this makes the code a little
simpler and easier to maintain.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Cc: Adam Belay <ambx1@neo.rr.com>
Cc: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/pnp')
-rw-r--r-- | drivers/pnp/pnpbios/core.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/drivers/pnp/pnpbios/core.c b/drivers/pnp/pnpbios/core.c index 95738dbd5d45..b71aff21b3fc 100644 --- a/drivers/pnp/pnpbios/core.c +++ b/drivers/pnp/pnpbios/core.c | |||
@@ -62,6 +62,7 @@ | |||
62 | #include <linux/delay.h> | 62 | #include <linux/delay.h> |
63 | #include <linux/acpi.h> | 63 | #include <linux/acpi.h> |
64 | #include <linux/freezer.h> | 64 | #include <linux/freezer.h> |
65 | #include <linux/kthread.h> | ||
65 | 66 | ||
66 | #include <asm/page.h> | 67 | #include <asm/page.h> |
67 | #include <asm/desc.h> | 68 | #include <asm/desc.h> |
@@ -159,9 +160,7 @@ static int pnp_dock_thread(void * unused) | |||
159 | { | 160 | { |
160 | static struct pnp_docking_station_info now; | 161 | static struct pnp_docking_station_info now; |
161 | int docked = -1, d = 0; | 162 | int docked = -1, d = 0; |
162 | daemonize("kpnpbiosd"); | 163 | while (!unloading) |
163 | allow_signal(SIGKILL); | ||
164 | while(!unloading && !signal_pending(current)) | ||
165 | { | 164 | { |
166 | int status; | 165 | int status; |
167 | 166 | ||
@@ -170,11 +169,8 @@ static int pnp_dock_thread(void * unused) | |||
170 | */ | 169 | */ |
171 | msleep_interruptible(2000); | 170 | msleep_interruptible(2000); |
172 | 171 | ||
173 | if(signal_pending(current)) { | 172 | if (try_to_freeze()) |
174 | if (try_to_freeze()) | 173 | continue; |
175 | continue; | ||
176 | break; | ||
177 | } | ||
178 | 174 | ||
179 | status = pnp_bios_dock_station_info(&now); | 175 | status = pnp_bios_dock_station_info(&now); |
180 | 176 | ||
@@ -581,6 +577,7 @@ subsys_initcall(pnpbios_init); | |||
581 | 577 | ||
582 | static int __init pnpbios_thread_init(void) | 578 | static int __init pnpbios_thread_init(void) |
583 | { | 579 | { |
580 | struct task_struct *task; | ||
584 | #if defined(CONFIG_PPC_MERGE) | 581 | #if defined(CONFIG_PPC_MERGE) |
585 | if (check_legacy_ioport(PNPBIOS_BASE)) | 582 | if (check_legacy_ioport(PNPBIOS_BASE)) |
586 | return 0; | 583 | return 0; |
@@ -589,7 +586,8 @@ static int __init pnpbios_thread_init(void) | |||
589 | return 0; | 586 | return 0; |
590 | #ifdef CONFIG_HOTPLUG | 587 | #ifdef CONFIG_HOTPLUG |
591 | init_completion(&unload_sem); | 588 | init_completion(&unload_sem); |
592 | if (kernel_thread(pnp_dock_thread, NULL, CLONE_KERNEL) > 0) | 589 | task = kthread_run(pnp_dock_thread, NULL, "kpnpbiosd"); |
590 | if (!IS_ERR(task)) | ||
593 | unloading = 0; | 591 | unloading = 0; |
594 | #endif | 592 | #endif |
595 | return 0; | 593 | return 0; |