intel_idle: Clean up all registered devices on exit.
authorRichard Cochran <rcochran@linutronix.de>
Wed, 6 Apr 2016 21:00:57 +0000 (17:00 -0400)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 7 Apr 2016 20:11:05 +0000 (22:11 +0200)
This driver registers cpuidle devices when a CPU comes online, but it
leaves the registrations in place when a CPU goes offline.  The module
exit code only unregisters the currently online CPUs, leaving the
devices for offline CPUs dangling.

This patch changes the driver to clean up all registrations on exit,
even those from CPUs that are offline.

Signed-off-by: Richard Cochran <rcochran@linutronix.de>
Signed-off-by: Len Brown <len.brown@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/idle/intel_idle.c

index 8420ba10a4348deaf006f4101aef6288b3b96fbe..862346bd053a69da2387e6e36166628e640bb8ca 100644 (file)
@@ -1245,12 +1245,19 @@ static int __init intel_idle_init(void)
 
 static void __exit intel_idle_exit(void)
 {
+       struct cpuidle_device *dev;
+       int i;
+
        cpu_notifier_register_begin();
 
        if (lapic_timer_reliable_states != LAPIC_TIMER_ALWAYS_RELIABLE)
                on_each_cpu(__setup_broadcast_timer, (void *)false, 1);
        __unregister_cpu_notifier(&cpu_hotplug_notifier);
-       intel_idle_cpuidle_devices_uninit();
+
+       for_each_possible_cpu(i) {
+               dev = per_cpu_ptr(intel_idle_cpuidle_devices, i);
+               cpuidle_unregister_device(dev);
+       }
 
        cpu_notifier_register_done();