From: Pavel Machek <pavel@suse.cz>
To: david singleton <dsingleton@mvista.com>
Cc: linux-pm@lists.osdl.org
Subject: Re: Powerop-core.patch
Date: Tue, 15 Aug 2006 16:30:40 +0000 [thread overview]
Message-ID: <20060815163039.GE4032@ucw.cz> (raw)
In-Reply-To: <ca336d7d3b5ccf11a06a76d8a732fbea@mvista.com>
Hi!
> Here is the core patch for the PowerOp concept. It adds the powerop
> struct
> for opertaing point support to linux/pm.h and adds support to
> transition to supported operating points by
> setting their name into /sys/power/state.
>
> The supported operating points are shown in a readonly sysfs file,
> /sys/power/supported_states.
Could you fix the /sys interface to be value-per-file, and split it to
separate patch?
> -static const char * const pm_states[PM_SUSPEND_MAX] = {
> - [PM_SUSPEND_STANDBY] = "standby",
> - [PM_SUSPEND_MEM] = "mem",
> +static struct powerop standby = {
> + .name = "standby",
> + .description = "Power-On Suspend ACPI State: S1",
> + .type = PM_SUSPEND_STANDBY,
> +};
You got the description fields wrong...
> +static struct powerop mem = {
> + .name = "mem ",
> + .description = "Suspend-to-RAM ACPI State: S3",
> + .type = PM_SUSPEND_MEM,
> +};
...for example mem is used on non-acpi machines, too. Plus, it is
useless.
> +#endif
>
> -static inline int valid_state(suspend_state_t state)
> +/*
> + *
> + */
> +static int pm_change_state(struct powerop *state)
Eh?
> + /*
> + * list_find new operating point.
> + * compare to current operating point.
> + * if different change to new operating point.
> + */
> + list_for_each_entry_safe(this, next, head, list) {
> + if (strncmp(state->name, this->name, len) == 0) {
> + if ((strcmp(current_state->name, this->name))
> == 0) {
Do we really need to do list search here?
> + return 0;
> + }
And please avoid {} around single return.
> + /*
> + * now lets wait for the transition latency
> + */
> + udelay(this->latency);
udelay in generic code seems wrong.
> @@ -211,7 +275,15 @@ static int enter_state(suspend_state_t s
> */
> int software_suspend(void)
> {
> - return enter_state(PM_SUSPEND_DISK);
> + struct powerop *this, *next;
> + struct list_head *head = &pm_states.list;
> + int error = 0;
> +
> + list_for_each_entry_safe(this, next, head, list) {
> + if (this->type == PM_SUSPEND_DISK)
> + error= enter_state(this);
> + }
> + return error;
> }
Ugly....
> +struct powerop {
> + struct list_head list;
> + suspend_state_t type;
> + char name[PM_NAME_SIZE];
> + char description[PM_DESCRIPTION_SIZE];
> + unsigned int frequency; /* in KHz */
> + unsigned int voltage; /* mV */
having voltage/frequency/latency field for suspend-to-disk seems wrong.
--
Thanks for all the (sleeping) penguins.
next prev parent reply other threads:[~2006-08-15 16:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-05 2:31 Powerop-core.patch david singleton
[not found] ` <20060807131812.e31665d7.vitalywool@gmail.com>
2006-08-09 15:27 ` Powerop-core.patch david singleton
2006-08-15 16:30 ` Pavel Machek [this message]
-- strict thread matches above, loose matches on Subject: below --
2006-08-01 0:40 Powerop-core.patch david singleton
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=20060815163039.GE4032@ucw.cz \
--to=pavel@suse.cz \
--cc=dsingleton@mvista.com \
--cc=linux-pm@lists.osdl.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox