]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.4.13/cpuidle-indicate-when-a-device-has-been-unregistered.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.4.13 / cpuidle-indicate-when-a-device-has-been-unregistered.patch
1 From c998c07836f985b24361629dc98506ec7893e7a0 Mon Sep 17 00:00:00 2001
2 From: Dave Gerlach <d-gerlach@ti.com>
3 Date: Tue, 5 Apr 2016 14:05:38 -0500
4 Subject: cpuidle: Indicate when a device has been unregistered
5
6 From: Dave Gerlach <d-gerlach@ti.com>
7
8 commit c998c07836f985b24361629dc98506ec7893e7a0 upstream.
9
10 Currently the 'registered' member of the cpuidle_device struct is set
11 to 1 during cpuidle_register_device. In this same function there are
12 checks to see if the device is already registered to prevent duplicate
13 calls to register the device, but this value is never set to 0 even on
14 unregister of the device. Because of this, any attempt to call
15 cpuidle_register_device after a call to cpuidle_unregister_device will
16 fail which shouldn't be the case.
17
18 To prevent this, set registered to 0 when the device is unregistered.
19
20 Fixes: c878a52d3c7c (cpuidle: Check if device is already registered)
21 Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
22 Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
23 Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
24 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
25
26 ---
27 drivers/cpuidle/cpuidle.c | 2 ++
28 1 file changed, 2 insertions(+)
29
30 --- a/drivers/cpuidle/cpuidle.c
31 +++ b/drivers/cpuidle/cpuidle.c
32 @@ -433,6 +433,8 @@ static void __cpuidle_unregister_device(
33 list_del(&dev->device_list);
34 per_cpu(cpuidle_devices, dev->cpu) = NULL;
35 module_put(drv->owner);
36 +
37 + dev->registered = 0;
38 }
39
40 static void __cpuidle_device_init(struct cpuidle_device *dev)