Skip to contentSkip to conversation

asus_acpi bugs

PATCH New Karol Kozimor 1 participant 2 messages Sep 12, 2005 – Sep 14, 2005 4 messages not in the archive ACPI

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): F7DC2337C7631D4386A2DF6E8FB22B30047FA08F@hdsmsx401.amr.corp.intel.com

A message that is not in the archive (sent off-list or not yet received): F7DC2337C7631D4386A2DF6E8FB22B30047FA08F-N2PTB0HCzHKkrb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org

#2 lore raw

Thus wrote Brown, Len:

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

http://bugzilla.kernel.org/show_bug.cgi?id=5067
http://bugzilla.kernel.org/show_bug.cgi?id=5092

Here is another take on this issue, as much ugly as, IMHO, correct. I *would* prefer this to be applied rather than the other patch, because it fixes the root cause of the problem instead of trying to work around it. Of course, I'm pretty sure fiddling with global variables will not be taken lightly...
NOTE: the actual fix is in the initial hunks, the last one is just code reordering and whitespace stuff.

Signature · 146 lines
Karol 'sziwan' Kozimor
sziwan-DETuoxkZsSqrDJvtcaxF/[email protected]

Signed-off-by: Karol Kozimor <sziwan-DETuoxkZsSqrDJvtcaxF/[email protected]>

--- a/drivers/acpi/asus_acpi.c	2005-09-12 21:39:47.000000000 +0200
+++ b/drivers/acpi/asus_acpi.c	2005-09-12 21:53:19.000000000 +0200
@@ -962,6 +962,7 @@
 	struct acpi_buffer dsdt = { ACPI_ALLOCATE_BUFFER, NULL };
 	union acpi_object *model = NULL;
 	int bsts_result;
