mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* IBM-ACPI broken in 2.6.10
@ 2005-01-14 23:20 Matthew Garrett
  2005-01-15 15:55 ` [PATCH] " Jim Radford
  0 siblings, 1 reply; 2+ messages in thread
From: Matthew Garrett @ 2005-01-14 23:20 UTC (permalink / raw)
  To: linux-kernel

The ibm-acpi module included in 2.6.10 doesn't appear to parse
parameters correctly. This seems to be due to a patch from Rusty Russell
[1] which attempted to fix up the parameter parsing. Unfortunately, it
seems that the parameters have to be parsed /after/ module_init has been
called, as otherwise the parsing code calls acpi functions that fail. If
the init function is called first, everything works as it should do. (I
haven't actually looked closely enough at the driver to work out what
it's doing, but...)

What's the right way of fixing this?

[1] http://lkml.org/lkml/2004/11/28/164 - without this, everything
works. With it, parameter setting fails.
-- 
Matthew Garrett | mjg59@srcf.ucam.org


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

* [PATCH] Re: IBM-ACPI broken in 2.6.10
  2005-01-14 23:20 IBM-ACPI broken in 2.6.10 Matthew Garrett
@ 2005-01-15 15:55 ` Jim Radford
  0 siblings, 0 replies; 2+ messages in thread
From: Jim Radford @ 2005-01-15 15:55 UTC (permalink / raw)
  To: Matthew Garrett; +Cc: linux-kernel

> The ibm-acpi module included in 2.6.10 doesn't appear to parse
> parameters correctly.  This seems to be due to a patch from Rusty
> Russell [1] which attempted to fix up the parameter parsing.

> What's the right way of fixing this?

I'm not sure about the "right" way, but this is what I came up with.
I sent a copy of this patch to Borislav Deianov a few weeks ago with
no resposne.  Maybe someone else will pick it up.

With this fix "insmod ibm_acpi light=on" works for me again.

-Jim

Module params don't work for me with 2.6.10 because the callbacks get
called before ibm_acpi_init so that the acpi_handle's are still NULL.

Here's a patch to force the param callbacks to be called after the
module is inited so that cmos_handle et al will be defined.

Signed-Off-By: Jim Radford <radford@blackbean.org>

--- linux-2.6.10/drivers/acpi/ibm_acpi.c.orig	2004-12-25 09:33:48.000000000 -0800
+++ linux-2.6.10/drivers/acpi/ibm_acpi.c	2004-12-26 14:17:16.000000000 -0800
@@ -153,6 +153,8 @@
 	} state;
 
 	int experimental;
+
+	const char *param;
 };
 
 struct proc_dir_entry *proc_dir = NULL;
@@ -1150,17 +1152,11 @@
 static int set_ibm_param(const char *val, struct kernel_param *kp)
 {
 	unsigned int i;
-	char arg_with_comma[32];
-
-	if (strlen(val) > 30)
-		return -ENOSPC;
-
-	strcpy(arg_with_comma, val);
-	strcat(arg_with_comma, ",");
-
 	for (i=0; i<NUM_IBMS; i++)
-		if (strcmp(ibms[i].name, kp->name) == 0)
-			return ibms[i].write(&ibms[i], arg_with_comma);
+		if (strcmp(ibms[i].name, kp->name) == 0) {
+			ibms[i].param = val;
+			return 0;
+		}
 	BUG();
 	return -EINVAL;
 }
@@ -1215,6 +1211,14 @@
 	
 	for (i=0; i<NUM_IBMS; i++) {
 		ret = ibm_init(&ibms[i]);
+		if (ret >= 0 && ibms[i].param) {
+			char arg_with_comma[32];
+			if (strlen(ibms[i].param) > sizeof(arg_with_comma)-2)
+				return -ENOSPC;
+			strcpy(arg_with_comma, ibms[i].param);
+			strcat(arg_with_comma, ",");
+			ret = ibms[i].write(&ibms[i], arg_with_comma);
+		}
 		if (ret < 0) {
 			acpi_ibm_exit();
 			return ret;





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

end of thread, other threads:[~2005-01-15 15:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-14 23:20 IBM-ACPI broken in 2.6.10 Matthew Garrett
2005-01-15 15:55 ` [PATCH] " Jim Radford

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

Powered by JetHome