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>
This commit is contained in:
parent
159a80b214
commit
75c43a20b2
2 changed files with 17 additions and 21 deletions
|
@ -262,9 +262,7 @@ static int __init oprofile_init(void)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* failed */
|
/* failed */
|
||||||
if (timer_mode)
|
if (!timer_mode)
|
||||||
oprofile_timer_exit();
|
|
||||||
else
|
|
||||||
oprofile_arch_exit();
|
oprofile_arch_exit();
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
|
@ -274,9 +272,7 @@ static int __init oprofile_init(void)
|
||||||
static void __exit oprofile_exit(void)
|
static void __exit oprofile_exit(void)
|
||||||
{
|
{
|
||||||
oprofilefs_unregister();
|
oprofilefs_unregister();
|
||||||
if (timer_mode)
|
if (!timer_mode)
|
||||||
oprofile_timer_exit();
|
|
||||||
else
|
|
||||||
oprofile_arch_exit();
|
oprofile_arch_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,24 +97,24 @@ static struct notifier_block __refdata oprofile_cpu_notifier = {
|
||||||
.notifier_call = oprofile_cpu_notify,
|
.notifier_call = oprofile_cpu_notify,
|
||||||
};
|
};
|
||||||
|
|
||||||
int oprofile_timer_init(struct oprofile_operations *ops)
|
static int oprofile_hrtimer_setup(void)
|
||||||
{
|
{
|
||||||
int rc;
|
return register_hotcpu_notifier(&oprofile_cpu_notifier);
|
||||||
|
|
||||||
rc = register_hotcpu_notifier(&oprofile_cpu_notifier);
|
|
||||||
if (rc)
|
|
||||||
return rc;
|
|
||||||
ops->create_files = NULL;
|
|
||||||
ops->setup = NULL;
|
|
||||||
ops->shutdown = NULL;
|
|
||||||
ops->start = oprofile_hrtimer_start;
|
|
||||||
ops->stop = oprofile_hrtimer_stop;
|
|
||||||
ops->cpu_type = "timer";
|
|
||||||
printk(KERN_INFO "oprofile: using timer interrupt.\n");
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void oprofile_timer_exit(void)
|
static void oprofile_hrtimer_shutdown(void)
|
||||||
{
|
{
|
||||||
unregister_hotcpu_notifier(&oprofile_cpu_notifier);
|
unregister_hotcpu_notifier(&oprofile_cpu_notifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int oprofile_timer_init(struct oprofile_operations *ops)
|
||||||
|
{
|
||||||
|
ops->create_files = NULL;
|
||||||
|
ops->setup = oprofile_hrtimer_setup;
|
||||||
|
ops->shutdown = oprofile_hrtimer_shutdown;
|
||||||
|
ops->start = oprofile_hrtimer_start;
|
||||||
|
ops->stop = oprofile_hrtimer_stop;
|
||||||
|
ops->cpu_type = "timer";
|
||||||
|
printk(KERN_INFO "oprofile: using timer interrupt.\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue