ACPI video: fix an error when the brightness levels on AC and on Battery are same
authorZhang Rui <rui.zhang@intel.com>
Tue, 14 Apr 2009 03:02:18 +0000 (11:02 +0800)
committerLen Brown <len.brown@intel.com>
Mon, 20 Apr 2009 04:22:44 +0000 (00:22 -0400)
when the brightness level on AC and brightness level on Battery
are same, the level_ac_battery is 1 in the current code,
which is wrong.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
drivers/acpi/video.c

index cd4fb7543a902ff206599b9a062762e50f68b526..21968ae6ed91add7b1fb23493606457caf35bc49 100644 (file)
@@ -770,10 +770,12 @@ acpi_video_init_brightness(struct acpi_video_device *device)
         * In this case, the first two elements in _BCL packages
         * are also supported brightness levels that OS should take care of.
         */
-       for (i = 2; i < count; i++)
-               if (br->levels[i] == br->levels[0] ||
-                   br->levels[i] == br->levels[1])
+       for (i = 2; i < count; i++) {
+               if (br->levels[i] == br->levels[0])
                        level_ac_battery++;
+               if (br->levels[i] == br->levels[1])
+                       level_ac_battery++;
+       }
 
        if (level_ac_battery < 2) {
                level_ac_battery = 2 - level_ac_battery;