aboutsummaryrefslogtreecommitdiff
path: root/drivers/oprofile
diff options
context:
space:
mode:
authorArjan van de Ven <arjan@linux.intel.com>2007-02-12 00:55:34 -0800
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-12 09:48:45 -0800
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 04d641714d3..00e937e9240 100644
--- a/drivers/oprofile/event_buffer.c
+++ b/drivers/oprofile/event_buffer.c
@@ -181,7 +181,7 @@ out:
return retval;
}
-struct file_operations event_buffer_fops = {
+const struct file_operations event_buffer_fops = {
.open = event_buffer_open,
.release = event_buffer_release,
.read = event_buffer_read,
diff --git a/drivers/oprofile/event_buffer.h b/drivers/oprofile/event_buffer.h
index 92416276e57..9b6a4ebd03e 100644
--- a/drivers/oprofile/event_buffer.h
+++ b/drivers/oprofile/event_buffer.h
@@ -41,7 +41,7 @@ void wake_up_buffer_waiter(void);
/* add data to the event buffer */
void add_event_entry(unsigned long data);
-extern struct file_operations event_buffer_fops;
+extern const struct file_operations event_buffer_fops;
/* mutex between sync_cpu_buffers() and the
* file reading code.
diff --git a/drivers/oprofile/oprofile_files.c b/drivers/oprofile/oprofile_files.c
index a72006c08f2..ef953ba5ab6 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
}
-static struct file_operations depth_fops = {
+static const struct file_operations depth_fops = {
.read = depth_read,
.write = depth_write
};
@@ -56,7 +56,7 @@ static ssize_t pointer_size_read(struct file * file, char __user * buf, size_t c
}
-static struct file_operations pointer_size_fops = {
+static const struct file_operations pointer_size_fops = {
.read = pointer_size_read,
};
@@ -67,7 +67,7 @@ static ssize_t cpu_type_read(struct file * file, char __user * buf, size_t count
}
-static struct file_operations cpu_type_fops = {
+static const struct file_operations cpu_type_fops = {
.read = cpu_type_read,
};
@@ -101,7 +101,7 @@ static ssize_t enable_write(struct file * file, char const __user * buf, size_t
}
-static struct file_operations enable_fops = {
+static const struct file_operations enable_fops = {
.read = enable_read,
.write = enable_write,
};
@@ -114,7 +114,7 @@ static ssize_t dump_write(struct file * file, char const __user * buf, size_t co
}
-static struct file_operations dump_fops = {
+static const struct file_operations dump_fops = {
.write = dump_write,
};
diff --git a/drivers/oprofile/oprofilefs.c b/drivers/oprofile/oprofilefs.c
index 5756401fb15..6e67b42ca46 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)
}
-static struct file_operations ulong_fops = {
+static const struct file_operations ulong_fops = {
.read = ulong_read_file,
.write = ulong_write_file,
.open = default_open,
};
-static struct file_operations ulong_ro_fops = {
+static const struct file_operations ulong_ro_fops = {
.read = ulong_read_file,
.open = default_open,
};
@@ -182,7 +182,7 @@ static ssize_t atomic_read_file(struct file * file, char __user * buf, size_t co
}
-static struct file_operations atomic_ro_fops = {
+static const struct file_operations atomic_ro_fops = {
.read = atomic_read_file,
.open = default_open,
};