Skip to content

Commit fa027c2

Browse files
fenrus75Linus Torvalds
authored andcommitted
[PATCH] mark struct file_operations const 4
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. [akpm@sdl.org: dvb fix] 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>
1 parent 2b8693c commit fa027c2

67 files changed

Lines changed: 78 additions & 78 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎drivers/macintosh/adb.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -885,7 +885,7 @@ static ssize_t adb_write(struct file *file, const char __user *buf,
885885
return ret;
886886
}
887887

888-
static struct file_operations adb_fops = {
888+
static const struct file_operations adb_fops = {
889889
.owner = THIS_MODULE,
890890
.llseek = no_llseek,
891891
.read = adb_read,

‎drivers/macintosh/ans-lcd.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ anslcd_open( struct inode * inode, struct file * file )
121121
return 0;
122122
}
123123

124-
struct file_operations anslcd_fops = {
124+
const struct file_operations anslcd_fops = {
125125
.write = anslcd_write,
126126
.ioctl = anslcd_ioctl,
127127
.open = anslcd_open,

‎drivers/macintosh/apm_emu.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ static int apm_emu_get_info(char *buf, char **start, off_t fpos, int length)
501501
return p - buf;
502502
}
503503

504-
static struct file_operations apm_bios_fops = {
504+
static const struct file_operations apm_bios_fops = {
505505
.owner = THIS_MODULE,
506506
.read = do_read,
507507
.poll = do_poll,

‎drivers/macintosh/nvram.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ static int nvram_ioctl(struct inode *inode, struct file *file,
100100
return 0;
101101
}
102102

103-
struct file_operations nvram_fops = {
103+
const struct file_operations nvram_fops = {
104104
.owner = THIS_MODULE,
105105
.llseek = nvram_llseek,
106106
.read = read_nvram,

‎drivers/macintosh/smu.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1277,7 +1277,7 @@ static int smu_release(struct inode *inode, struct file *file)
12771277
}
12781278

12791279

1280-
static struct file_operations smu_device_fops = {
1280+
static const struct file_operations smu_device_fops = {
12811281
.llseek = no_llseek,
12821282
.read = smu_read,
12831283
.write = smu_write,

‎drivers/macintosh/via-pmu.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2672,7 +2672,7 @@ pmu_ioctl(struct inode * inode, struct file *filp,
26722672
return error;
26732673
}
26742674

2675-
static struct file_operations pmu_device_fops = {
2675+
static const struct file_operations pmu_device_fops = {
26762676
.read = pmu_read,
26772677
.write = pmu_write,
26782678
.poll = pmu_fpoll,

‎drivers/macintosh/via-pmu68k.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1040,7 +1040,7 @@ static int pmu_ioctl(struct inode * inode, struct file *filp,
10401040
return -EINVAL;
10411041
}
10421042

1043-
static struct file_operations pmu_device_fops = {
1043+
static const struct file_operations pmu_device_fops = {
10441044
.read = pmu_read,
10451045
.write = pmu_write,
10461046
.ioctl = pmu_ioctl,

‎drivers/md/dm-ioctl.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1473,7 +1473,7 @@ static int ctl_ioctl(struct inode *inode, struct file *file,
14731473
return r;
14741474
}
14751475

1476-
static struct file_operations _ctl_fops = {
1476+
static const struct file_operations _ctl_fops = {
14771477
.ioctl = ctl_ioctl,
14781478
.owner = THIS_MODULE,
14791479
};

‎drivers/md/md.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4920,7 +4920,7 @@ static unsigned int mdstat_poll(struct file *filp, poll_table *wait)
49204920
return mask;
49214921
}
49224922

4923-
static struct file_operations md_seq_fops = {
4923+
static const struct file_operations md_seq_fops = {
49244924
.owner = THIS_MODULE,
49254925
.open = md_seq_open,
49264926
.read = seq_read,

‎drivers/media/common/saa7146_fops.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ static ssize_t fops_write(struct file *file, const char __user *data, size_t cou
416416
}
417417
}
418418

419-
static struct file_operations video_fops =
419+
static const struct file_operations video_fops =
420420
{
421421
.owner = THIS_MODULE,
422422
.open = fops_open,

0 commit comments

Comments
 (0)