Gutsy [PATCH 001/001] CONFIG_PM_DISABLE_CONSOLE

Tim Gardner tim.gardner at canonical.com
Tue Apr 24 21:12:31 UTC 2007


Kyle,

Is there a reason to initialize pm_disable_console to 1? Thats a change
in behavior from the standard kernel.

rtg

Ben Collins wrote:
> On Tue, 2007-04-24 at 10:59 -0400, Kyle McMartin wrote:
>> On Tue, Apr 24, 2007 at 10:35:01AM -0400, Ben Collins wrote:
>> How about we use sysfs?
> 
> 
> ACK
> 
> This patch will let us hack the PM scripts to set this attribute for our
> purposes.
> 
>> diff --git a/kernel/power/console.c b/kernel/power/console.c
>> index 89bcf49..294d7b6 100644
>> --- a/kernel/power/console.c
>> +++ b/kernel/power/console.c
>> @@ -16,6 +16,9 @@ static int orig_fgconsole, orig_kmsg;
>>  
>>  int pm_prepare_console(void)
>>  {
>> +	if (pm_disable_console)
>> +		return 0;
>> +
>>  	acquire_console_sem();
>>  
>>  	orig_fgconsole = fg_console;
>> @@ -49,6 +52,9 @@ int pm_prepare_console(void)
>>  
>>  void pm_restore_console(void)
>>  {
>> +	if (pm_disable_console)
>> +		return;
>> +
>>  	acquire_console_sem();
>>  	set_console(orig_fgconsole);
>>  	release_console_sem();
>> diff --git a/kernel/power/main.c b/kernel/power/main.c
>> index a064dfd..3537c70 100644
>> --- a/kernel/power/main.c
>> +++ b/kernel/power/main.c
>> @@ -293,6 +293,28 @@ static ssize_t state_store(struct subsystem * subsys, const char * buf, size_t n
>>  
>>  power_attr(state);
>>  
>> +int pm_disable_console = 1;
>> +
>> +static ssize_t pm_console_show(struct subsystem * subsys, char * buf)
>> +{
>> +	return sprintf(buf, "%d\n", pm_disable_console);
>> +}
>> +
>> +static ssize_t pm_console_store(struct subsystem * subsys, char * buf,
>> +	size_t n)
>> +{
>> +	int val;
>> +
>> +	if (sscanf(buf, "%d", &val) == 1) {
>> +		pm_disable_console = !!val;
>> +		return n;
>> +	}
>> +
>> +	return -EINVAL;
>> +}
>> +
>> +power_attr(pm_console);
>> +
>>  #ifdef CONFIG_PM_TRACE
>>  int pm_trace_enabled;
>>  
>> @@ -318,11 +340,13 @@ power_attr(pm_trace);
>>  static struct attribute * g[] = {
>>  	&state_attr.attr,
>>  	&pm_trace_attr.attr,
>> +	&pm_console_attr.attr,
>>  	NULL,
>>  };
>>  #else
>>  static struct attribute * g[] = {
>>  	&state_attr.attr,
>> +	&pm_console_attr.attr,
>>  	NULL,
>>  };
>>  #endif /* CONFIG_PM_TRACE */
>> diff --git a/kernel/power/power.h b/kernel/power/power.h
>> index eb461b8..4f5a9cc 100644
>> --- a/kernel/power/power.h
>> +++ b/kernel/power/power.h
>> @@ -11,7 +11,7 @@ struct swsusp_info {
>>  	unsigned long		size;
>>  } __attribute__((aligned(PAGE_SIZE)));
>>  
>> -
>> +extern int pm_disable_console;
>>  
>>  #ifdef CONFIG_SOFTWARE_SUSPEND
>>  extern int pm_suspend_disk(void);


-- 
Tim Gardner tim.gardner at ubuntu.com




More information about the kernel-team mailing list