lkml.org 
[lkml]   [2006]   [Jun]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[Suspend2][ 08/16] [Suspend2] Can suspend?
    Date
    Test whether resume2= points to a recognised signature. That is, can we
    even try to suspend?

    Signed-off-by: Nigel Cunningham <nigel@suspend2.net>

    kernel/power/suspend.c | 24 ++++++++++++++++++++++++
    1 files changed, 24 insertions(+), 0 deletions(-)

    diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
    index 504eed7..bda4c2a 100644
    --- a/kernel/power/suspend.c
    +++ b/kernel/power/suspend.c
    @@ -575,3 +575,27 @@ void suspend_cleanup(void)
    up(&pm_sem);
    }

    +static int can_suspend(void)
    +{
    + if (down_trylock(&pm_sem)) {
    + set_result_state(SUSPEND_ABORTED);
    + set_result_state(SUSPEND_PM_SEM);
    + return 0;
    + }
    +
    + if (!test_suspend_state(SUSPEND_CAN_SUSPEND))
    + suspend_attempt_to_parse_resume_device();
    +
    + if (!test_suspend_state(SUSPEND_CAN_SUSPEND)) {
    + printk(name_suspend "Software suspend is disabled.\n"
    + "This may be because you haven't put something along "
    + "the lines of\n\nresume2=swap:/dev/hda1\n\n"
    + "in lilo.conf or equivalent. (Where /dev/hda1 is your "
    + "swap partition).\n");
    + set_result_state(SUSPEND_ABORTED);
    + return 0;
    + }
    +
    + return 1;
    +}
    +
    --
    Nigel Cunningham nigel at suspend2 dot net
    -
    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: 2006-06-27 01:47    [W:0.036 / U:59.952 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site