diff options
Diffstat (limited to 'drivers/hwtracing/stm/heartbeat.c')
-rw-r--r-- | drivers/hwtracing/stm/heartbeat.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/drivers/hwtracing/stm/heartbeat.c b/drivers/hwtracing/stm/heartbeat.c index 0133571b506f..3da7b673aab2 100644 --- a/drivers/hwtracing/stm/heartbeat.c +++ b/drivers/hwtracing/stm/heartbeat.c | |||
@@ -26,7 +26,7 @@ | |||
26 | static int nr_devs = 4; | 26 | static int nr_devs = 4; |
27 | static int interval_ms = 10; | 27 | static int interval_ms = 10; |
28 | 28 | ||
29 | module_param(nr_devs, int, 0600); | 29 | module_param(nr_devs, int, 0400); |
30 | module_param(interval_ms, int, 0600); | 30 | module_param(interval_ms, int, 0600); |
31 | 31 | ||
32 | static struct stm_heartbeat { | 32 | static struct stm_heartbeat { |
@@ -35,8 +35,6 @@ static struct stm_heartbeat { | |||
35 | unsigned int active; | 35 | unsigned int active; |
36 | } stm_heartbeat[STM_HEARTBEAT_MAX]; | 36 | } stm_heartbeat[STM_HEARTBEAT_MAX]; |
37 | 37 | ||
38 | static unsigned int nr_instances; | ||
39 | |||
40 | static const char str[] = "heartbeat stm source driver is here to serve you"; | 38 | static const char str[] = "heartbeat stm source driver is here to serve you"; |
41 | 39 | ||
42 | static enum hrtimer_restart stm_heartbeat_hrtimer_handler(struct hrtimer *hr) | 40 | static enum hrtimer_restart stm_heartbeat_hrtimer_handler(struct hrtimer *hr) |
@@ -74,12 +72,12 @@ static void stm_heartbeat_unlink(struct stm_source_data *data) | |||
74 | 72 | ||
75 | static int stm_heartbeat_init(void) | 73 | static int stm_heartbeat_init(void) |
76 | { | 74 | { |
77 | int i, ret = -ENOMEM, __nr_instances = ACCESS_ONCE(nr_devs); | 75 | int i, ret = -ENOMEM; |
78 | 76 | ||
79 | if (__nr_instances < 0 || __nr_instances > STM_HEARTBEAT_MAX) | 77 | if (nr_devs < 0 || nr_devs > STM_HEARTBEAT_MAX) |
80 | return -EINVAL; | 78 | return -EINVAL; |
81 | 79 | ||
82 | for (i = 0; i < __nr_instances; i++) { | 80 | for (i = 0; i < nr_devs; i++) { |
83 | stm_heartbeat[i].data.name = | 81 | stm_heartbeat[i].data.name = |
84 | kasprintf(GFP_KERNEL, "heartbeat.%d", i); | 82 | kasprintf(GFP_KERNEL, "heartbeat.%d", i); |
85 | if (!stm_heartbeat[i].data.name) | 83 | if (!stm_heartbeat[i].data.name) |
@@ -98,8 +96,6 @@ static int stm_heartbeat_init(void) | |||
98 | goto fail_free; | 96 | goto fail_free; |
99 | } | 97 | } |
100 | 98 | ||
101 | nr_instances = __nr_instances; | ||
102 | |||
103 | return 0; | 99 | return 0; |
104 | 100 | ||
105 | fail_unregister: | 101 | fail_unregister: |
@@ -116,7 +112,7 @@ static void stm_heartbeat_exit(void) | |||
116 | { | 112 | { |
117 | int i; | 113 | int i; |
118 | 114 | ||
119 | for (i = 0; i < nr_instances; i++) { | 115 | for (i = 0; i < nr_devs; i++) { |
120 | stm_source_unregister_device(&stm_heartbeat[i].data); | 116 | stm_source_unregister_device(&stm_heartbeat[i].data); |
121 | kfree(stm_heartbeat[i].data.name); | 117 | kfree(stm_heartbeat[i].data.name); |
122 | } | 118 | } |