lkml.org 
[lkml]   [2007]   [Apr]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH] sparc64/power.c: Convert to use the kthread API
    Date
    From: Eric W. Biederman <ebiederm@xmission.com> - unquoted

    This starts the sparc64 powerd using kthread_run
    instead of kernel_thread and daemonize. Making the
    code slightly simpler and more maintainable.

    In addition the unnecessary flush_signals is removed.

    Cc: David S. Miller <davem@davemloft.net>
    Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
    ---
    arch/sparc64/kernel/power.c | 8 ++++----
    1 files changed, 4 insertions(+), 4 deletions(-)

    diff --git a/arch/sparc64/kernel/power.c b/arch/sparc64/kernel/power.c
    index 699b24b..03feb8b 100644
    --- a/arch/sparc64/kernel/power.c
    +++ b/arch/sparc64/kernel/power.c
    @@ -13,6 +13,7 @@
    #include <linux/interrupt.h>
    #include <linux/pm.h>
    #include <linux/syscalls.h>
    +#include <linux/kthread.h>

    #include <asm/system.h>
    #include <asm/auxio.h>
    @@ -81,15 +82,12 @@ static int powerd(void *__unused)
    char *argv[] = { "/sbin/shutdown", "-h", "now", NULL };
    DECLARE_WAITQUEUE(wait, current);

    - daemonize("powerd");
    -
    add_wait_queue(&powerd_wait, &wait);
    again:
    for (;;) {
    set_task_state(current, TASK_INTERRUPTIBLE);
    if (button_pressed)
    break;
    - flush_signals(current);
    schedule();
    }
    __set_current_state(TASK_RUNNING);
    @@ -128,7 +126,9 @@ static int __devinit power_probe(struct of_device *op, const struct of_device_id
    poweroff_method = machine_halt; /* able to use the standard halt */

    if (has_button_interrupt(irq, op->node)) {
    - if (kernel_thread(powerd, NULL, CLONE_FS) < 0) {
    + struct task_struct *task;
    + task = kthread_urn(powerd, NULL, "powerd");
    + if (IS_ERR(task)) {
    printk("Failed to start power daemon.\n");
    return 0;
    }
    --
    1.5.0.g53756
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2007-04-19 09:07    [W:4.120 / U:0.096 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site