Exit ACPI processor module gracefully if acpi is disabled

Description: processor module might oops when machine is booted without
acpi support and the module gets rmmodded.
Module must still be loadable to provide cpufreq functionality even
without acpi.
Reference - http://bugzilla.novell.com/show_bug.cgi?id=165803

Signed-off-by: Thomas Renninger <[EMAIL PROTECTED]>

 drivers/acpi/processor_core.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

Index: linux-2.6.18-rc2/drivers/acpi/processor_core.c
===================================================================
--- linux-2.6.18-rc2.orig/drivers/acpi/processor_core.c
+++ linux-2.6.18-rc2/drivers/acpi/processor_core.c
@@ -891,6 +891,8 @@ void acpi_processor_uninstall_hotplug_no
  * ACPI, but needs symbols from this driver
  */
 
+static int processor_driver_registered = 0;
+
 static int __init acpi_processor_init(void)
 {
        int result = 0;
@@ -909,6 +911,7 @@ static int __init acpi_processor_init(vo
                remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir);
                return 0;
        }
+       processor_driver_registered = 1;
 
        acpi_processor_install_hotplug_notify();
 
@@ -926,11 +929,11 @@ static void __exit acpi_processor_exit(v
 
        acpi_thermal_cpufreq_exit();
 
-       acpi_processor_uninstall_hotplug_notify();
-
-       acpi_bus_unregister_driver(&acpi_processor_driver);
-
-       remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir);
+       if (processor_driver_registered){
+               acpi_processor_uninstall_hotplug_notify();
+               acpi_bus_unregister_driver(&acpi_processor_driver);
+               remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir);
+       }
 
        return;
 }

Exit ACPI processor module gracefully if acpi is disabled

Description: processor module might oops when machine is booted without
acpi support and the module gets rmmodded.
Module must still be loadable to provide cpufreq functionality even
without acpi.
Reference - http://bugzilla.novell.com/show_bug.cgi?id=165803

Signed-off-by: Thomas Renninger <[EMAIL PROTECTED]>

 drivers/acpi/processor_core.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

Index: linux-2.6.18-rc2/drivers/acpi/processor_core.c
===================================================================
--- linux-2.6.18-rc2.orig/drivers/acpi/processor_core.c
+++ linux-2.6.18-rc2/drivers/acpi/processor_core.c
@@ -891,6 +891,8 @@ void acpi_processor_uninstall_hotplug_no
  * ACPI, but needs symbols from this driver
  */
 
+static int processor_driver_registered = 0;
+
 static int __init acpi_processor_init(void)
 {
 	int result = 0;
@@ -909,6 +911,7 @@ static int __init acpi_processor_init(vo
 		remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir);
 		return 0;
 	}
+	processor_driver_registered = 1;
 
 	acpi_processor_install_hotplug_notify();
 
@@ -926,11 +929,11 @@ static void __exit acpi_processor_exit(v
 
 	acpi_thermal_cpufreq_exit();
 
-	acpi_processor_uninstall_hotplug_notify();
-
-	acpi_bus_unregister_driver(&acpi_processor_driver);
-
-	remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir);
+	if (processor_driver_registered){
+		acpi_processor_uninstall_hotplug_notify();
+		acpi_bus_unregister_driver(&acpi_processor_driver);
+		remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir);
+	}
 
 	return;
 }

Reply via email to