public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Todd Poynor <tpoynor@mvista.com>
Cc: linux-pm@osdl.org
Subject: Re: What woke system up?
Date: Thu, 22 Dec 2005 11:58:00 +0100	[thread overview]
Message-ID: <20051222105800.GA9838@elf.ucw.cz> (raw)
In-Reply-To: <20051221002958.GA15851@slurryseal.ddns.mvista.com>

[-- Attachment #1: Type: text/plain, Size: 1580 bytes --]

Hi!

> Next in our series of wakeup patches: a consumer electronics maker asked
> for a userspace interface to inquire what woke the system up, in order
> to present different behaviors depending on the wakeup source.  This is
> to be encouraged, as it places these kinds of policy decisions into the
> power policy application and out of the kernel.
> 
> So here's a quick try at adding a /sys/power/waker attribute and a
> pm_add_waker() kernel function that either drivers or board PM code can
> use to add (so far format-free) strings useful for telling what woke the
> system up.  The idea is that a buffer of these strings is cleared at
> each suspend and added to by the platform's resume path and/or driver
> resume methods.
> 
> I'll send a patch or two for embedded boards showing how
> this could be used for SoC-specific wakeup sources.
> 
> Any interest in this or something like it for Linux in general, or any
> other suggestions?  Thanks -- Todd

Well, idea may be okay but patch is ugly.

> Index: linux-2.6.15-rc4/kernel/power/main.c
> ===================================================================
> --- linux-2.6.15-rc4.orig/kernel/power/main.c
> +++ linux-2.6.15-rc4/kernel/power/main.c
> @@ -103,11 +103,18 @@ static int suspend_prepare(suspend_state
>  }
>  
>  
> +#define WAKERINFO_LEN 1024
> +
> +static char *wakerinfo;

Can you just allocate it statically? And use some reasonable length.

> +void pm_add_waker(char * buf)

char *buf

> +{
> +	if (! wakerinfo) {

Please don't use space between "!" and variable.

								Pavel
-- 
Thanks, Sharp!

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



      parent reply	other threads:[~2005-12-22 10:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-21  0:29 What woke system up? Todd Poynor
2005-12-21  2:11 ` Patrick Mochel
2005-12-22  3:46   ` Todd Poynor
2006-01-04 18:21     ` Leo L. Schwab
2006-01-05 15:08       ` Pavel Machek
2006-01-05 21:28       ` Patrick Mochel
2006-01-06  2:27         ` Todd Poynor
2005-12-22 10:58 ` Pavel Machek [this message]

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=20051222105800.GA9838@elf.ucw.cz \
    --to=pavel@ucw.cz \
    --cc=linux-pm@osdl.org \
    --cc=tpoynor@mvista.com \
    /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