Re: apm_console_blank()

Pavel Machek
2005-03-29T18:51:00Z

[-- Attachment #1: Type: text/plain, Size: 1888 bytes --]

Hi!

> Everyone, put on your legacy helmets... :)
>
> Attached is a diff against apm.c fixing what I think was a flaw in
> the logic of the function apm_console_blank().

I guess you need to send it to APM maintainer...

Please inline your patches, its easier to comment on them that way.

--- linux-2.6.11.orig/arch/i386/kernel/apm.c 2005-03-28 10:05:01.000000000 -0700
+++ linux-2.6.11/arch/i386/kernel/apm.c 2005-03-28 10:05:12.000000000 -0700
@@ -1058,25 +1058,26 @@
* all video devices. Typically the BIOS will do laptop backlight
and * monitor powerdown for us.
*/
-
-static int apm_console_blank(int blank)
-{
- int error;
- u_short state;
+
+static int apm_console_blank(int blank) {
+
+ int error, i;
+ u_short state;

You are actually breaking formating here.

+ u_short dev[3] = { 0x100, 0x1FF, 0x101 };

state = blank ? APM_STATE_STANDBY : APM_STATE_READY;
- /* Blank the first display device */
- error = set_power_state(0x100, state);
- if ((error != APM_SUCCESS) && (error != APM_NO_ERROR)) {
- /* try to blank them all instead */
- error = set_power_state(0x1ff, state);
- if ((error != APM_SUCCESS) && (error != APM_NO_ERROR))
- /* try to blank device one instead */
- error = set_power_state(0x101, state);
+
+ for(i = 0; i < 3; i++) {

Please put space between for and (.

@@ -1089,7 +1090,8 @@
return apm_console_blank(blank);
}
}
- apm_error("set display", error);
+
+ apm_error("set display", error);
return 0;
}

...and don't do change formatting just because you can.

Pavel

--
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!