Re: APM Screen Blanking fix

From: Jordan Crouse
Date: Thu Dec 15 2005 - 16:54:20 EST


> > 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++) {
> > + error = set_power_state(dev[i], state);
> > +
> > + if ((error == APM_SUCCESS) || (error == APM_NO_ERROR))
> > + return 1;
> > +
> > + if (error == APM_NOT_ENGAGED)
> > + break;
> > }
> > - if ((error == APM_SUCCESS) || (error == APM_NO_ERROR))
> > - return 1;
>
> All the above doesn't actually have any functional changes does it?

No, thats actually the fix - Note that the original code only tried to
set the state on device 0x100, and then 0x1FF, and I added 0x101 to the
mix too. I just figured that while I was in there, I would re-do the
code to avoid a tiny if-then-else mess.

> > - if (error == APM_NOT_ENGAGED) {
> > + if (error == APM_NOT_ENGAGED && state != APM_STATE_READY) {
>
> And this is the actual fix/workaround?

Thats just prevents the error message from printing out twice.
I can't remember if it really fixed a problem with our BIOS returning
APM_NOT_ENGAGED when the READY state was set, but it still seems like
a good idea.

Jordan

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/