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

Commit 5dfe4c96 authored by Arjan van de Ven's avatar Arjan van de Ven Committed by Linus Torvalds
Browse files

[PATCH] mark struct file_operations const 2



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@osdl.org: sparc64 fix]
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 54047320
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -329,7 +329,7 @@ static int rtc_fasync(int fd, struct file *file, int on)
	return fasync_helper(fd, file, on, &rtc_async_queue);
}

static struct file_operations rtc_fops = {
static const struct file_operations rtc_fops = {
	.owner		= THIS_MODULE,
	.llseek		= no_llseek,
	.read		= rtc_read,
+1 −1
Original line number Diff line number Diff line
@@ -407,7 +407,7 @@ static int at91_clk_open(struct inode *inode, struct file *file)
	return single_open(file, at91_clk_show, NULL);
}

static struct file_operations at91_clk_operations = {
static const struct file_operations at91_clk_operations = {
	.open		= at91_clk_open,
	.read		= seq_read,
	.llseek		= seq_lseek,
+1 −1
Original line number Diff line number Diff line
@@ -360,7 +360,7 @@ static int tlb_open(struct inode *inode, struct file *file)
	return seq_open(file, &tlb_ops);
}

static struct file_operations proc_tlb_operations = {
static const struct file_operations proc_tlb_operations = {
	.open		= tlb_open,
	.read		= seq_read,
	.llseek		= seq_lseek,
+1 −1
Original line number Diff line number Diff line
@@ -499,7 +499,7 @@ print_rtc_status(void)

/* The various file operations we support. */

static struct file_operations rtc_fops = {
static const struct file_operations rtc_fops = {
	.owner =	THIS_MODULE,
	.ioctl =	rtc_ioctl,
}; 
+1 −1
Original line number Diff line number Diff line
@@ -172,7 +172,7 @@ static const char eeprom_name[] = "eeprom";
static struct eeprom_type eeprom;

/* This is the exported file-operations structure for this device. */
struct file_operations eeprom_fops =
const struct file_operations eeprom_fops =
{
  .llseek  = eeprom_lseek,
  .read    = eeprom_read,
Loading