Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+17 -21
+2 -6
drivers/oprofile/oprof.c
··· 262 262 return 0; 263 263 264 264 /* failed */ 265 - if (timer_mode) 266 - oprofile_timer_exit(); 267 - else 265 + if (!timer_mode) 268 266 oprofile_arch_exit(); 269 267 270 268 return err; ··· 272 274 static void __exit oprofile_exit(void) 273 275 { 274 276 oprofilefs_unregister(); 275 - if (timer_mode) 276 - oprofile_timer_exit(); 277 - else 277 + if (!timer_mode) 278 278 oprofile_arch_exit(); 279 279 } 280 280
+15 -15
drivers/oprofile/timer_int.c
··· 97 97 .notifier_call = oprofile_cpu_notify, 98 98 }; 99 99 100 - int oprofile_timer_init(struct oprofile_operations *ops) 100 + static int oprofile_hrtimer_setup(void) 101 101 { 102 - int rc; 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; 102 + return register_hotcpu_notifier(&oprofile_cpu_notifier); 115 103 } 116 104 117 - void oprofile_timer_exit(void) 105 + static void oprofile_hrtimer_shutdown(void) 118 106 { 119 107 unregister_hotcpu_notifier(&oprofile_cpu_notifier); 108 + } 109 + 110 + int 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 120 }