Linux ACPI
 help / color / mirror / Atom feed
* [PATCH] ACPI video: ignore buggy _BQC
@ 2009-06-24  5:09 Zhang Rui
  2009-06-24  6:09 ` Len Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Zhang Rui @ 2009-06-24  5:09 UTC (permalink / raw)
  To: Len Brown; +Cc: linux-acpi, showard314, Zhang, Rui

From: Scott Howard <showard314@gmail.com>

_BQC doesn't return a value listed in _BCL method.
http://bugzilla.kernel.org/show_bug.cgi?id=13511

ingore the buggy _BQC method in this case

Signed-off-by: Scott Howard <showard314@gmail.com>
Acked-by: Zhang Rui <rui.zhang@intel.com>
---
 drivers/acpi/video.c |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

Index: linux-2.6/drivers/acpi/video.c
===================================================================
--- linux-2.6.orig/drivers/acpi/video.c
+++ linux-2.6/drivers/acpi/video.c
@@ -594,6 +594,7 @@ acpi_video_device_lcd_get_level_current(
 					unsigned long long *level)
 {
 	acpi_status status = AE_OK;
+	int i;
 
 	if (device->cap._BQC || device->cap._BCQ) {
 		char *buf = device->cap._BQC ? "_BQC" : "_BCQ";
@@ -609,8 +610,15 @@ acpi_video_device_lcd_get_level_current(
 
 			}
 			*level += bqc_offset_aml_bug_workaround;
-			device->brightness->curr = *level;
-			return 0;
+ 			for (i = 2; i < device->brightness->count; i++)
+ 			        if (device->brightness->levels[i] == *level) {
+ 				        device->brightness->curr = *level;
+ 			                return 0;
+ 			        }
+ 			/* BQC returned an invalid level. Stop using it.  */
+ 			ACPI_WARNING((AE_INFO, "%s returned an invalid level",
+ 				      buf));
+ 			device->cap._BQC = device->cap._BCQ = 0;
 		} else {
 			/* Fixme:
 			 * should we return an error or ignore this failure?



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ACPI video: ignore buggy _BQC
  2009-06-24  5:09 [PATCH] ACPI video: ignore buggy _BQC Zhang Rui
@ 2009-06-24  6:09 ` Len Brown
  2009-06-24  7:17   ` Zhang Rui
  0 siblings, 1 reply; 4+ messages in thread
From: Len Brown @ 2009-06-24  6:09 UTC (permalink / raw)
  To: Zhang Rui; +Cc: linux-acpi, showard314

scripts/checkpatch.pl
ERROR: code indent should use tabs where possible
#38: FILE: drivers/acpi/video.c:613:
+ ^I^I^Ifor (i = 2; i < device->brightness->count; i++)$

ERROR: code indent should use tabs where possible
#39: FILE: drivers/acpi/video.c:614:
+ ^I^I^I        if (device->brightness->levels[i] == *level) {$

ERROR: code indent should use tabs where possible
#40: FILE: drivers/acpi/video.c:615:
+ ^I^I^I^I        device->brightness->curr = *level;$

ERROR: code indent should use tabs where possible
#41: FILE: drivers/acpi/video.c:616:
+ ^I^I^I                return 0;$

ERROR: code indent should use tabs where possible
#42: FILE: drivers/acpi/video.c:617:
+ ^I^I^I        }$

ERROR: code indent should use tabs where possible
#43: FILE: drivers/acpi/video.c:618:
+ ^I^I^I/* BQC returned an invalid level. Stop using it.  */$

ERROR: code indent should use tabs where possible
#44: FILE: drivers/acpi/video.c:619:
+ ^I^I^IACPI_WARNING((AE_INFO, "%s returned an invalid level",$

ERROR: code indent should use tabs where possible
#45: FILE: drivers/acpi/video.c:620:
+ ^I^I^I^I      buf));$

ERROR: code indent should use tabs where possible
#46: FILE: drivers/acpi/video.c:621:
+ ^I^I^Idevice->cap._BQC = device->cap._BCQ = 0;$

total: 9 errors, 0 warnings, 24 lines checked


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ACPI video: ignore buggy _BQC
  2009-06-24  6:09 ` Len Brown
@ 2009-06-24  7:17   ` Zhang Rui
  2009-06-24 17:37     ` Len Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Zhang Rui @ 2009-06-24  7:17 UTC (permalink / raw)
  To: Len Brown; +Cc: linux-acpi, showard314@gmail.com

On Wed, 2009-06-24 at 14:09 +0800, Len Brown wrote:
> scripts/checkpatch.pl
> total: 9 errors, 0 warnings, 24 lines checked
> 
sorry, refreshed patch attached.

From: Scott Howard <showard314@gmail.com>

_BQC doesn't return a value listed in _BCL method.
http://bugzilla.kernel.org/show_bug.cgi?id=13511

ingore the buggy _BQC method in this case

Signed-off-by: Scott Howard <showard314@gmail.com>
Acked-by: Zhang Rui <rui.zhang@intel.com>
---
 drivers/acpi/video.c |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

Index: linux-2.6/drivers/acpi/video.c
===================================================================
--- linux-2.6.orig/drivers/acpi/video.c
+++ linux-2.6/drivers/acpi/video.c
@@ -594,6 +594,7 @@ acpi_video_device_lcd_get_level_current(
 					unsigned long long *level)
 {
 	acpi_status status = AE_OK;
+	int i;
 
 	if (device->cap._BQC || device->cap._BCQ) {
 		char *buf = device->cap._BQC ? "_BQC" : "_BCQ";
@@ -609,8 +610,15 @@ acpi_video_device_lcd_get_level_current(
 
 			}
 			*level += bqc_offset_aml_bug_workaround;
-			device->brightness->curr = *level;
-			return 0;
+			for (i = 2; i < device->brightness->count; i++)
+				if (device->brightness->levels[i] == *level) {
+					device->brightness->curr = *level;
+					return 0;
+			}
+			/* BQC returned an invalid level. Stop using it.  */
+			ACPI_WARNING((AE_INFO, "%s returned an invalid level",
+						buf));
+			device->cap._BQC = device->cap._BCQ = 0;
 		} else {
 			/* Fixme:
 			 * should we return an error or ignore this failure?



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ACPI video: ignore buggy _BQC
  2009-06-24  7:17   ` Zhang Rui
@ 2009-06-24 17:37     ` Len Brown
  0 siblings, 0 replies; 4+ messages in thread
From: Len Brown @ 2009-06-24 17:37 UTC (permalink / raw)
  To: Zhang Rui; +Cc: linux-acpi, showard314@gmail.com

applied

thanks,
Len Brown, Intel Open Source Technology Center


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-06-24 17:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-24  5:09 [PATCH] ACPI video: ignore buggy _BQC Zhang Rui
2009-06-24  6:09 ` Len Brown
2009-06-24  7:17   ` Zhang Rui
2009-06-24 17:37     ` Len Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox