aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/oprofile/oprof.c
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2012-02-17 18:12:36 -0500
committerTony Lindgren <tony@atomide.com>2012-02-17 18:12:36 -0500
commit4d68c05ce11f4cdf6a6392f3a18dc6a985b4d0c4 (patch)
tree72e500b97c4bdcb9631209f3121f42b05ae30fea /drivers/oprofile/oprof.c
parent40c0591f0a349ec074357e05c6ab1a3bc951807c (diff)
parent19bfb76ca32f8e4fa80746608ff4a77707f40520 (diff)
Merge branch 'for_3.4/dt_base' of git://git.kernel.org/pub/scm/linux/kernel/git/bcousson/linux-omap-dt into dt
Diffstat (limited to 'drivers/oprofile/oprof.c')
-rw-r--r--drivers/oprofile/oprof.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/drivers/oprofile/oprof.c b/drivers/oprofile/oprof.c
index dccd8636095c..ed2c3ec07024 100644
--- a/drivers/oprofile/oprof.c
+++ b/drivers/oprofile/oprof.c
@@ -239,26 +239,39 @@ int oprofile_set_ulong(unsigned long *addr, unsigned long val)
239 return err; 239 return err;
240} 240}
241 241
242static int timer_mode;
243
242static int __init oprofile_init(void) 244static int __init oprofile_init(void)
243{ 245{
244 int err; 246 int err;
245 247
248 /* always init architecture to setup backtrace support */
249 timer_mode = 0;
246 err = oprofile_arch_init(&oprofile_ops); 250 err = oprofile_arch_init(&oprofile_ops);
247 if (err < 0 || timer) { 251 if (!err) {
248 printk(KERN_INFO "oprofile: using timer interrupt.\n"); 252 if (!timer && !oprofilefs_register())
253 return 0;
254 oprofile_arch_exit();
255 }
256
257 /* setup timer mode: */
258 timer_mode = 1;
259 /* no nmi timer mode if oprofile.timer is set */
260 if (timer || op_nmi_timer_init(&oprofile_ops)) {
249 err = oprofile_timer_init(&oprofile_ops); 261 err = oprofile_timer_init(&oprofile_ops);
250 if (err) 262 if (err)
251 return err; 263 return err;
252 } 264 }
265
253 return oprofilefs_register(); 266 return oprofilefs_register();
254} 267}
255 268
256 269
257static void __exit oprofile_exit(void) 270static void __exit oprofile_exit(void)
258{ 271{
259 oprofile_timer_exit();
260 oprofilefs_unregister(); 272 oprofilefs_unregister();
261 oprofile_arch_exit(); 273 if (!timer_mode)
274 oprofile_arch_exit();
262} 275}
263 276
264 277