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

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

[PATCH] mark struct file_operations const 5



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 fa027c2a
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -1111,7 +1111,7 @@ static int cfg_release(struct inode *inode, struct file *file)
	return 0;
	return 0;
}
}


static struct file_operations config_fops = {
static const struct file_operations config_fops = {
	.owner = THIS_MODULE,
	.owner = THIS_MODULE,
	.llseek = no_llseek,
	.llseek = no_llseek,
	.ioctl = i2o_cfg_ioctl,
	.ioctl = i2o_cfg_ioctl,
+19 −19
Original line number Original line Diff line number Diff line
@@ -1703,133 +1703,133 @@ static int i2o_seq_open_dev_name(struct inode *inode, struct file *file)
	return single_open(file, i2o_seq_show_dev_name, PDE(inode)->data);
	return single_open(file, i2o_seq_show_dev_name, PDE(inode)->data);
};
};


static struct file_operations i2o_seq_fops_lct = {
static const struct file_operations i2o_seq_fops_lct = {
	.open = i2o_seq_open_lct,
	.open = i2o_seq_open_lct,
	.read = seq_read,
	.read = seq_read,
	.llseek = seq_lseek,
	.llseek = seq_lseek,
	.release = single_release,
	.release = single_release,
};
};


static struct file_operations i2o_seq_fops_hrt = {
static const struct file_operations i2o_seq_fops_hrt = {
	.open = i2o_seq_open_hrt,
	.open = i2o_seq_open_hrt,
	.read = seq_read,
	.read = seq_read,
	.llseek = seq_lseek,
	.llseek = seq_lseek,
	.release = single_release,
	.release = single_release,
};
};


static struct file_operations i2o_seq_fops_status = {
static const struct file_operations i2o_seq_fops_status = {
	.open = i2o_seq_open_status,
	.open = i2o_seq_open_status,
	.read = seq_read,
	.read = seq_read,
	.llseek = seq_lseek,
	.llseek = seq_lseek,
	.release = single_release,
	.release = single_release,
};
};


static struct file_operations i2o_seq_fops_hw = {
static const struct file_operations i2o_seq_fops_hw = {
	.open = i2o_seq_open_hw,
	.open = i2o_seq_open_hw,
	.read = seq_read,
	.read = seq_read,
	.llseek = seq_lseek,
	.llseek = seq_lseek,
	.release = single_release,
	.release = single_release,
};
};


static struct file_operations i2o_seq_fops_ddm_table = {
static const struct file_operations i2o_seq_fops_ddm_table = {
	.open = i2o_seq_open_ddm_table,
	.open = i2o_seq_open_ddm_table,
	.read = seq_read,
	.read = seq_read,
	.llseek = seq_lseek,
	.llseek = seq_lseek,
	.release = single_release,
	.release = single_release,
};
};


static struct file_operations i2o_seq_fops_driver_store = {
static const struct file_operations i2o_seq_fops_driver_store = {
	.open = i2o_seq_open_driver_store,
	.open = i2o_seq_open_driver_store,
	.read = seq_read,
	.read = seq_read,
	.llseek = seq_lseek,
	.llseek = seq_lseek,
	.release = single_release,
	.release = single_release,
};
};


static struct file_operations i2o_seq_fops_drivers_stored = {
static const struct file_operations i2o_seq_fops_drivers_stored = {
	.open = i2o_seq_open_drivers_stored,
	.open = i2o_seq_open_drivers_stored,
	.read = seq_read,
	.read = seq_read,
	.llseek = seq_lseek,
	.llseek = seq_lseek,
	.release = single_release,
	.release = single_release,
};
};


static struct file_operations i2o_seq_fops_groups = {
static const struct file_operations i2o_seq_fops_groups = {
	.open = i2o_seq_open_groups,
	.open = i2o_seq_open_groups,
	.read = seq_read,
	.read = seq_read,
	.llseek = seq_lseek,
	.llseek = seq_lseek,
	.release = single_release,
	.release = single_release,
};
};


static struct file_operations i2o_seq_fops_phys_device = {
static const struct file_operations i2o_seq_fops_phys_device = {
	.open = i2o_seq_open_phys_device,
	.open = i2o_seq_open_phys_device,
	.read = seq_read,
	.read = seq_read,
	.llseek = seq_lseek,
	.llseek = seq_lseek,
	.release = single_release,
	.release = single_release,
};
};


static struct file_operations i2o_seq_fops_claimed = {
static const struct file_operations i2o_seq_fops_claimed = {
	.open = i2o_seq_open_claimed,
	.open = i2o_seq_open_claimed,
	.read = seq_read,
	.read = seq_read,
	.llseek = seq_lseek,
	.llseek = seq_lseek,
	.release = single_release,
	.release = single_release,
};
};


static struct file_operations i2o_seq_fops_users = {
static const struct file_operations i2o_seq_fops_users = {
	.open = i2o_seq_open_users,
	.open = i2o_seq_open_users,
	.read = seq_read,
	.read = seq_read,
	.llseek = seq_lseek,
	.llseek = seq_lseek,
	.release = single_release,
	.release = single_release,
};
};


static struct file_operations i2o_seq_fops_priv_msgs = {
static const struct file_operations i2o_seq_fops_priv_msgs = {
	.open = i2o_seq_open_priv_msgs,
	.open = i2o_seq_open_priv_msgs,
	.read = seq_read,
	.read = seq_read,
	.llseek = seq_lseek,
	.llseek = seq_lseek,
	.release = single_release,
	.release = single_release,
};
};


