blob: 52e58a20e09d58d6545a31c2e6888d759a2b6443 [file] [log] [blame]
Neil Leederb0c8ec52013-01-07 15:12:45 -05001/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
13#include <linux/types.h>
14#include <linux/uaccess.h>
15#include <linux/debugfs.h>
16
17/*
18 * Subsequent patches should add an entry to end of this string.
19 * Format is incrementing sequence number followed by text of
20 * patch commit title with newline.
21 * Note trailing ';' is on its own line to simplify addition of
22 * future strings.
23 */
24static char *descriptions =
25 "0 msm: perf: add debug patch logging framework\n"
26;
27
28static ssize_t desc_read(struct file *fp, char __user *buf,
29 size_t count, loff_t *pos)
30{
31 return simple_read_from_buffer(buf, count, pos, descriptions,
32 strlen(descriptions));
33}
34
35static const struct file_operations perf_debug_desc_fops = {
36 .read = desc_read,
37};
38
39static int msm_perf_debugfs_init(void)
40{
41 int ret = 0;
42 struct dentry *dir;
43 struct dentry *file;
44
45 dir = debugfs_create_dir("msm-perf-patches", NULL);
46 if (IS_ERR_OR_NULL(dir)) {
47 pr_err("failed to create msm-perf-patches dir in debugfs\n");
48 ret = PTR_ERR(dir);
49 goto init_exit;
50 }
51
52 file = debugfs_create_file("descriptions", 0444, dir, NULL,
53 &perf_debug_desc_fops);
54 if (IS_ERR_OR_NULL(file)) {
55 debugfs_remove(dir);
56 pr_err("failed to create descriptions file for msm-perf-patches\n");
57 ret = PTR_ERR(file);
58 goto init_exit;
59 }
60
61init_exit:
62 return ret;
63}
64late_initcall(msm_perf_debugfs_init);