blk: rq_data_dir() should not return a boolean
[cris-mirror.git] / arch / metag / oprofile / common.c
blobba26152b3c0065d9ebc89f608095aac77477dcfe
1 /*
2 * arch/metag/oprofile/common.c
4 * Copyright (C) 2013 Imagination Technologies Ltd.
6 * Based on arch/sh/oprofile/common.c:
8 * Copyright (C) 2003 - 2010 Paul Mundt
10 * Based on arch/mips/oprofile/common.c:
12 * Copyright (C) 2004, 2005 Ralf Baechle
13 * Copyright (C) 2005 MIPS Technologies, Inc.
15 * This file is subject to the terms and conditions of the GNU General Public
16 * License. See the file "COPYING" in the main directory of this archive
17 * for more details.
19 #include <linux/errno.h>
20 #include <linux/init.h>
21 #include <linux/oprofile.h>
22 #include <linux/perf_event.h>
23 #include <linux/slab.h>
25 #include "backtrace.h"
27 #ifdef CONFIG_HW_PERF_EVENTS
29 * This will need to be reworked when multiple PMUs are supported.
31 static char *metag_pmu_op_name;
33 char *op_name_from_perf_id(void)
35 return metag_pmu_op_name;
38 int __init oprofile_arch_init(struct oprofile_operations *ops)
40 ops->backtrace = metag_backtrace;
42 if (perf_num_counters() == 0)
43 return -ENODEV;
45 metag_pmu_op_name = kasprintf(GFP_KERNEL, "metag/%s",
46 perf_pmu_name());
47 if (unlikely(!metag_pmu_op_name))
48 return -ENOMEM;
50 return oprofile_perf_init(ops);
53 void oprofile_arch_exit(void)
55 oprofile_perf_exit();
56 kfree(metag_pmu_op_name);
58 #else
59 int __init oprofile_arch_init(struct oprofile_operations *ops)
61 ops->backtrace = metag_backtrace;
62 /* fall back to timer interrupt PC sampling */
63 return -ENODEV;
65 void oprofile_arch_exit(void) {}
66 #endif /* CONFIG_HW_PERF_EVENTS */