Re: [PATCH 1/5] ACPI processor: Avoid WARN message on processor driver removal
From: Bjorn Helgaas <bhelgaas@google.com>
Date: 2011-09-12 17:15:05
On Sun, Sep 11, 2011 at 4:42 PM, Thomas Renninger [off-list ref] wrote:
quoted hunk ↗ jump to hunk
Only unregister acpi_idle driver if acpi_idle driver got registered. On latest Nehalem/Sandybridge this is not the case, but the intel_idle driver is used instead. Signed-off-by: Thomas Renninger <redacted> CC: Len Brown <lenb@kernel.org> CC: linux-acpi@vger.kernel.org --- drivers/acpi/processor_driver.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c index a4e0f1b..9247e67 100644 --- a/drivers/acpi/processor_driver.c +++ b/drivers/acpi/processor_driver.c@@ -823,7 +823,8 @@ static int __init acpi_processor_init(void)return 0; out_cpuidle: - cpuidle_unregister_driver(&acpi_idle_driver); + if (cpuidle_get_driver() == &acpi_idle_driver) + cpuidle_unregister_driver(&acpi_idle_driver);
I think this is ugly. I know we already have a similar check for acpi_idle_driver in acpi_processor_add(), and I think that's ugly, too :) The standard register/unregister_driver() model does not require looking at what's currently registered, and I don't think this should be any different. I don't know the mechanism for choosing either acpi_idle_driver or intel_idle_driver, but I think you can accomplish what you want here by just adding a static "acpi_idle_registered" variable to remember whether the cpuidle_register_driver() was successful, and only do the unregister if it was.
quoted hunk ↗ jump to hunk
return result; }@@ -841,7 +842,8 @@ static void __exit acpi_processor_exit(void)acpi_bus_unregister_driver(&acpi_processor_driver); - cpuidle_unregister_driver(&acpi_idle_driver); + if (cpuidle_get_driver() == &acpi_idle_driver) + cpuidle_unregister_driver(&acpi_idle_driver); return; } -- 1.7.6.1 -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
-- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html