Re: [PATCH 05/13] PM: Add option to disable /sys/power/state interface

Rafael J. Wysocki
2009-02-07T22:37:39Z

On Thursday 05 February 2009, Arve Hjønnevåg wrote:
> Signed-off-by: Arve Hjønnevåg <arve@android.com>

This is completely wrong, IMO.

Removing an interface that has existed forever just because it happens to
be incompatible with your new shiny feature is not acceptable to me.

Please try to make the new feature work with the existing interface instead.

> ---
> kernel/power/Kconfig | 9 +++++++++
> kernel/power/main.c | 4 ++++
> 2 files changed, 13 insertions(+), 0 deletions(-)
>
> diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig
> index 6e3da6e..dd76467 100644
> --- a/kernel/power/Kconfig
> +++ b/kernel/power/Kconfig
> @@ -135,6 +135,15 @@ config WAKELOCK_STAT
> ---help---
> Report wake lock stats in /proc/wakelocks
>
> +config DISABLE_SYS_POWER_STATE
> + bool "Disable /sys/power/state interface"
> + depends on WAKELOCK
> + default n
> + ---help---
> + The /sys/power/state interface does not respect wakelocks. If you
> + want to run user-space code that does not support wakelocks, do not
> + enable this option since it removes the interface.
> +
> config HIBERNATION
> bool "Hibernation (aka 'suspend to disk')"
> depends on PM && SWAP && ARCH_HIBERNATION_POSSIBLE
> diff --git a/kernel/power/main.c b/kernel/power/main.c
> index ab9fc7f..e2aae3e 100644
> --- a/kernel/power/main.c
> +++ b/kernel/power/main.c
> @@ -479,6 +479,7 @@ struct kobject *power_kobj;
> * proper enumerated value, and initiates a suspend transition.
> */
>
> +#ifndef CONFIG_DISABLE_SYS_POWER_STATE
> static ssize_t state_show(struct kobject *kobj, struct kobj_attribute *attr,
> char *buf)
> {
> @@ -542,6 +543,7 @@ static ssize_t state_store(struct kobject *kobj, struct kobj_attribute *attr,
> }
>
> power_attr(state);
> +#endif
>
> #ifdef CONFIG_PM_TRACE
> int pm_trace_enabled;
> @@ -569,7 +571,9 @@ power_attr(pm_trace);
> #endif /* CONFIG_PM_TRACE */
>
> static struct attribute * g[] = {
> +#ifndef CONFIG_DISABLE_SYS_POWER_STATE
> &state_attr.attr,
> +#endif
> #ifdef CONFIG_PM_TRACE
> &pm_trace_attr.attr,
> #endif

Thanks,
Rafael
_______________________________________________
linux-pm mailing list
linux-pm@lists.linux-foundation.org