sh: lockless get_user_pages_fast()
[deliverable/linux.git] / arch / sh / oprofile / common.c
CommitLineData
60a51fbe
PM
1/*
2 * arch/sh/oprofile/init.c
3 *
4 * Copyright (C) 2003 - 2008 Paul Mundt
5 *
6 * Based on arch/mips/oprofile/common.c:
7 *
8 * Copyright (C) 2004, 2005 Ralf Baechle
9 * Copyright (C) 2005 MIPS Technologies, Inc.
10 *
11 * This file is subject to the terms and conditions of the GNU General Public
12 * License. See the file "COPYING" in the main directory of this archive
13 * for more details.
14 */
15#include <linux/kernel.h>
16#include <linux/oprofile.h>
17#include <linux/init.h>
18#include <linux/errno.h>
19#include <linux/smp.h>
86c8c047 20#include <linux/perf_event.h>
60a51fbe 21#include <asm/processor.h>
60a51fbe 22
86c8c047 23#ifdef CONFIG_HW_PERF_EVENTS
40a8b421
DP
24extern void sh_backtrace(struct pt_regs * const regs, unsigned int depth);
25
86c8c047 26char *op_name_from_perf_id(void)
60a51fbe 27{
86c8c047
MF
28 const char *pmu;
29 char buf[20];
30 int size;
60a51fbe 31
86c8c047
MF
32 pmu = perf_pmu_name();
33 if (!pmu)
34 return NULL;
60a51fbe 35
86c8c047
MF
36 size = snprintf(buf, sizeof(buf), "sh/%s", pmu);
37 if (size > -1 && size < sizeof(buf))
38 return buf;
60a51fbe 39
86c8c047 40 return NULL;
60a51fbe
PM
41}
42
86c8c047 43int __init oprofile_arch_init(struct oprofile_operations *ops)
60a51fbe 44{
86c8c047 45 ops->backtrace = sh_backtrace;
60a51fbe 46
86c8c047 47 return oprofile_perf_init(ops);
60a51fbe
PM
48}
49
86c8c047 50void __exit oprofile_arch_exit(void)
60a51fbe 51{
86c8c047 52 oprofile_perf_exit();
60a51fbe 53}
86c8c047 54#else
60a51fbe
PM
55int __init oprofile_arch_init(struct oprofile_operations *ops)
56{
86c8c047
MF
57 pr_info("oprofile: hardware counters not available\n");
58 return -ENODEV;
60a51fbe 59}
86c8c047
MF
60void __exit oprofile_arch_exit(void) {}
61#endif /* CONFIG_HW_PERF_EVENTS */
This page took 0.132479 seconds and 5 git commands to generate.