init.c 765 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /**
  2. * @file init.c
  3. *
  4. * @remark Copyright 2002 OProfile authors
  5. * @remark Read the file COPYING
  6. *
  7. * @author John Levon <levon@movementarian.org>
  8. */
  9. #include <linux/kernel.h>
  10. #include <linux/oprofile.h>
  11. #include <linux/init.h>
  12. #include <linux/errno.h>
  13. extern int perfmon_init(struct oprofile_operations *ops);
  14. extern void perfmon_exit(void);
  15. extern void ia64_backtrace(struct pt_regs * const regs, unsigned int depth);
  16. int __init oprofile_arch_init(struct oprofile_operations *ops)
  17. {
  18. int ret = -ENODEV;
  19. #ifdef CONFIG_PERFMON
  20. /* perfmon_init() can fail, but we have no way to report it */
  21. ret = perfmon_init(ops);
  22. #endif
  23. ops->backtrace = ia64_backtrace;
  24. return ret;
  25. }
  26. void oprofile_arch_exit(void)
  27. {
  28. #ifdef CONFIG_PERFMON
  29. perfmon_exit();
  30. #endif
  31. }