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

Commit 00977a59 authored by Arjan van de Ven's avatar Arjan van de Ven Committed by Linus Torvalds
Browse files

[PATCH] mark struct file_operations const 6



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 d54b1fdb
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -846,7 +846,7 @@ static int bpp_ioctl(struct inode *inode, struct file *f, unsigned int cmd,
      return errno;
}

static struct file_operations bpp_fops = {
static const struct file_operations bpp_fops = {
	.owner =	THIS_MODULE,
	.read =		bpp_read,
	.write =	bpp_write,
+1 −1
Original line number Diff line number Diff line
@@ -459,7 +459,7 @@ static irqreturn_t wd_interrupt(int irq, void *dev_id)
	return IRQ_HANDLED;
}

static struct file_operations wd_fops = {
static const struct file_operations wd_fops = {
	.owner =	THIS_MODULE,
	.ioctl =	wd_ioctl,
	.compat_ioctl =	wd_compat_ioctl,
+1 −1
Original line number Diff line number Diff line
@@ -166,7 +166,7 @@ static long d7s_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
	return error;
}

static struct file_operations d7s_fops = {
static const struct file_operations d7s_fops = {
	.owner =		THIS_MODULE,
	.unlocked_ioctl =	d7s_ioctl,
	.compat_ioctl =		d7s_ioctl,
+1 −1
Original line number Diff line number Diff line
@@ -705,7 +705,7 @@ envctrl_release(struct inode *inode, struct file *file)
	return 0;
}

static struct file_operations envctrl_fops = {
static const struct file_operations envctrl_fops = {
	.owner =		THIS_MODULE,
	.read =			envctrl_read,
	.unlocked_ioctl =	envctrl_ioctl,
+1 −1
Original line number Diff line number Diff line
@@ -142,7 +142,7 @@ flash_release(struct inode *inode, struct file *file)
	return 0;
}

static struct file_operations flash_fops = {
static const struct file_operations flash_fops = {
	/* no write to the Flash, use mmap
	 * and play flash dependent tricks.
	 */
Loading