linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: MyungJoo Ham <myungjoo.ham@samsung.com>
To: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: linux-pm@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org, Len Brown <len.brown@intel.com>,
	Pavel Machek <pavel@ucw.cz>, Greg Kroah-Hartman <gregkh@suse.de>,
	kyungmin.park@samsung.com
Subject: Re: [PATCH v4 1/2] PM / Core: suspend_again callback for suspend_ops.
Date: Wed, 18 May 2011 18:07:50 +0900	[thread overview]
Message-ID: <BANLkTim6ygf9JN2k1ZnW5kLwvUggDBJyNA@mail.gmail.com> (raw)
In-Reply-To: <201105172240.46970.rjw@sisk.pl>

2011/5/18 Rafael J. Wysocki <rjw@sisk.pl>:
> On Tuesday, May 17, 2011, MyungJoo Ham wrote:
[]
>> -static int suspend_enter(suspend_state_t state)
>> +static int suspend_enter(suspend_state_t state, bool *wakeup_pending)
>
> You don't need to use the wakeup_pending argument at all.  I think you
> shouldn't use it even, because in theory there may be a wakeup event after
> you've called pm_wakeup_pending() in suspend_enter() and in that case
> you should break the loop too.

In the case where:
- at the first instance of suspend_enter, pm_wakeup_pending() returns false.
- after suspend_ops->enter(state), the pm_wakeup_pending() "wants" to
return true.
- however, suspend_again forces to loop again.
- then, at the second instance of suspend_enter, pm_wakeup_pending()
returns true.
- the suspend_again's loop breaks.

Although it did not break the loop at the first while, it breaks
without calling suspend_ops->enter again anyway.

[]
>
> So I would simply call pm_wakeup_pending() here again.
>

Besides, if we simply call pm_wakeup_pending() again at there, the
loop will NOT break with pm_wakeup_pending() is true at the first call
inside of suspend_enter(). The function pm_wakeup_pending() clears out
the pending wakeup at each call; thus, in the following example, the
loop will not break:

- At the first instance of suspend_enter in the suspend-again loop,
pm_wakeup_pending() returns true in suspend_enter().
- suspend_enter() returns without error.
- pm_wakeup_pending() is called again at the while statement along
with suspend_ops->suspend_again().
- pm_wakeup_pending() now returns false because it has already
returned true before and cleared "events_check_enabled"
- the loop continues.

Because pm_save_wakeup_count will return true only once for each
wakeup-preventing-event, the result of pm_wakeup_pending in
suspend_enter() should be relayed outside to the loop anyway.

>>
>>   Resume_devices:
>>       suspend_test_start();
>>
>
> Thanks,
> Rafael
>


Cheers!

- MyungJoo
-- 
MyungJoo Ham (함명주), Ph.D.
Mobile Software Platform Lab,
Digital Media and Communications (DMC) Business
Samsung Electronics
cell: 82-10-6714-2858

  reply	other threads:[~2011-05-18  9:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-11  5:18 [RFC PATCH v3 1/2] PM / Core: suspend_again callback for suspend_ops MyungJoo Ham
2011-05-11  5:18 ` [RFC PATCH v3 2/2] PM / Core: partial resume/suspend API for suspend_again users MyungJoo Ham
2011-05-12  6:19 ` [RFC PATCH v3 1/2] PM / Core: suspend_again callback for suspend_ops Pavel Machek
2011-05-17  4:59   ` [PATCH v4 " MyungJoo Ham
2011-05-17  4:59     ` [PATCH v4 2/2] PM / Core: partial resume/suspend API for suspend_again users MyungJoo Ham
2011-05-17 20:52       ` Rafael J. Wysocki
2011-05-18  5:58         ` MyungJoo Ham
2011-05-18 20:18           ` Rafael J. Wysocki
2011-05-17 20:40     ` [PATCH v4 1/2] PM / Core: suspend_again callback for suspend_ops Rafael J. Wysocki
2011-05-18  9:07       ` MyungJoo Ham [this message]
2011-05-18 20:20         ` Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BANLkTim6ygf9JN2k1ZnW5kLwvUggDBJyNA@mail.gmail.com \
    --to=myungjoo.ham@samsung.com \
    --cc=gregkh@suse.de \
    --cc=kyungmin.park@samsung.com \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=myungjoo.ham@gmail.com \
    --cc=pavel@ucw.cz \
    --cc=rjw@sisk.pl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).