summaryrefslogtreecommitdiff
path: root/recipes/kexecboot/linux-kexecboot-2.6.29/dss2/0051-DSS2-VRAM-use-debugfs-not-procfs.patch
blob: 739d3cd1a6e1ee8924ac1291495cba80cb2ef66e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
From b47aef28536f3c276d232c41cd3084c69389dca4 Mon Sep 17 00:00:00 2001
From: Tomi Valkeinen <tomi.valkeinen@nokia.com>
Date: Wed, 22 Apr 2009 14:11:52 +0300
Subject: [PATCH 51/69] DSS2: VRAM: use debugfs, not procfs

---
 arch/arm/plat-omap/vram.c |  103 +++++++++++++++------------------------------
 1 files changed, 34 insertions(+), 69 deletions(-)

diff --git a/arch/arm/plat-omap/vram.c b/arch/arm/plat-omap/vram.c
index 90276ac..e847579 100644
--- a/arch/arm/plat-omap/vram.c
+++ b/arch/arm/plat-omap/vram.c
@@ -27,11 +27,11 @@
 #include <linux/mm.h>
 #include <linux/list.h>
 #include <linux/dma-mapping.h>
-#include <linux/proc_fs.h>
 #include <linux/seq_file.h>
 #include <linux/bootmem.h>
 #include <linux/omapfb.h>
 #include <linux/completion.h>
+#include <linux/debugfs.h>
 
 #include <asm/setup.h>
 
@@ -398,88 +398,54 @@ int omap_vram_alloc(int mtype, size_t size, unsigned long *paddr)
 }
 EXPORT_SYMBOL(omap_vram_alloc);
 
-#ifdef CONFIG_PROC_FS
-static void *r_next(struct seq_file *m, void *v, loff_t *pos)
-{
-	struct list_head *l = v;
-
-	(*pos)++;
-
-	if (list_is_last(l, &region_list))
-		return NULL;
-
-	return l->next;
-}
-
-static void *r_start(struct seq_file *m, loff_t *pos)
-{
-	loff_t p = *pos;
-	struct list_head *l = &region_list;
-
-	mutex_lock(&region_mutex);
-
-	do {
-		l = l->next;
-		if (l == &region_list)
-			return NULL;
-	} while (p--);
-
-	return l;
-}
-
-static void r_stop(struct seq_file *m, void *v)
-{
-	mutex_unlock(&region_mutex);
-}
-
-static int r_show(struct seq_file *m, void *v)
+#if defined(CONFIG_DEBUG_FS)
+static int vram_debug_show(struct seq_file *s, void *unused)
 {
 	struct vram_region *vr;
 	struct vram_alloc *va;
 	unsigned size;
 
-	vr = list_entry(v, struct vram_region, list);
-
-	size = vr->pages << PAGE_SHIFT;
-
-	seq_printf(m, "%08lx-%08lx (%d bytes)\n",
-			vr->paddr, vr->paddr + size - 1,
-			size);
+	mutex_lock(&region_mutex);
 
-	list_for_each_entry(va, &vr->alloc_list, list) {
-		size = va->pages << PAGE_SHIFT;
-		seq_printf(m, "    %08lx-%08lx (%d bytes)\n",
-				va->paddr, va->paddr + size - 1,
+	list_for_each_entry(vr, &region_list, list) {
+		size = vr->pages << PAGE_SHIFT;
+		seq_printf(s, "%08lx-%08lx (%d bytes)\n",
+				vr->paddr, vr->paddr + size - 1,
 				size);
-	}
 
+		list_for_each_entry(va, &vr->alloc_list, list) {
+			size = va->pages << PAGE_SHIFT;
+			seq_printf(s, "    %08lx-%08lx (%d bytes)\n",
+					va->paddr, va->paddr + size - 1,
+					size);
+		}
+	}
 
+	mutex_unlock(&region_mutex);
 
 	return 0;
 }
 
-static const struct seq_operations resource_op = {
-	.start	= r_start,
-	.next	= r_next,
-	.stop	= r_stop,
-	.show	= r_show,
-};
-
-static int vram_open(struct inode *inode, struct file *file)
+static int vram_debug_open(struct inode *inode, struct file *file)
 {
-	return seq_open(file, &resource_op);
+	return single_open(file, vram_debug_show, inode->i_private);
 }
 
-static const struct file_operations proc_vram_operations = {
-	.open		= vram_open,
-	.read		= seq_read,
-	.llseek		= seq_lseek,
-	.release	= seq_release,
+static const struct file_operations vram_debug_fops = {
+	.open           = vram_debug_open,
+	.read           = seq_read,
+	.llseek         = seq_lseek,
+	.release        = single_release,
 };
 
-static int __init omap_vram_create_proc(void)
+static int __init omap_vram_create_debugfs(void)
 {
-	proc_create("omap-vram", 0, NULL, &proc_vram_operations);
+	struct dentry *d;
+
+	d = debugfs_create_file("vram", S_IRUGO, NULL,
+			NULL, &vram_debug_fops);
+	if (IS_ERR(d))
+		return PTR_ERR(d);
 
 	return 0;
 }
@@ -487,7 +453,7 @@ static int __init omap_vram_create_proc(void)
 
 static __init int omap_vram_init(void)
 {
-	int i, r;
+	int i;
 
 	vram_initialized = 1;
 
@@ -495,10 +461,9 @@ static __init int omap_vram_init(void)
 		omap_vram_add_region(postponed_regions[i].paddr,
 				postponed_regions[i].size);
 
-#ifdef CONFIG_PROC_FS
-	r = omap_vram_create_proc();
-	if (r)
-		return -ENOMEM;
+#ifdef CONFIG_DEBUG_FS
+	if (omap_vram_create_debugfs())
+		pr_err("VRAM: Failed to create debugfs file\n");
 #endif
 
 	return 0;
-- 
1.6.2.4