]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
ACPI: thinkpad-acpi: rate-limit CMOS/EC unsynced error messages
authorHenrique de Moraes Holschuh <hmh@hmh.eng.br>
Sat, 26 Apr 2008 04:02:20 +0000 (01:02 -0300)
committerLen Brown <len.brown@intel.com>
Tue, 29 Apr 2008 13:47:00 +0000 (09:47 -0400)
If userspace applications mess with the CMOS NVRAM, or something causes
both the ACPI firmware and thinkpad-acpi to try to change the brightness at
the same time, it is possible to have the CMOS and EC registers for the
current brightness go out of sync.

Should that happen, thinkpad-acpi could be really obnoxious when using a
brightness_mode of 3 (both EC and CMOS).  Instead of complaining a massive
number of times, make sure to complain only once until EC and CMOS are back
in sync.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: Joerg Platte <lists@naasa.net>
Signed-off-by: Len Brown <len.brown@intel.com>
drivers/misc/thinkpad_acpi.c

index 601dbe8b407a5e13701f3585fd044f37e3edae3c..7dc6b73e8f5b118a3c2c1a56ae6fae160e7cc1b5 100644 (file)
@@ -239,6 +239,7 @@ static struct {
 
 static struct {
        u16 hotkey_mask_ff:1;
+       u16 bright_cmos_ec_unsync:1;
 } tp_warned;
 
 struct thinkpad_id_data {
@@ -4323,13 +4324,20 @@ static int brightness_get(struct backlight_device *bd)
                level = lcmos;
        }
 
-       if (brightness_mode == 3 && lec != lcmos) {
-               printk(TPACPI_ERR
-                       "CMOS NVRAM (%u) and EC (%u) do not agree "
-                       "on display brightness level\n",
-                       (unsigned int) lcmos,
-                       (unsigned int) lec);
-               return -EIO;
+       if (brightness_mode == 3) {
+               if (lec == lcmos)
+                       tp_warned.bright_cmos_ec_unsync = 0;
+               else {
+                       if (!tp_warned.bright_cmos_ec_unsync) {
+                               printk(TPACPI_ERR
+                                       "CMOS NVRAM (%u) and EC (%u) do not "
+                                       "agree on display brightness level\n",
+                                       (unsigned int) lcmos,
+                                       (unsigned int) lec);
+                               tp_warned.bright_cmos_ec_unsync = 1;
+                       }
+                       return -EIO;
+               }
        }
 
        return level;