lkml.org 
[lkml]   [2012]   [Jan]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v2 4/4] PM/Hibernate: Refactor and simplify freezer_test_done
    Date
    The code related to 'freezer_test_done' is needlessly convoluted.
    Refactor the code and simplify the implementation.

    Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
    ---

    kernel/power/hibernate.c | 10 +++++-----
    kernel/power/user.c | 4 ++--
    2 files changed, 7 insertions(+), 7 deletions(-)

    diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
    index 0ce1220..30b315a 100644
    --- a/kernel/power/hibernate.c
    +++ b/kernel/power/hibernate.c
    @@ -629,12 +629,8 @@ int hibernate(void)
    goto Finish;

    error = hibernation_snapshot(hibernation_mode == HIBERNATION_PLATFORM);
    - if (error)
    - goto Thaw;
    - if (freezer_test_done) {
    - freezer_test_done = false;
    + if (error || freezer_test_done)
    goto Thaw;
    - }

    if (in_suspend) {
    unsigned int flags = 0;
    @@ -665,6 +661,10 @@ int hibernate(void)

    Thaw:
    thaw_processes();
    +
    + /* Don't bother checking whether freezer_test_done is true */
    + freezer_test_done = false;
    +
    Finish:
    free_basic_memory_bitmaps();
    usermodehelper_enable();
    diff --git a/kernel/power/user.c b/kernel/power/user.c
    index 62dbe93..056088e 100644
    --- a/kernel/power/user.c
    +++ b/kernel/power/user.c
    @@ -259,10 +259,10 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,
    error = hibernation_snapshot(data->platform_support);
    if (!error) {
    error = put_user(in_suspend, (int __user *)arg);
    - if (!error && !freezer_test_done)
    - data->ready = 1;
    if (freezer_test_done)
    freezer_test_done = false;
    + else if (!error)
    + data->ready = 1;
    }
    break;



    \
     
     \ /
      Last update: 2012-01-31 00:17    [W:0.069 / U:62.072 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site