public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Karol Kozimor <sziwan-DETuoxkZsSqrDJvtcaxF/A@public.gmane.org>
Cc: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: asus_acpi bugs
Date: Mon, 12 Sep 2005 22:15:45 +0200	[thread overview]
Message-ID: <20050912201545.GB3320@hell.org.pl> (raw)
In-Reply-To: <F7DC2337C7631D4386A2DF6E8FB22B30047FA08F-N2PTB0HCzHKkrb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>

Thus wrote Brown, Len:
> >> 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.

-- 
Karol 'sziwan' Kozimor
sziwan-DETuoxkZsSqrDJvtcaxF/A@public.gmane.org

Signed-off-by: Karol Kozimor <sziwan-DETuoxkZsSqrDJvtcaxF/A@public.gmane.org>

--- 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

       reply	other threads:[~2005-09-12 20:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <F7DC2337C7631D4386A2DF6E8FB22B30047FA08F@hdsmsx401.amr.corp.intel.com>
     [not found] ` <F7DC2337C7631D4386A2DF6E8FB22B30047FA08F-N2PTB0HCzHKkrb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2005-09-12 20:15   ` Karol Kozimor [this message]
     [not found] ` <20050912201443.GA3320@hell.org.pl>
     [not found]   ` <20050912201443.GA3320-DETuoxkZsSqrDJvtcaxF/A@public.gmane.org>
2005-09-14  8:13     ` [PATCH] Fix regression on Samsung P30 [was: Re: asus_acpi bugs] Karol Kozimor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050912201545.GB3320@hell.org.pl \
    --to=sziwan-detuoxkzssqrdjvtcaxf/a@public.gmane.org \
    --cc=acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox