# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2004/04/28 01:40:17-04:00 len.brown@intel.com 
#   [ACPI] support button driver unload (Luming Yu)
#   http://bugzilla.kernel.org/show_bug.cgi?id=2281
# 
# drivers/acpi/button.c
#   2004/04/28 01:39:27-04:00 len.brown@intel.com +8 -0
#   support button driver unload
# 
# drivers/acpi/bus.c
#   2004/04/28 01:39:27-04:00 len.brown@intel.com +8 -2
#   support button driver unload
# 
diff -Nru a/drivers/acpi/bus.c b/drivers/acpi/bus.c
--- a/drivers/acpi/bus.c	Wed Apr 28 01:40:20 2004
+++ b/drivers/acpi/bus.c	Wed Apr 28 01:40:20 2004
@@ -1769,6 +1769,9 @@
 }
 
 
+extern struct acpi_device *fixed_pwr_button;
+extern struct acpi_device *fixed_sleep_button;
+
 static int
 acpi_bus_scan_fixed (
 	struct acpi_device	*root)
@@ -1778,6 +1781,9 @@
 
 	ACPI_FUNCTION_TRACE("acpi_bus_scan_fixed");
 
+	fixed_pwr_button = NULL;
+	fixed_sleep_button = NULL;
+
 	if (!root)
 		return_VALUE(-ENODEV);
 
@@ -1785,11 +1791,11 @@
 	 * Enumerate all fixed-feature devices.
 	 */
 	if (acpi_fadt.pwr_button == 0)
-		result = acpi_bus_add(&device, acpi_root, 
+		result = acpi_bus_add(&fixed_pwr_button, acpi_root, 
 			NULL, ACPI_BUS_TYPE_POWER_BUTTON);
 
 	if (acpi_fadt.sleep_button == 0)
-		result = acpi_bus_add(&device, acpi_root, 
+		result = acpi_bus_add(&fixed_sleep_button, acpi_root, 
 			NULL, ACPI_BUS_TYPE_SLEEP_BUTTON);
 
 	return_VALUE(result);
diff -Nru a/drivers/acpi/button.c b/drivers/acpi/button.c
--- a/drivers/acpi/button.c	Wed Apr 28 01:40:20 2004
+++ b/drivers/acpi/button.c	Wed Apr 28 01:40:20 2004
@@ -69,6 +69,8 @@
    -------------------------------------------------------------------------- */
 
 static struct proc_dir_entry	*acpi_button_dir;
+struct acpi_device 	*fixed_pwr_button;
+struct acpi_device	*fixed_sleep_button;
 
 static int
 acpi_button_read_info (
@@ -485,6 +487,12 @@
 acpi_button_exit (void)
 {
 	ACPI_FUNCTION_TRACE("acpi_button_exit");
+
+	if(fixed_pwr_button) 
+		acpi_button_remove(fixed_pwr_button, ACPI_BUS_TYPE_POWER_BUTTON);
+
+	if(fixed_sleep_button)
+		acpi_button_remove(fixed_sleep_button, ACPI_BUS_TYPE_SLEEP_BUTTON);
 
 	acpi_bus_unregister_driver(&acpi_button_driver);