@@ -52,7 +52,7 @@ static DEFINE_PER_CPU(int, cpu_profile_flip);
5252static DEFINE_MUTEX (profile_flip_mutex );
5353#endif /* CONFIG_SMP */
5454
55- static int __init profile_setup (char * str )
55+ static int __init profile_setup (char * str )
5656{
5757 static char __initdata schedstr [] = "schedule" ;
5858 static char __initdata sleepstr [] = "sleep" ;
@@ -104,28 +104,28 @@ __setup("profile=", profile_setup);
104104
105105void __init profile_init (void )
106106{
107- if (!prof_on )
107+ if (!prof_on )
108108 return ;
109-
109+
110110 /* only text is profiled */
111111 prof_len = (_etext - _stext ) >> prof_shift ;
112112 prof_buffer = alloc_bootmem (prof_len * sizeof (atomic_t ));
113113}
114114
115115/* Profile event notifications */
116-
116+
117117#ifdef CONFIG_PROFILING
118-
118+
119119static BLOCKING_NOTIFIER_HEAD (task_exit_notifier );
120120static ATOMIC_NOTIFIER_HEAD (task_free_notifier );
121121static BLOCKING_NOTIFIER_HEAD (munmap_notifier );
122-
123- void profile_task_exit (struct task_struct * task )
122+
123+ void profile_task_exit (struct task_struct * task )
124124{
125125 blocking_notifier_call_chain (& task_exit_notifier , 0 , task );
126126}
127-
128- int profile_handoff_task (struct task_struct * task )
127+
128+ int profile_handoff_task (struct task_struct * task )
129129{
130130 int ret ;
131131 ret = atomic_notifier_call_chain (& task_free_notifier , 0 , task );
@@ -137,52 +137,55 @@ void profile_munmap(unsigned long addr)
137137 blocking_notifier_call_chain (& munmap_notifier , 0 , (void * )addr );
138138}
139139
140- int task_handoff_register (struct notifier_block * n )
140+ int task_handoff_register (struct notifier_block * n )
141141{
142142 return atomic_notifier_chain_register (& task_free_notifier , n );
143143}
144+ EXPORT_SYMBOL_GPL (task_handoff_register );
144145
145- int task_handoff_unregister (struct notifier_block * n )
146+ int task_handoff_unregister (struct notifier_block * n )
146147{
147148 return atomic_notifier_chain_unregister (& task_free_notifier , n );
148149}
150+ EXPORT_SYMBOL_GPL (task_handoff_unregister );
149151
150- int profile_event_register (enum profile_type type , struct notifier_block * n )
152+ int profile_event_register (enum profile_type type , struct notifier_block * n )
151153{
152154 int err = - EINVAL ;
153-
155+
154156 switch (type ) {
155- case PROFILE_TASK_EXIT :
156- err = blocking_notifier_chain_register (
157- & task_exit_notifier , n );
158- break ;
159- case PROFILE_MUNMAP :
160- err = blocking_notifier_chain_register (
161- & munmap_notifier , n );
162- break ;
157+ case PROFILE_TASK_EXIT :
158+ err = blocking_notifier_chain_register (
159+ & task_exit_notifier , n );
160+ break ;
161+ case PROFILE_MUNMAP :
162+ err = blocking_notifier_chain_register (
163+ & munmap_notifier , n );
164+ break ;
163165 }
164-
166+
165167 return err ;
166168}
169+ EXPORT_SYMBOL_GPL (profile_event_register );
167170
168-
169- int profile_event_unregister (enum profile_type type , struct notifier_block * n )
171+ int profile_event_unregister (enum profile_type type , struct notifier_block * n )
170172{
171173 int err = - EINVAL ;
172-
174+
173175 switch (type ) {
174- case PROFILE_TASK_EXIT :
175- err = blocking_notifier_chain_unregister (
176- & task_exit_notifier , n );
177- break ;
178- case PROFILE_MUNMAP :
179- err = blocking_notifier_chain_unregister (
180- & munmap_notifier , n );
181- break ;
176+ case PROFILE_TASK_EXIT :
177+ err = blocking_notifier_chain_unregister (
178+ & task_exit_notifier , n );
179+ break ;
180+ case PROFILE_MUNMAP :
181+ err = blocking_notifier_chain_unregister (
182+ & munmap_notifier , n );
183+ break ;
182184 }
183185
184186 return err ;
185187}
188+ EXPORT_SYMBOL_GPL (profile_event_unregister );
186189
187190int register_timer_hook (int (* hook )(struct pt_regs * ))
188191{
@@ -191,6 +194,7 @@ int register_timer_hook(int (*hook)(struct pt_regs *))
191194 timer_hook = hook ;
192195 return 0 ;
193196}
197+ EXPORT_SYMBOL_GPL (register_timer_hook );
194198
195199void unregister_timer_hook (int (* hook )(struct pt_regs * ))
196200{
@@ -199,13 +203,7 @@ void unregister_timer_hook(int (*hook)(struct pt_regs *))
199203 /* make sure all CPUs see the NULL hook */
200204 synchronize_sched (); /* Allow ongoing interrupts to complete. */
201205}
202-
203- EXPORT_SYMBOL_GPL (register_timer_hook );
204206EXPORT_SYMBOL_GPL (unregister_timer_hook );
205- EXPORT_SYMBOL_GPL (task_handoff_register );
206- EXPORT_SYMBOL_GPL (task_handoff_unregister );
207- EXPORT_SYMBOL_GPL (profile_event_register );
208- EXPORT_SYMBOL_GPL (profile_event_unregister );
209207
210208#endif /* CONFIG_PROFILING */
211209
@@ -366,7 +364,7 @@ static int __devinit profile_cpu_callback(struct notifier_block *info,
366364 per_cpu (cpu_profile_hits , cpu )[0 ] = page_address (page );
367365 }
368366 break ;
369- out_free :
367+ out_free :
370368 page = virt_to_page (per_cpu (cpu_profile_hits , cpu )[1 ]);
371369 per_cpu (cpu_profile_hits , cpu )[1 ] = NULL ;
372370 __free_page (page );
@@ -409,7 +407,6 @@ void profile_hits(int type, void *__pc, unsigned int nr_hits)
409407 atomic_add (nr_hits , & prof_buffer [min (pc , prof_len - 1 )]);
410408}
411409#endif /* !CONFIG_SMP */
412-
413410EXPORT_SYMBOL_GPL (profile_hits );
414411
415412void profile_tick (int type )
@@ -427,7 +424,7 @@ void profile_tick(int type)
427424#include <asm/uaccess.h>
428425#include <asm/ptrace.h>
429426
430- static int prof_cpu_mask_read_proc (char * page , char * * start , off_t off ,
427+ static int prof_cpu_mask_read_proc (char * page , char * * start , off_t off ,
431428 int count , int * eof , void * data )
432429{
433430 int len = cpumask_scnprintf (page , count , * (cpumask_t * )data );
@@ -437,8 +434,8 @@ static int prof_cpu_mask_read_proc (char *page, char **start, off_t off,
437434 return len ;
438435}
439436
440- static int prof_cpu_mask_write_proc (struct file * file , const char __user * buffer ,
441- unsigned long count , void * data )
437+ static int prof_cpu_mask_write_proc (struct file * file ,
438+ const char __user * buffer , unsigned long count , void * data )
442439{
443440 cpumask_t * mask = (cpumask_t * )data ;
444441 unsigned long full_count = count , err ;
@@ -457,7 +454,8 @@ void create_prof_cpu_mask(struct proc_dir_entry *root_irq_dir)
457454 struct proc_dir_entry * entry ;
458455
459456 /* create /proc/irq/prof_cpu_mask */
460- if (!(entry = create_proc_entry ("prof_cpu_mask" , 0600 , root_irq_dir )))
457+ entry = create_proc_entry ("prof_cpu_mask" , 0600 , root_irq_dir );
458+ if (!entry )
461459 return ;
462460 entry -> data = (void * )& prof_cpu_mask ;
463461 entry -> read_proc = prof_cpu_mask_read_proc ;
@@ -475,7 +473,7 @@ read_profile(struct file *file, char __user *buf, size_t count, loff_t *ppos)
475473{
476474 unsigned long p = * ppos ;
477475 ssize_t read ;
478- char * pnt ;
476+ char * pnt ;
479477 unsigned int sample_step = 1 << prof_shift ;
480478
481479 profile_flip_buffers ();
@@ -486,12 +484,12 @@ read_profile(struct file *file, char __user *buf, size_t count, loff_t *ppos)
486484 read = 0 ;
487485
488486 while (p < sizeof (unsigned int ) && count > 0 ) {
489- if (put_user (* ((char * )(& sample_step )+ p ),buf ))
487+ if (put_user (* ((char * )(& sample_step )+ p ), buf ))
490488 return - EFAULT ;
491489 buf ++ ; p ++ ; count -- ; read ++ ;
492490 }
493491 pnt = (char * )prof_buffer + p - sizeof (atomic_t );
494- if (copy_to_user (buf ,(void * )pnt ,count ))
492+ if (copy_to_user (buf , (void * )pnt , count ))
495493 return - EFAULT ;
496494 read += count ;
497495 * ppos += read ;
@@ -508,7 +506,7 @@ static ssize_t write_profile(struct file *file, const char __user *buf,
508506 size_t count , loff_t * ppos )
509507{
510508#ifdef CONFIG_SMP
511- extern int setup_profiling_timer (unsigned int multiplier );
509+ extern int setup_profiling_timer (unsigned int multiplier );
512510
513511 if (count == sizeof (int )) {
514512 unsigned int multiplier ;
@@ -591,7 +589,8 @@ static int __init create_proc_profile(void)
591589 return 0 ;
592590 if (create_hash_tables ())
593591 return -1 ;
594- if (!(entry = create_proc_entry ("profile" , S_IWUSR | S_IRUGO , NULL )))
592+ entry = create_proc_entry ("profile" , S_IWUSR | S_IRUGO , NULL );
593+ if (!entry )
595594 return 0 ;
596595 entry -> proc_fops = & proc_profile_operations ;
597596 entry -> size = (1 + prof_len ) * sizeof (atomic_t );
0 commit comments