From: Johannes Berg Date: Fri, 16 Feb 2007 09:38:29 +0000 (-0800) Subject: power management: no valid states w/o pm_ops X-Git-Tag: v2.6.21-rc2~44^2~4 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9c372d06ce9ddf65e1393f9ea22a6d6bd5f96b42;p=linux-2.6 power management: no valid states w/o pm_ops 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 Cc: "Randy.Dunlap" Cc: Rafael J. Wysocki Cc: Pavel Macheck Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- diff --git a/kernel/power/main.c b/kernel/power/main.c index e1c4131204..a064dfd887 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; }