All of lore.kernel.org
 help / color / mirror / Atom feed
From: Russell King <rmk@arm.linux.org.uk>
To: Thomas Hood <jdthood@mail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: USB not processing APM suspend event properly?
Date: Wed, 12 Dec 2001 23:49:16 +0000	[thread overview]
Message-ID: <20011212234916.A4606@flint.arm.linux.org.uk> (raw)
In-Reply-To: <1008200427.1134.29.camel@thanatos>
In-Reply-To: <1008200427.1134.29.camel@thanatos>; from jdthood@mail.com on Wed, Dec 12, 2001 at 06:40:26PM -0500

On Wed, Dec 12, 2001 at 06:40:26PM -0500, Thomas Hood wrote:
> I suppose that the reason why it is presently coded as
> it is is that the drivers can veto the suspend whereas
> the "listeners" can't, and the apm driver wants to tell
> the listeners about the event only if it isn't vetoed.
> With your change, the apm driver really should ignore
> a veto from the drivers since it has already told the
> listeners about the event.  Therefore, while your patch
> is an improvement, it still isn't the whole solution.

I think it does perform acceptable behaviour however - if the drivers
(in the unlikely event) refuse the event after we've told user space,
we tell user space we resumed.

> One possible solution is for the apm driver first to _ask_
> the device drivers whether a suspend is allowed; then
> to tell the listeners; then to tell the device drivers
> to suspend.

What if the condition of the suspend gets changed by the act of paging
in memory, or some other change that occured in user space?  It's a
chicken and egg problem. 8(

> Actually, it's not true that the original code sends PM_SUSPEND
> each time a listener on /dev/apm_bios replies.  The code 
> fragment is:
>                 if (as->suspends_read > 0) {
>                         as->suspends_read--;
>                         as->suspends_pending--;
>                         suspends_pending--;
>                 } else if (!send_event(APM_USER_SUSPEND))
>                         return -EAGAIN;
>                 else
>                         queue_event(APM_USER_SUSPEND, as);
> This only calls send_event() if the ioctl(suspend) is NOT a
> reply to a notification that was earlier read from the queue.

It is a minor point, but an unwanted one that just obfuscates the operation
of the APM system - only the first PM SUSPEND event causes a change.

Sending 'n' PM_SUSPEND events because you have 'n' listeners on
/dev/apm_bios seems to be a waste of time when it could be handled
more cleanly.

--
Russell King (rmk@arm.linux.org.uk)                The developer of ARM Linux
             http://www.arm.linux.org.uk/personal/aboutme.html


  reply	other threads:[~2001-12-12 23:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-12-12 23:40 USB not processing APM suspend event properly? Thomas Hood
2001-12-12 23:49 ` Russell King [this message]
  -- strict thread matches above, loose matches on Subject: below --
2001-12-13  1:03 Thomas Hood
2001-12-13 10:36 ` Russell King
2001-12-13 14:10   ` Thomas Hood
2001-12-12 22:15 Thomas Hood
2001-12-12 22:41 ` Alan Cox
2001-12-12 22:49   ` Russell King
2001-12-09 23:31 Thomas Hood

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=20011212234916.A4606@flint.arm.linux.org.uk \
    --to=rmk@arm.linux.org.uk \
    --cc=jdthood@mail.com \
    --cc=linux-kernel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.