Commit ca6b9547 authored by Pekka Enberg's avatar Pekka Enberg Committed by Linus Torvalds

[PATCH] oprofile: minor cleanups

This patch has the following cleanups to oprofile:

  - Remove spurious casts
  - vfree() accepts NULL pointers so remove redundant test
  - The parameter for __free_cpu_buffer() is not used so merge the function
    with free_cpu_buffer()
Signed-off-by: default avatarPekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 86027b84
...@@ -46,7 +46,7 @@ void process_task_mortuary(void); ...@@ -46,7 +46,7 @@ void process_task_mortuary(void);
*/ */
static int task_free_notify(struct notifier_block * self, unsigned long val, void * data) static int task_free_notify(struct notifier_block * self, unsigned long val, void * data)
{ {
struct task_struct * task = (struct task_struct *)data; struct task_struct * task = data;
spin_lock(&task_mortuary); spin_lock(&task_mortuary);
list_add(&task->tasks, &dying_tasks); list_add(&task->tasks, &dying_tasks);
spin_unlock(&task_mortuary); spin_unlock(&task_mortuary);
......
...@@ -34,13 +34,12 @@ static void wq_sync_buffer(void *); ...@@ -34,13 +34,12 @@ static void wq_sync_buffer(void *);
#define DEFAULT_TIMER_EXPIRE (HZ / 10) #define DEFAULT_TIMER_EXPIRE (HZ / 10)
int work_enabled; int work_enabled;
static void __free_cpu_buffers(int num) void free_cpu_buffers(void)
{ {
int i; int i;
for_each_online_cpu(i) { for_each_online_cpu(i) {
if (cpu_buffer[i].buffer) vfree(cpu_buffer[i].buffer);
vfree(cpu_buffer[i].buffer);
} }
} }
...@@ -72,17 +71,11 @@ int alloc_cpu_buffers(void) ...@@ -72,17 +71,11 @@ int alloc_cpu_buffers(void)
return 0; return 0;
fail: fail:
__free_cpu_buffers(i); free_cpu_buffers();
return -ENOMEM; return -ENOMEM;
} }
void free_cpu_buffers(void)
{
__free_cpu_buffers(NR_CPUS);
}
void start_cpu_work(void) void start_cpu_work(void)
{ {
int i; int i;
...@@ -301,7 +294,7 @@ void oprofile_add_trace(unsigned long pc) ...@@ -301,7 +294,7 @@ void oprofile_add_trace(unsigned long pc)
*/ */
static void wq_sync_buffer(void * data) static void wq_sync_buffer(void * data)
{ {
struct oprofile_cpu_buffer * b = (struct oprofile_cpu_buffer *)data; struct oprofile_cpu_buffer * b = data;
if (b->cpu != smp_processor_id()) { if (b->cpu != smp_processor_id()) {
printk("WQ on CPU%d, prefer CPU%d\n", printk("WQ on CPU%d, prefer CPU%d\n",
smp_processor_id(), b->cpu); smp_processor_id(), b->cpu);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment