[PATCH] mark struct file_operations const 3
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>
This commit is contained in:
committed by
Linus Torvalds
parent
5dfe4c964a
commit
2b8693c061
@@ -482,7 +482,7 @@ static int input_proc_devices_open(struct inode *inode, struct file *file)
|
||||
return seq_open(file, &input_devices_seq_ops);
|
||||
}
|
||||
|
||||
static struct file_operations input_devices_fileops = {
|
||||
static const struct file_operations input_devices_fileops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = input_proc_devices_open,
|
||||
.poll = input_proc_devices_poll,
|
||||
@@ -533,7 +533,7 @@ static int input_proc_handlers_open(struct inode *inode, struct file *file)
|
||||
return seq_open(file, &input_handlers_seq_ops);
|
||||
}
|
||||
|
||||
static struct file_operations input_handlers_fileops = {
|
||||
static const struct file_operations input_handlers_fileops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = input_proc_handlers_open,
|
||||
.read = seq_read,
|
||||
@@ -1142,7 +1142,7 @@ static int input_open_file(struct inode *inode, struct file *file)
|
||||
return err;
|
||||
}
|
||||
|
||||
static struct file_operations input_fops = {
|
||||
static const struct file_operations input_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = input_open_file,
|
||||
};
|
||||
|
||||
@@ -670,7 +670,7 @@ static int hp_sdc_rtc_ioctl(struct inode *inode, struct file *file,
|
||||
#endif
|
||||
}
|
||||
|
||||
static struct file_operations hp_sdc_rtc_fops = {
|
||||
static const struct file_operations hp_sdc_rtc_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.llseek = no_llseek,
|
||||
.read = hp_sdc_rtc_read,
|
||||
|
||||
@@ -627,7 +627,7 @@ static long uinput_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
||||
return retval;
|
||||
}
|
||||
|
||||
static struct file_operations uinput_fops = {
|
||||
static const struct file_operations uinput_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = uinput_open,
|
||||
.release = uinput_release,
|
||||
|
||||
@@ -234,7 +234,7 @@ static unsigned int serio_raw_poll(struct file *file, poll_table *wait)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct file_operations serio_raw_fops = {
|
||||
static const struct file_operations serio_raw_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = serio_raw_open,
|
||||
.release = serio_raw_release,
|
||||
|
||||
Reference in New Issue
Block a user