aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorRobert Richter <robert.richter@amd.com>2011-10-14 09:46:10 -0400
committerRobert Richter <robert.richter@amd.com>2011-11-04 10:04:35 -0400
commit75c43a20b220f885c39ffa7cdbbb1191e257a9a9 (patch)
treea623847b0235f618438b03785b4860a80e0d4b1b /drivers
parent159a80b2142df709416ab369113de7d511c48331 (diff)
oprofile: Remove exit function for timer mode
Remove exit functions by moving init/exit code to oprofile's setup/ shutdown functions. Doing so the oprofile module exit code will be easier and less error-prone. Signed-off-by: Robert Richter <robert.richter@amd.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/oprofile/oprof.c8
-rw-r--r--drivers/oprofile/timer_int.c30
2 files changed, 17 insertions, 21 deletions
diff --git a/drivers/oprofile/oprof.c b/drivers/oprofile/oprof.c
index f8c752e408a6..f7cd06967aed 100644
--- a/drivers/oprofile/oprof.c
+++ b/drivers/oprofile/oprof.c
@@ -262,9 +262,7 @@ static int __init oprofile_init(void)
262 return 0; 262 return 0;
263 263
264 /* failed */ 264 /* failed */
265 if (timer_mode) 265 if (!timer_mode)
266 oprofile_timer_exit();
267 else
268 oprofile_arch_exit(); 266 oprofile_arch_exit();
269 267
270 return err; 268 return err;
@@ -274,9 +272,7 @@ static int __init oprofile_init(void)
274static void __exit oprofile_exit(void) 272static void __exit oprofile_exit(void)
275{ 273{
276 oprofilefs_unregister(); 274 oprofilefs_unregister();
277 if (timer_mode) 275 if (!timer_mode)
278 oprofile_timer_exit();
279 else
280 oprofile_arch_exit(); 276 oprofile_arch_exit();
281} 277}
282 278
diff --git a/drivers/oprofile/timer_int.c b/drivers/oprofile/timer_int.c
index 878fba126582..93404f72dfa8 100644
--- a/drivers/oprofile/timer_int.c
+++ b/drivers/oprofile/timer_int.c
@@ -97,24 +97,24 @@ static struct notifier_block __refdata oprofile_cpu_notifier = {
97 .notifier_call = oprofile_cpu_notify, 97 .notifier_call = oprofile_cpu_notify,
98}; 98};
99 99
100int oprofile_timer_init(struct oprofile_operations *ops) 100static int oprofile_hrtimer_setup(void)
101{ 101{
102 int rc; 102 return register_hotcpu_notifier(&oprofile_cpu_notifier);
103
104 rc = register_hotcpu_notifier(&oprofile_cpu_notifier);
105 if (rc)
106 return rc;
107 ops->create_files = NULL;
108 ops->setup = NULL;
109 ops->shutdown = NULL;
110 ops->start = oprofile_hrtimer_start;
111 ops->stop = oprofile_hrtimer_stop;
112 ops->cpu_type = "timer";
113 printk(KERN_INFO "oprofile: using timer interrupt.\n");
114 return 0;
115} 103}
116 104
117void oprofile_timer_exit(void) 105static void oprofile_hrtimer_shutdown(void)
118{ 106{
119 unregister_hotcpu_notifier(&oprofile_cpu_notifier); 107 unregister_hotcpu_notifier(&oprofile_cpu_notifier);
120} 108}
109
110int oprofile_timer_init(struct oprofile_operations *ops)
111{
112 ops->create_files = NULL;
113 ops->setup = oprofile_hrtimer_setup;
114 ops->shutdown = oprofile_hrtimer_shutdown;
115 ops->start = oprofile_hrtimer_start;
116 ops->stop = oprofile_hrtimer_stop;
117 ops->cpu_type = "timer";
118 printk(KERN_INFO "oprofile: using timer interrupt.\n");
119 return 0;
120}