From 9c2e08c592cd357a8330c34def1e8ecfdcf53275 Mon Sep 17 00:00:00 2001 From: Arjan van de Ven Date: Mon, 12 Feb 2007 00:55:37 -0800 Subject: [PATCH] mark struct file_operations const 9 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: Arjan van de Ven Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- sound/core/control.c | 2 +- sound/core/hwdep.c | 2 +- sound/core/info.c | 2 +- sound/core/init.c | 4 ++-- sound/core/oss/mixer_oss.c | 2 +- sound/core/oss/pcm_oss.c | 2 +- sound/core/pcm_native.c | 2 +- sound/core/rawmidi.c | 2 +- sound/core/seq/oss/seq_oss.c | 2 +- sound/core/seq/seq_clientmgr.c | 2 +- sound/core/sound.c | 2 +- sound/core/timer.c | 2 +- 12 files changed, 13 insertions(+), 13 deletions(-) (limited to 'sound/core') diff --git a/sound/core/control.c b/sound/core/control.c index 42bcf2794b2..86de7258b76 100644 --- a/sound/core/control.c +++ b/sound/core/control.c @@ -1398,7 +1398,7 @@ static int snd_ctl_fasync(int fd, struct file * file, int on) * INIT PART */ -static struct file_operations snd_ctl_f_ops = +static const struct file_operations snd_ctl_f_ops = { .owner = THIS_MODULE, .read = snd_ctl_read, diff --git a/sound/core/hwdep.c b/sound/core/hwdep.c index 39c03f3dfbf..96ffdf18c3f 100644 --- a/sound/core/hwdep.c +++ b/sound/core/hwdep.c @@ -317,7 +317,7 @@ static int snd_hwdep_control_ioctl(struct snd_card *card, */ -static struct file_operations snd_hwdep_f_ops = +static const struct file_operations snd_hwdep_f_ops = { .owner = THIS_MODULE, .llseek = snd_hwdep_llseek, diff --git a/sound/core/info.c b/sound/core/info.c index 54591e2eb6e..bf6dbf99528 100644 --- a/sound/core/info.c +++ b/sound/core/info.c @@ -507,7 +507,7 @@ static int snd_info_entry_mmap(struct file *file, struct vm_area_struct *vma) return -ENXIO; } -static struct file_operations snd_info_entry_operations = +static const struct file_operations snd_info_entry_operations = { .owner = THIS_MODULE, .llseek = snd_info_entry_llseek, diff --git a/sound/core/init.c b/sound/core/init.c index db610373374..4a431e3ea3a 100644 --- a/sound/core/init.c +++ b/sound/core/init.c @@ -36,7 +36,7 @@ static DEFINE_SPINLOCK(shutdown_lock); static LIST_HEAD(shutdown_files); -static struct file_operations snd_shutdown_f_ops; +static const struct file_operations snd_shutdown_f_ops; static unsigned int snd_cards_lock; /* locked for registering/using */ struct snd_card *snd_cards[SNDRV_CARDS]; @@ -244,7 +244,7 @@ static int snd_disconnect_fasync(int fd, struct file *file, int on) return -ENODEV; } -static struct file_operations snd_shutdown_f_ops = +static const struct file_operations snd_shutdown_f_ops = { .owner = THIS_MODULE, .llseek = snd_disconnect_llseek, diff --git a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c index 3391f2a9b4d..74a2923eb40 100644 --- a/sound/core/oss/mixer_oss.c +++ b/sound/core/oss/mixer_oss.c @@ -390,7 +390,7 @@ int snd_mixer_oss_ioctl_card(struct snd_card *card, unsigned int cmd, unsigned l * REGISTRATION PART */ -static struct file_operations snd_mixer_oss_f_ops = +static const struct file_operations snd_mixer_oss_f_ops = { .owner = THIS_MODULE, .open = snd_mixer_oss_open, diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c index 786a82e6889..c4744bb07f4 100644 --- a/sound/core/oss/pcm_oss.c +++ b/sound/core/oss/pcm_oss.c @@ -2889,7 +2889,7 @@ static void snd_pcm_oss_proc_done(struct snd_pcm *pcm) * ENTRY functions */ -static struct file_operations snd_pcm_oss_f_reg = +static const struct file_operations snd_pcm_oss_f_reg = { .owner = THIS_MODULE, .read = snd_pcm_oss_read, diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index b52e89393fa..3e276fcf333 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c @@ -3424,7 +3424,7 @@ out: * Register section */ -struct file_operations snd_pcm_f_ops[2] = { +const struct file_operations snd_pcm_f_ops[2] = { { .owner = THIS_MODULE, .write = snd_pcm_write, diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c index 7e6ceec738d..d14dcbb6dbc 100644 --- a/sound/core/rawmidi.c +++ b/sound/core/rawmidi.c @@ -1359,7 +1359,7 @@ static void snd_rawmidi_proc_info_read(struct snd_info_entry *entry, * Register functions */ -static struct file_operations snd_rawmidi_f_ops = +static const struct file_operations snd_rawmidi_f_ops = { .owner = THIS_MODULE, .read = snd_rawmidi_read, diff --git a/sound/core/seq/oss/seq_oss.c b/sound/core/seq/oss/seq_oss.c index 92858cf8b6e..2eb987308b5 100644 --- a/sound/core/seq/oss/seq_oss.c +++ b/sound/core/seq/oss/seq_oss.c @@ -208,7 +208,7 @@ odev_poll(struct file *file, poll_table * wait) * registration of sequencer minor device */ -static struct file_operations seq_oss_f_ops = +static const struct file_operations seq_oss_f_ops = { .owner = THIS_MODULE, .read = odev_read, diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c index bb9dd9fa8e5..694efe832b6 100644 --- a/sound/core/seq/seq_clientmgr.c +++ b/sound/core/seq/seq_clientmgr.c @@ -2538,7 +2538,7 @@ void snd_seq_info_clients_read(struct snd_info_entry *entry, * REGISTRATION PART */ -static struct file_operations snd_seq_f_ops = +static const struct file_operations snd_seq_f_ops = { .owner = THIS_MODULE, .read = snd_seq_read, diff --git a/sound/core/sound.c b/sound/core/sound.c index 4084de06412..70600df94d6 100644 --- a/sound/core/sound.c +++ b/sound/core/sound.c @@ -168,7 +168,7 @@ static int snd_open(struct inode *inode, struct file *file) return err; } -static struct file_operations snd_fops = +static const struct file_operations snd_fops = { .owner = THIS_MODULE, .open = snd_open diff --git a/sound/core/timer.c b/sound/core/timer.c index 3e063835106..160e40ede72 100644 --- a/sound/core/timer.c +++ b/sound/core/timer.c @@ -1901,7 +1901,7 @@ static unsigned int snd_timer_user_poll(struct file *file, poll_table * wait) #define snd_timer_user_ioctl_compat NULL #endif -static struct file_operations snd_timer_f_ops = +static const struct file_operations snd_timer_f_ops = { .owner = THIS_MODULE, .read = snd_timer_user_read, -- cgit v1.2.3-70-g09d2