Skip to contentSkip to conversation

IBM-ACPI broken in 2.6.10

DISCUSSION Matthew Garrett 2 participants 2 messages Jan 14, 2005 – Jan 15, 2005 ACPI

lore
Share & tools
lore
#0 lore raw

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.

Signature · 1 line
Matthew Garrett | [email protected]
#1 lore raw
Quoted 5 lines

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.

drivers/acpi/ibm_acpi.c renamed from drivers/acpi/ibm_acpi.c.orig +14 -10
@@ -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;