aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/oprofile
diff options
context:
space:
mode:
authorArjan van de Ven <arjan@linux.intel.com>2007-02-12 03:55:34 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-12 12:48:45 -0500
commitd54b1fdb1d9f82e375a299e22bd366aad52d4c34 (patch)
treef94768d59702dbbc0beb9a70d9be65dbc5e5108d /drivers/oprofile
parentfa027c2a0a0d6d1df6b29ee99048502c93da0dd4 (diff)
[PATCH] mark struct file_operations const 5
Many struct file_operations in the kernel can be "const". Marking them const moves these to the .rodata section, which avoids false sharing with potential dirty data. In addition it'll catch accidental writes at compile time to these shared resources. Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/oprofile')
-rw-r--r--drivers/oprofile/event_buffer.c2
-rw-r--r--drivers/oprofile/event_buffer.h2
-rw-r--r--drivers/oprofile/oprofile_files.c10
-rw-r--r--drivers/oprofile/oprofilefs.c6
4 files changed, 10 insertions, 10 deletions
diff --git a/drivers/oprofile/event_buffer.c b/drivers/oprofile/event_buffer.c
index 04d641714d34..00e937e9240e 100644
--- a/drivers/oprofile/event_buffer.c
+++ b/drivers/oprofile/event_buffer.c
@@ -181,7 +181,7 @@ out:
181 return retval; 181 return retval;
182} 182}
183 183
184struct file_operations event_buffer_fops = { 184const struct file_operations event_buffer_fops = {
185 .open = event_buffer_open, 185 .open = event_buffer_open,
186 .release = event_buffer_release, 186 .release = event_buffer_release,
187 .read = event_buffer_read, 187 .read = event_buffer_read,
diff --git a/drivers/oprofile/event_buffer.h b/drivers/oprofile/event_buffer.h
index 92416276e577..9b6a4ebd03e3 100644
--- a/drivers/oprofile/event_buffer.h
+++ b/drivers/oprofile/event_buffer.h
@@ -41,7 +41,7 @@ void wake_up_buffer_waiter(void);
41/* add data to the event buffer */ 41/* add data to the event buffer */
42void add_event_entry(unsigned long data); 42void add_event_entry(unsigned long data);
43 43
44extern struct file_operations event_buffer_fops; 44extern const struct file_operations event_buffer_fops;
45 45
46/* mutex between sync_cpu_buffers() and the 46/* mutex between sync_cpu_buffers() and the
47 * file reading code. 47 * file reading code.
diff --git a/drivers/oprofile/oprofile_files.c b/drivers/oprofile/oprofile_files.c
index a72006c08f2b..ef953ba5ab6b 100644
--- a/drivers/oprofile/oprofile_files.c
+++ b/drivers/oprofile/oprofile_files.c
@@ -44,7 +44,7 @@ static ssize_t depth_write(struct file * file, char const __user * buf, size_t c
44} 44}
45 45
46 46
47static struct file_operations depth_fops = { 47static const struct file_operations depth_fops = {
48 .read = depth_read, 48 .read = depth_read,
49 .write = depth_write 49 .write = depth_write
50}; 50};
@@ -56,7 +56,7 @@ static ssize_t pointer_size_read(struct file * file, char __user * buf, size_t c
56} 56}
57 57
58 58
59static struct file_operations pointer_size_fops = { 59static const struct file_operations pointer_size_fops = {
60 .read = pointer_size_read, 60 .read = pointer_size_read,
61}; 61};
62 62
@@ -67,7 +67,7 @@ static ssize_t cpu_type_read(struct file * file, char __user * buf, size_t count
67} 67}
68 68
69 69
70static struct file_operations cpu_type_fops = { 70static const struct file_operations cpu_type_fops = {
71 .read = cpu_type_read, 71 .read = cpu_type_read,
72}; 72};
73 73
@@ -101,7 +101,7 @@ static ssize_t enable_write(struct file * file, char const __user * buf, size_t
101} 101}
102 102
103 103
104static struct file_operations enable_fops = { 104static const struct file_operations enable_fops = {
105 .read = enable_read, 105 .read = enable_read,
106 .write = enable_write, 106 .write = enable_write,
107}; 107};
@@ -114,7 +114,7 @@ static ssize_t dump_write(struct file * file, char const __user * buf, size_t co
114} 114}
115 115
116 116
117static struct file_operations dump_fops = { 117static const struct file_operations dump_fops = {
118 .write = dump_write, 118 .write = dump_write,
119}; 119};
120 120
diff --git a/drivers/oprofile/oprofilefs.c b/drivers/oprofile/oprofilefs.c
index 5756401fb15b..6e67b42ca46d 100644
--- a/drivers/oprofile/oprofilefs.c
+++ b/drivers/oprofile/oprofilefs.c
@@ -115,14 +115,14 @@ static int default_open(struct inode * inode, struct file * filp)
115} 115}
116 116
117 117
118static struct file_operations ulong_fops = { 118static const struct file_operations ulong_fops = {
119 .read = ulong_read_file, 119 .read = ulong_read_file,
120 .write = ulong_write_file, 120 .write = ulong_write_file,
121 .open = default_open, 121 .open = default_open,
122}; 122};
123 123
124 124
125static struct file_operations ulong_ro_fops = { 125static const struct file_operations ulong_ro_fops = {
126 .read = ulong_read_file, 126 .read = ulong_read_file,
127 .open = default_open, 127 .open = default_open,
128}; 128};
@@ -182,7 +182,7 @@ static ssize_t atomic_read_file(struct file * file, char __user * buf, size_t co
182} 182}
183 183
184 184
185static struct file_operations atomic_ro_fops = { 185static const struct file_operations atomic_ro_fops = {
186 .read = atomic_read_file, 186 .read = atomic_read_file,
187 .open = default_open, 187 .open = default_open,
188}; 188};