This was a problem I noticed with the 2.4.9 kernel that causes an oops,
which was "glossed over" by calling the acpi_subsystem_status() function
in later kernels.  This will see if the ACPI subsystem even exists,
but doesn't really solve the underlying problem - bm_initialize() can
fail, and if it does it doesn't remove the files it created in /proc.
A couple of other minor cleanups:
1) don't return AE_ERROR instead of a valid error return code to userspace.
2) call bm_terminate() after removing the /proc entries, so that it is not
   possible to open one of these files after the ACPI code has shut down
   (I don't know if this is actually a problem, but just to be safe).
It should apply cleanly to all current kernels.
Cheers, Andreas
======================= acpi-2.4.15-busmgr.diff ============================
diff -ru linux-2.4.15.orig/drivers/acpi/ospm/busmgr/bm_osl.c linux-2.4.15-aed/drivers/acpi/ospm/busmgr/bm_osl.c
--- linux-2.4.15.orig/drivers/acpi/ospm/busmgr/bm_osl.c	Thu Nov 15 13:07:16 2001
+++ linux-2.4.15-aed/drivers/acpi/ospm/busmgr/bm_osl.c	Thu Nov 29 00:03:26 2001
@@ -297,7 +297,7 @@
 int
 bm_osl_init(void)
 {
-	acpi_status		status = AE_OK;
+	acpi_status		status;
 
 	status = acpi_subsystem_status();
 	if (ACPI_FAILURE(status))
@@ -305,7 +305,14 @@
 
 	bm_proc_root = proc_mkdir(BM_PROC_ROOT, NULL);
 	if (!bm_proc_root) {
-		return(AE_ERROR);
+		return(-ENOMEM);
+	}
+
+	status = bm_initialize();
+	if (ACPI_FAILURE(status)) {
+		remove_proc_entry(BM_PROC_ROOT, NULL);
+		bm_proc_root = NULL;
+		return(-ENODEV);
 	}
 
 	bm_proc_event = create_proc_entry(BM_PROC_EVENT, S_IRUSR, bm_proc_root);
@@ -313,9 +320,7 @@
 		bm_proc_event->proc_fops = &proc_event_operations;
 	}
 
-	status = bm_initialize();
-
-	return (ACPI_SUCCESS(status)) ? 0 : -ENODEV;
+	return 0;
 }
 
 
@@ -328,8 +333,6 @@
 void
 bm_osl_cleanup(void)
 {
-	bm_terminate();
-
 	if (bm_proc_event) {
 		remove_proc_entry(BM_PROC_EVENT, bm_proc_root);
 		bm_proc_event = NULL;
@@ -339,6 +342,8 @@
 		remove_proc_entry(BM_PROC_ROOT, NULL);
 		bm_proc_root = NULL;
 	}
+
+	bm_terminate();
 
 	return;
 }
-- Andreas Dilger http://sourceforge.net/projects/ext2resize/ http://www-mddsp.enel.ucalgary.ca/People/adilger/- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/