static struct file_operations i2o_seq_fops_authorized_users = {
static const struct file_operations i2o_seq_fops_authorized_users = {
	.open = i2o_seq_open_authorized_users,
	.open = i2o_seq_open_authorized_users,
	.read = seq_read,
	.read = seq_read,
	.llseek = seq_lseek,
	.llseek = seq_lseek,
	.release = single_release,
	.release = single_release,
};
};


static struct file_operations i2o_seq_fops_dev_name = {
static const struct file_operations i2o_seq_fops_dev_name = {
	.open = i2o_seq_open_dev_name,
	.open = i2o_seq_open_dev_name,
	.read = seq_read,
	.read = seq_read,
	.llseek = seq_lseek,
	.llseek = seq_lseek,
	.release = single_release,
	.release = single_release,
};
};


static struct file_operations i2o_seq_fops_dev_identity = {
static const struct file_operations i2o_seq_fops_dev_identity = {
	.open = i2o_seq_open_dev_identity,
	.open = i2o_seq_open_dev_identity,
	.read = seq_read,
	.read = seq_read,
	.llseek = seq_lseek,
	.llseek = seq_lseek,
	.release = single_release,
	.release = single_release,
};
};


static struct file_operations i2o_seq_fops_ddm_identity = {
static const struct file_operations i2o_seq_fops_ddm_identity = {
	.open = i2o_seq_open_ddm_identity,
	.open = i2o_seq_open_ddm_identity,
	.read = seq_read,
	.read = seq_read,
	.llseek = seq_lseek,
	.llseek = seq_lseek,
	.release = single_release,
	.release = single_release,
};
};


static struct file_operations i2o_seq_fops_uinfo = {
static const struct file_operations i2o_seq_fops_uinfo = {
	.open = i2o_seq_open_uinfo,
	.open = i2o_seq_open_uinfo,
	.read = seq_read,
	.read = seq_read,
	.llseek = seq_lseek,
	.llseek = seq_lseek,
	.release = single_release,
	.release = single_release,
};
};


static struct file_operations i2o_seq_fops_sgl_limits = {
static const struct file_operations i2o_seq_fops_sgl_limits = {
	.open = i2o_seq_open_sgl_limits,
	.open = i2o_seq_open_sgl_limits,
	.read = seq_read,
	.read = seq_read,
	.llseek = seq_lseek,
	.llseek = seq_lseek,
	.release = single_release,
	.release = single_release,
};
};


static struct file_operations i2o_seq_fops_sensors = {
static const struct file_operations i2o_seq_fops_sensors = {
	.open = i2o_seq_open_sensors,
	.open = i2o_seq_open_sensors,
	.read = seq_read,
	.read = seq_read,
	.llseek = seq_lseek,
	.llseek = seq_lseek,
+1 −1
Original line number Original line Diff line number Diff line
@@ -169,7 +169,7 @@ static struct platform_driver hdpu_cpustate_driver = {
/*
/*
 *	The various file operations we support.
 *	The various file operations we support.
 */
 */
static struct file_operations cpustate_fops = {
static const struct file_operations cpustate_fops = {
      owner:THIS_MODULE,
      owner:THIS_MODULE,
      open:cpustate_open,
      open:cpustate_open,
      release:cpustate_release,
      release:cpustate_release,
+5 −5
Original line number Original line Diff line number Diff line
@@ -156,7 +156,7 @@ static struct inode *ibmasmfs_make_inode(struct super_block *sb, int mode)
static struct dentry *ibmasmfs_create_file (struct super_block *sb,
static struct dentry *ibmasmfs_create_file (struct super_block *sb,
			struct dentry *parent,
			struct dentry *parent,
		       	const char *name,
		       	const char *name,
			struct file_operations *fops,
			const struct file_operations *fops,
			void *data,
			void *data,
			int mode)
			int mode)
{
{
@@ -581,28 +581,28 @@ static ssize_t remote_settings_file_write(struct file *file, const char __user *
	return count;
	return count;
}
}


static struct file_operations command_fops = {
static const struct file_operations command_fops = {
	.open =		command_file_open,
	.open =		command_file_open,
	.release =	command_file_close,
	.release =	command_file_close,
	.read =		command_file_read,
	.read =		command_file_read,
	.write =	command_file_write,
	.write =	command_file_write,
};
};


static struct file_operations event_fops = {
static const struct file_operations event_fops = {
	.open =		event_file_open,
	.open =		event_file_open,
	.release =	event_file_close,
	.release =	event_file_close,
	.read =		event_file_read,
	.read =		event_file_read,
	.write =	event_file_write,
	.write =	event_file_write,
};
};


static struct file_operations r_heartbeat_fops = {
static const struct file_operations r_heartbeat_fops = {
	.open =		r_heartbeat_file_open,
	.open =		r_heartbeat_file_open,
	.release =	r_heartbeat_file_close,
	.release =	r_heartbeat_file_close,
	.read =		r_heartbeat_file_read,
	.read =		r_heartbeat_file_read,
	.write =	r_heartbeat_file_write,
	.write =	r_heartbeat_file_write,
};
};


static struct file_operations remote_settings_fops = {
static const struct file_operations remote_settings_fops = {
	.open =		remote_settings_file_open,
	.open =		remote_settings_file_open,
	.release =	remote_settings_file_close,
	.release =	remote_settings_file_close,
	.read =		remote_settings_file_read,
	.read =		remote_settings_file_read,
+1 −1
Original line number Original line Diff line number Diff line
@@ -759,7 +759,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
	return ret;
	return ret;
} /* memory_ioctl */
} /* memory_ioctl */


static struct file_operations mtd_fops = {
static const struct file_operations mtd_fops = {
	.owner		= THIS_MODULE,
	.owner		= THIS_MODULE,
	.llseek		= mtd_lseek,
	.llseek		= mtd_lseek,
	.read		= mtd_read,
	.read		= mtd_read,
Loading