Merge tag 'for-v4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power...
[sfrench/cifs-2.6.git] / arch / s390 / oprofile / init.c
1 /*
2  * S390 Version
3  *   Copyright IBM Corp. 2002, 2011
4  *   Author(s): Thomas Spatzier (tspat@de.ibm.com)
5  *   Author(s): Mahesh Salgaonkar (mahesh@linux.vnet.ibm.com)
6  *   Author(s): Heinz Graalfs (graalfs@linux.vnet.ibm.com)
7  *   Author(s): Andreas Krebbel (krebbel@linux.vnet.ibm.com)
8  *
9  * @remark Copyright 2002-2011 OProfile authors
10  */
11
12 #include <linux/oprofile.h>
13 #include <linux/init.h>
14 #include <asm/processor.h>
15
16 static int __s390_backtrace(void *data, unsigned long address)
17 {
18         unsigned int *depth = data;
19
20         if (*depth == 0)
21                 return 1;
22         (*depth)--;
23         oprofile_add_trace(address);
24         return 0;
25 }
26
27 static void s390_backtrace(struct pt_regs *regs, unsigned int depth)
28 {
29         if (user_mode(regs))
30                 return;
31         dump_trace(__s390_backtrace, &depth, NULL, regs->gprs[15]);
32 }
33
34 int __init oprofile_arch_init(struct oprofile_operations *ops)
35 {
36         ops->backtrace = s390_backtrace;
37         return 0;
38 }
39
40 void oprofile_arch_exit(void)
41 {
42 }