Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2b8693c0 authored by Arjan van de Ven's avatar Arjan van de Ven Committed by Linus Torvalds
Browse files

[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: default avatarArjan van de Ven <arjan@linux.intel.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 5dfe4c96
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -264,7 +264,7 @@ static ssize_t blk_dropped_read(struct file *filp, char __user *buffer,
	return simple_read_from_buffer(buffer, count, ppos, buf, strlen(buf));
}

static struct file_operations blk_dropped_fops = {
static const struct file_operations blk_dropped_fops = {
	.owner =	THIS_MODULE,
	.open =		blk_dropped_open,
	.read =		blk_dropped_read,
+1 −1
Original line number Diff line number Diff line
@@ -101,7 +101,7 @@ static int crypto_info_open(struct inode *inode, struct file *file)
	return seq_open(file, &crypto_seq_ops);
}
        
static struct file_operations proc_crypto_ops = {
static const struct file_operations proc_crypto_ops = {
	.open		= crypto_info_open,
	.read		= seq_read,
	.llseek		= seq_lseek,
+1 −1
Original line number Diff line number Diff line
@@ -238,7 +238,7 @@ static int rtc_ioctl(struct inode *inode, struct file *file,
	return -EINVAL;
}

static struct file_operations rtc_fops = {
static const struct file_operations rtc_fops = {
	.ioctl	= rtc_ioctl,
};

+1 −1
Original line number Diff line number Diff line
@@ -7024,7 +7024,7 @@ static int DAC960_gam_ioctl(struct inode *inode, struct file *file,
  return -EINVAL;
}

static struct file_operations DAC960_gam_fops = {
static const struct file_operations DAC960_gam_fops = {
	.owner		= THIS_MODULE,
	.ioctl		= DAC960_gam_ioctl
};
+1 −1
Original line number Diff line number Diff line
@@ -269,7 +269,7 @@ static int slm_get_pagesize( int device, int *w, int *h );

static DEFINE_TIMER(slm_timer, slm_test_ready, 0, 0);

static struct file_operations slm_fops = {
static const struct file_operations slm_fops = {
	.owner =	THIS_MODULE,
	.read =		slm_read,
	.write =	slm_write,
Loading