public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@suse.de>
To: linux-kernel@vger.kernel.org
Cc: Johannes Berg <johannes@sipsolutions.net>,
	Andrew Morton <akpm@linux-foundation.org>,
	Greg Kroah-Hartman <gregkh@suse.de>
Subject: [PATCH 5/9] power management: no valid states w/o pm_ops
Date: Fri, 23 Feb 2007 15:15:52 -0800	[thread overview]
Message-ID: <1172272569255-git-send-email-gregkh@suse.de> (raw)
In-Reply-To: <1172272565581-git-send-email-gregkh@suse.de>

From: Johannes Berg <johannes@sipsolutions.net>

Change /sys/power/state to not advertise any valid states (except for disk
if SOFTWARE_SUSPEND is enabled) when no pm_ops have been set so userspace
can easily discover what states should be available.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Cc: "Randy.Dunlap" <rdunlap@xenotime.net>
Cc: Rafael J. Wysocki <rjw@sisk.pl>
Cc: Pavel Macheck <pavel@ucw.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 kernel/power/main.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/kernel/power/main.c b/kernel/power/main.c
index e1c4131..a064dfd 100644
--- a/kernel/power/main.c
+++ b/kernel/power/main.c
@@ -167,7 +167,10 @@ static inline int valid_state(suspend_state_t state)
 	if (state == PM_SUSPEND_DISK)
 		return 1;
 
-	if (pm_ops && pm_ops->valid && !pm_ops->valid(state))
+	/* all other states need lowlevel support and need to be
+	 * valid to the lowlevel implementation, no valid callback
+	 * implies that all are valid. */
+	if (!pm_ops || (pm_ops->valid && !pm_ops->valid(state)))
 		return 0;
 	return 1;
 }
-- 
1.5.0.1


  reply	other threads:[~2007-02-23 23:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-23 23:14 [GIT PATCH] Driver core patches for 2.6.21-rc1 Greg KH
2007-02-23 23:15 ` [PATCH 1/9] Driver core: remove class_device_rename Greg Kroah-Hartman
2007-02-23 23:15   ` [PATCH 2/9] driver core: refcounting fix Greg Kroah-Hartman
2007-02-23 23:15     ` [PATCH 3/9] sysfs: move struct sysfs_dirent to private header Greg Kroah-Hartman
2007-02-23 23:15       ` [PATCH 4/9] Driver core: more fallout from class_device changes for pcmcia Greg Kroah-Hartman
2007-02-23 23:15         ` Greg Kroah-Hartman [this message]
2007-02-23 23:15           ` [PATCH 6/9] power management: fix struct layout and docs Greg Kroah-Hartman
2007-02-23 23:15             ` [PATCH 7/9] make kernel/kmod.c:kmod_mk static Greg Kroah-Hartman
2007-02-23 23:15               ` [PATCH 8/9] Driver core: fix error by cleanup up symlinks properly Greg Kroah-Hartman
2007-02-23 23:15                 ` [PATCH 9/9] Revert "Driver core: let request_module() send a /sys/modules/kmod/-uevent" Greg Kroah-Hartman
2007-03-10 13:11                 ` [PATCH 8/9] Driver core: fix error by cleanup up symlinks properly Dmitriy Monakhov
2007-03-11 12:36                   ` [PATCH] driver core: fix device_add error path Dmitriy Monakhov

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=1172272569255-git-send-email-gregkh@suse.de \
    --to=gregkh@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=johannes@sipsolutions.net \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox