diff options
Diffstat (limited to 'drivers/oprofile/oprof.c')
| -rw-r--r-- | drivers/oprofile/oprof.c | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/drivers/oprofile/oprof.c b/drivers/oprofile/oprof.c index f8c752e408a6..ed2c3ec07024 100644 --- a/drivers/oprofile/oprof.c +++ b/drivers/oprofile/oprof.c | |||
| @@ -246,37 +246,31 @@ static int __init oprofile_init(void) | |||
| 246 | int err; | 246 | int err; |
| 247 | 247 | ||
| 248 | /* always init architecture to setup backtrace support */ | 248 | /* always init architecture to setup backtrace support */ |
| 249 | timer_mode = 0; | ||
| 249 | err = oprofile_arch_init(&oprofile_ops); | 250 | err = oprofile_arch_init(&oprofile_ops); |
| 251 | if (!err) { | ||
| 252 | if (!timer && !oprofilefs_register()) | ||
| 253 | return 0; | ||
| 254 | oprofile_arch_exit(); | ||
| 255 | } | ||
| 250 | 256 | ||
| 251 | timer_mode = err || timer; /* fall back to timer mode on errors */ | 257 | /* setup timer mode: */ |
| 252 | if (timer_mode) { | 258 | timer_mode = 1; |
| 253 | if (!err) | 259 | /* no nmi timer mode if oprofile.timer is set */ |
| 254 | oprofile_arch_exit(); | 260 | if (timer || op_nmi_timer_init(&oprofile_ops)) { |
| 255 | err = oprofile_timer_init(&oprofile_ops); | 261 | err = oprofile_timer_init(&oprofile_ops); |
| 256 | if (err) | 262 | if (err) |
| 257 | return err; | 263 | return err; |
| 258 | } | 264 | } |
| 259 | 265 | ||
| 260 | err = oprofilefs_register(); | 266 | return oprofilefs_register(); |
| 261 | if (!err) | ||
| 262 | return 0; | ||
| 263 | |||
| 264 | /* failed */ | ||
| 265 | if (timer_mode) | ||
| 266 | oprofile_timer_exit(); | ||
| 267 | else | ||
| 268 | oprofile_arch_exit(); | ||
| 269 | |||
| 270 | return err; | ||
| 271 | } | 267 | } |
| 272 | 268 | ||
| 273 | 269 | ||
| 274 | static void __exit oprofile_exit(void) | 270 | static void __exit oprofile_exit(void) |
| 275 | { | 271 | { |
| 276 | oprofilefs_unregister(); | 272 | oprofilefs_unregister(); |
| 277 | if (timer_mode) | 273 | if (!timer_mode) |
| 278 | oprofile_timer_exit(); | ||
| 279 | else | ||
| 280 | oprofile_arch_exit(); | 274 | oprofile_arch_exit(); |
| 281 | } | 275 | } |
| 282 | 276 | ||