+	int acpi_is_strict = acpi_strict;
 	acpi_status status;
 
 	/*
@@ -978,6 +979,10 @@
 	else
 		asus_info = (struct acpi_table_header *) dsdt.pointer;
 
+	/* Implicit return code confuses model detection, disable it */
+	if (!acpi_is_strict)
+		acpi_strict = 1;
+
 	/* We have to write 0 on init this far for all ASUS models */
 	if (!write_acpi_int(hotk->handle, "INIT", 0, &buffer)) {
 		printk(KERN_ERR "  Hotkey initialization failed\n");
@@ -990,6 +995,10 @@
 	else if (bsts_result)
 		printk(KERN_NOTICE "  BSTS called, 0x%02x returned\n", bsts_result);
 
+	/* Restore if disabled previously */
+	if (!acpi_is_strict)
+		acpi_strict = 0;
+
 	/* Samsung P30 has a device with a valid _HID whose INIT does not 
 	 * return anything. Catch this one and any similar here */
 	if (buffer.pointer == NULL) {
@@ -1007,56 +1016,56 @@
 		return AE_OK;
 	}
 	
+	hotk->model = END_MODEL;
+
 	model = (union acpi_object *) buffer.pointer;
 	if (model->type == ACPI_TYPE_STRING) {
 		printk(KERN_NOTICE "  %s model detected, ", model->string.pointer);
+		if (strncmp(model->string.pointer, "L3D", 3) == 0)
+			hotk->model = L3D;
+		else if (strncmp(model->string.pointer, "L3H", 3) == 0 ||
+		         strncmp(model->string.pointer, "L2E", 3) == 0)
+			hotk->model = L3H;
+		else if (strncmp(model->string.pointer, "L3", 2) == 0 ||
+			 strncmp(model->string.pointer, "L2B", 3) == 0)
+			hotk->model = L3C;
+		else if (strncmp(model->string.pointer, "L8L", 3) == 0)
+			hotk->model = L8L;
+		else if (strncmp(model->string.pointer, "L4R", 3) == 0)
+			hotk->model = L4R;
+		else if (strncmp(model->string.pointer, "M6N", 3) == 0)
+			hotk->model = M6N;
+		else if (strncmp(model->string.pointer, "M6R", 3) == 0)
+			hotk->model = M6R;
+		else if (strncmp(model->string.pointer, "M2N", 3) == 0 ||
+		         strncmp(model->string.pointer, "M3N", 3) == 0 ||
+		         strncmp(model->string.pointer, "M5N", 3) == 0 ||
+		         strncmp(model->string.pointer, "M6N", 3) == 0 ||
+		         strncmp(model->string.pointer, "S1N", 3) == 0 ||
+		         strncmp(model->string.pointer, "S5N", 3) == 0 ||
+		         strncmp(model->string.pointer, "W1N", 3) == 0)
+			hotk->model = xxN;
+		else if (strncmp(model->string.pointer, "M1", 2) == 0)
+			hotk->model = M1A;
+		else if (strncmp(model->string.pointer, "M2", 2) == 0 ||
+		         strncmp(model->string.pointer, "L4E", 3) == 0)
+			hotk->model = M2E;
+		else if (strncmp(model->string.pointer, "L2", 2) == 0)
+			hotk->model = L2D;
+		else if (strncmp(model->string.pointer, "L8", 2) == 0)
+			hotk->model = S1x;
+		else if (strncmp(model->string.pointer, "D1", 2) == 0)
+			hotk->model = D1x;
+		else if (strncmp(model->string.pointer, "A1", 2) == 0)
+			hotk->model = A1x;
+		else if (strncmp(model->string.pointer, "A2", 2) == 0)
+			hotk->model = A2x;
+		else if (strncmp(model->string.pointer, "J1", 2) == 0)
+			hotk->model = S2x;
+		else if (strncmp(model->string.pointer, "L5", 2) == 0)
+			hotk->model = L5x;
 	}
 
-	hotk->model = END_MODEL;
-	if (strncmp(model->string.pointer, "L3D", 3) == 0)
-		hotk->model = L3D;
-	else if (strncmp(model->string.pointer, "L3H", 3) == 0 ||
-		 strncmp(model->string.pointer, "L2E", 3) == 0)
-		hotk->model = L3H;
-	else if (strncmp(model->string.pointer, "L3", 2) == 0 ||
-		 strncmp(model->string.pointer, "L2B", 3) == 0)
-		hotk->model = L3C;
-	else if (strncmp(model->string.pointer, "L8L", 3) == 0)
-		hotk->model = L8L;
-	else if (strncmp(model->string.pointer, "L4R", 3) == 0)
-		hotk->model = L4R;
-	else if (strncmp(model->string.pointer, "M6N", 3) == 0)
-		hotk->model = M6N;
-	else if (strncmp(model->string.pointer, "M6R", 3) == 0)
-		hotk->model = M6R;
-	else if (strncmp(model->string.pointer, "M2N", 3) == 0 ||
-		 strncmp(model->string.pointer, "M3N", 3) == 0 ||
-		 strncmp(model->string.pointer, "M5N", 3) == 0 ||
-		 strncmp(model->string.pointer, "M6N", 3) == 0 ||
-		 strncmp(model->string.pointer, "S1N", 3) == 0 ||
-		 strncmp(model->string.pointer, "S5N", 3) == 0 ||
-                 strncmp(model->string.pointer, "W1N", 3) == 0)
-		hotk->model = xxN;
-	else if (strncmp(model->string.pointer, "M1", 2) == 0)
-		hotk->model = M1A;
-	else if (strncmp(model->string.pointer, "M2", 2) == 0 ||
-		 strncmp(model->string.pointer, "L4E", 3) == 0)
-		hotk->model = M2E;
-	else if (strncmp(model->string.pointer, "L2", 2) == 0)
-		hotk->model = L2D;
-	else if (strncmp(model->string.pointer, "L8", 2) == 0)
-		hotk->model = S1x;
-	else if (strncmp(model->string.pointer, "D1", 2) == 0)
-		hotk->model = D1x;
-	else if (strncmp(model->string.pointer, "A1", 2) == 0)
-		hotk->model = A1x;
-	else if (strncmp(model->string.pointer, "A2", 2) == 0)
-		hotk->model = A2x;
-	else if (strncmp(model->string.pointer, "J1", 2) == 0)
-		hotk->model = S2x;
-	else if (strncmp(model->string.pointer, "L5", 2) == 0)
-		hotk->model = L5x;
-
 	if (hotk->model == END_MODEL) {
 		printk("unsupported, trying default values, supply the "
 		       "developers with your DSDT\n");


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): 20050912201443.GA3320-DETuoxkZsSqrDJvtcaxF/[email protected]

#5 lore raw

PATCH 1/1 Fix regression on Samsung P30 [was: Re: asus_acpi bugs]

Thus wrote Karol Kozimor:

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

http://bugzilla.kernel.org/show_bug.cgi?id=5067
http://bugzilla.kernel.org/show_bug.cgi?id=5092

OK, the previous patch just didn't work. Here's the original fix with better comments. Please apply.

Signature · 53 lines
Karol 'sziwan' Kozimor
sziwan-DETuoxkZsSqrDJvtcaxF/[email protected]


Signed-off-by: Karol Kozimor <sziwan-DETuoxkZsSqrDJvtcaxF/[email protected]>


--- a/drivers/acpi/asus_acpi.c	2005-09-12 21:39:47.000000000 +0200
+++ b/drivers/acpi/asus_acpi.c	2005-09-12 21:37:41.000000000 +0200
@@ -990,9 +990,21 @@
 	else if (bsts_result)
 		printk(KERN_NOTICE "  BSTS called, 0x%02x returned\n", bsts_result);
 
-	/* Samsung P30 has a device with a valid _HID whose INIT does not 
-	 * return anything. Catch this one and any similar here */
-	if (buffer.pointer == NULL) {
+	/* This is unlikely with implicit return */
+	if (buffer.pointer == NULL)
+		return -EINVAL;
+
+	model = (union acpi_object *) buffer.pointer;
+	/*
+	 * Samsung P30 has a device with a valid _HID whose INIT does not 
+	 * return anything. It used to be possible to catch this exception,
+	 * but the implicit return code will now happily confuse the 
+	 * driver. We assume that every ACPI_TYPE_STRING is a valid model
+	 * identifier but it's still possible to get completely bogus data.
+	 */
+	if (model->type == ACPI_TYPE_STRING) {
+		printk(KERN_NOTICE "  %s model detected, ", model->string.pointer);
+	} else {
 		if (asus_info && /* Samsung P30 */
 		    strncmp(asus_info->oem_table_id, "ODEM", 4) == 0) {
 			hotk->model = P30;
@@ -1007,11 +1019,6 @@
 		return AE_OK;
 	}
 	
-	model = (union acpi_object *) buffer.pointer;
-	if (model->type == ACPI_TYPE_STRING) {
-		printk(KERN_NOTICE "  %s model detected, ", model->string.pointer);
-	}
-
 	hotk->model = END_MODEL;
 	if (strncmp(model->string.pointer, "L3D", 3) == 0)
 		hotk->model = L3D;


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. 
Download it for free - -and be entered to win a 42" plasma tv or your very
own Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php