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/oss/ad1889.c | 4 ++-- sound/oss/btaudio.c | 6 +++--- sound/oss/dmasound/dmasound_core.c | 6 +++--- sound/oss/emu10k1/audio.c | 2 +- sound/oss/emu10k1/midi.c | 2 +- sound/oss/emu10k1/mixer.c | 2 +- sound/oss/hal2.c | 4 ++-- sound/oss/msnd_pinnacle.c | 2 +- sound/oss/os.h | 2 +- sound/oss/sh_dac_audio.c | 2 +- sound/oss/soundcard.c | 2 +- sound/oss/via82cxxx_audio.c | 4 ++-- sound/oss/vwsnd.c | 4 ++-- 13 files changed, 21 insertions(+), 21 deletions(-) (limited to 'sound/oss') diff --git a/sound/oss/ad1889.c b/sound/oss/ad1889.c index 09263d72a51..f0724327493 100644 --- a/sound/oss/ad1889.c +++ b/sound/oss/ad1889.c @@ -778,7 +778,7 @@ static int ad1889_release(struct inode *inode, struct file *file) return 0; } -static struct file_operations ad1889_fops = { +static const struct file_operations ad1889_fops = { .owner = THIS_MODULE, .llseek = no_llseek, .read = ad1889_read, @@ -812,7 +812,7 @@ static int ad1889_mixer_ioctl(struct inode *inode, struct file *file, return codec->mixer_ioctl(codec, cmd, arg); } -static struct file_operations ad1889_mixer_fops = { +static const struct file_operations ad1889_mixer_fops = { .owner = THIS_MODULE, .llseek = no_llseek, .ioctl = ad1889_mixer_ioctl, diff --git a/sound/oss/btaudio.c b/sound/oss/btaudio.c index ad7210a00dc..f845528e1fa 100644 --- a/sound/oss/btaudio.c +++ b/sound/oss/btaudio.c @@ -429,7 +429,7 @@ static int btaudio_mixer_ioctl(struct inode *inode, struct file *file, return 0; } -static struct file_operations btaudio_mixer_fops = { +static const struct file_operations btaudio_mixer_fops = { .owner = THIS_MODULE, .llseek = no_llseek, .open = btaudio_mixer_open, @@ -796,7 +796,7 @@ static unsigned int btaudio_dsp_poll(struct file *file, struct poll_table_struct return mask; } -static struct file_operations btaudio_digital_dsp_fops = { +static const struct file_operations btaudio_digital_dsp_fops = { .owner = THIS_MODULE, .llseek = no_llseek, .open = btaudio_dsp_open_digital, @@ -807,7 +807,7 @@ static struct file_operations btaudio_digital_dsp_fops = { .poll = btaudio_dsp_poll, }; -static struct file_operations btaudio_analog_dsp_fops = { +static const struct file_operations btaudio_analog_dsp_fops = { .owner = THIS_MODULE, .llseek = no_llseek, .open = btaudio_dsp_open_analog, diff --git a/sound/oss/dmasound/dmasound_core.c b/sound/oss/dmasound/dmasound_core.c index 80b836e80d9..a0ec886f2aa 100644 --- a/sound/oss/dmasound/dmasound_core.c +++ b/sound/oss/dmasound/dmasound_core.c @@ -371,7 +371,7 @@ static int mixer_ioctl(struct inode *inode, struct file *file, u_int cmd, return -EINVAL; } -static struct file_operations mixer_fops = +static const struct file_operations mixer_fops = { .owner = THIS_MODULE, .llseek = no_llseek, @@ -1337,7 +1337,7 @@ static int sq_ioctl(struct inode *inode, struct file *file, u_int cmd, return -EINVAL; } -static struct file_operations sq_fops = +static const struct file_operations sq_fops = { .owner = THIS_MODULE, .llseek = no_llseek, @@ -1561,7 +1561,7 @@ static ssize_t state_read(struct file *file, char __user *buf, size_t count, return n; } -static struct file_operations state_fops = { +static const struct file_operations state_fops = { .owner = THIS_MODULE, .llseek = no_llseek, .read = state_read, diff --git a/sound/oss/emu10k1/audio.c b/sound/oss/emu10k1/audio.c index efcf589d708..e75ea21eb81 100644 --- a/sound/oss/emu10k1/audio.c +++ b/sound/oss/emu10k1/audio.c @@ -1582,7 +1582,7 @@ static void emu10k1_waveout_bh(unsigned long refdata) return; } -struct file_operations emu10k1_audio_fops = { +const struct file_operations emu10k1_audio_fops = { .owner = THIS_MODULE, .llseek = no_llseek, .read = emu10k1_audio_read, diff --git a/sound/oss/emu10k1/midi.c b/sound/oss/emu10k1/midi.c index cca3dad2bdf..df1e990449a 100644 --- a/sound/oss/emu10k1/midi.c +++ b/sound/oss/emu10k1/midi.c @@ -458,7 +458,7 @@ int emu10k1_midi_callback(unsigned long msg, unsigned long refdata, unsigned lon } /* MIDI file operations */ -struct file_operations emu10k1_midi_fops = { +const struct file_operations emu10k1_midi_fops = { .owner = THIS_MODULE, .read = emu10k1_midi_read, .write = emu10k1_midi_write, diff --git a/sound/oss/emu10k1/mixer.c b/sound/oss/emu10k1/mixer.c index 6419796c2ed..bc3805fb070 100644 --- a/sound/oss/emu10k1/mixer.c +++ b/sound/oss/emu10k1/mixer.c @@ -681,7 +681,7 @@ static int emu10k1_mixer_release(struct inode *inode, struct file *file) return 0; } -struct file_operations emu10k1_mixer_fops = { +const struct file_operations emu10k1_mixer_fops = { .owner = THIS_MODULE, .llseek = no_llseek, .ioctl = emu10k1_mixer_ioctl, diff --git a/sound/oss/hal2.c b/sound/oss/hal2.c index d18286ccc14..80a42773c64 100644 --- a/sound/oss/hal2.c +++ b/sound/oss/hal2.c @@ -1377,7 +1377,7 @@ static int hal2_release(struct inode *inode, struct file *file) return 0; } -static struct file_operations hal2_audio_fops = { +static const struct file_operations hal2_audio_fops = { .owner = THIS_MODULE, .llseek = no_llseek, .read = hal2_read, @@ -1388,7 +1388,7 @@ static struct file_operations hal2_audio_fops = { .release = hal2_release, }; -static struct file_operations hal2_mixer_fops = { +static const struct file_operations hal2_mixer_fops = { .owner = THIS_MODULE, .llseek = no_llseek, .ioctl = hal2_ioctl_mixdev, diff --git a/sound/oss/msnd_pinnacle.c b/sound/oss/msnd_pinnacle.c index 24110d63b13..f1f49ebf752 100644 --- a/sound/oss/msnd_pinnacle.c +++ b/sound/oss/msnd_pinnacle.c @@ -1106,7 +1106,7 @@ static irqreturn_t intr(int irq, void *dev_id) return IRQ_HANDLED; } -static struct file_operations dev_fileops = { +static const struct file_operations dev_fileops = { .owner = THIS_MODULE, .read = dev_read, .write = dev_write, diff --git a/sound/oss/os.h b/sound/oss/os.h index 0490562c7f7..a1a962d7f67 100644 --- a/sound/oss/os.h +++ b/sound/oss/os.h @@ -43,4 +43,4 @@ extern int sound_nblocks; #undef PSEUDO_DMA_AUTOINIT #define ALLOW_BUFFER_MAPPING -extern struct file_operations oss_sound_fops; +extern const struct file_operations oss_sound_fops; diff --git a/sound/oss/sh_dac_audio.c b/sound/oss/sh_dac_audio.c index 51f554154c4..7ea9accc2ba 100644 --- a/sound/oss/sh_dac_audio.c +++ b/sound/oss/sh_dac_audio.c @@ -255,7 +255,7 @@ static int dac_audio_release(struct inode *inode, struct file *file) return 0; } -struct file_operations dac_audio_fops = { +const struct file_operations dac_audio_fops = { .read = dac_audio_read, .write = dac_audio_write, .ioctl = dac_audio_ioctl, diff --git a/sound/oss/soundcard.c b/sound/oss/soundcard.c index b92c8cd1aea..dcd8d6d2f56 100644 --- a/sound/oss/soundcard.c +++ b/sound/oss/soundcard.c @@ -483,7 +483,7 @@ static int sound_mmap(struct file *file, struct vm_area_struct *vma) return 0; } -struct file_operations oss_sound_fops = { +const struct file_operations oss_sound_fops = { .owner = THIS_MODULE, .llseek = no_llseek, .read = sound_read, diff --git a/sound/oss/via82cxxx_audio.c b/sound/oss/via82cxxx_audio.c index c96cc8c68b3..7ab3a732e18 100644 --- a/sound/oss/via82cxxx_audio.c +++ b/sound/oss/via82cxxx_audio.c @@ -1619,7 +1619,7 @@ out: } -static struct file_operations via_mixer_fops = { +static const struct file_operations via_mixer_fops = { .owner = THIS_MODULE, .open = via_mixer_open, .llseek = no_llseek, @@ -2042,7 +2042,7 @@ static int via_interrupt_init (struct via_info *card) * */ -static struct file_operations via_dsp_fops = { +static const struct file_operations via_dsp_fops = { .owner = THIS_MODULE, .open = via_dsp_open, .release = via_dsp_release, diff --git a/sound/oss/vwsnd.c b/sound/oss/vwsnd.c index 6dfb9f4b03e..d25249a932b 100644 --- a/sound/oss/vwsnd.c +++ b/sound/oss/vwsnd.c @@ -3035,7 +3035,7 @@ static int vwsnd_audio_release(struct inode *inode, struct file *file) return err; } -static struct file_operations vwsnd_audio_fops = { +static const struct file_operations vwsnd_audio_fops = { .owner = THIS_MODULE, .llseek = no_llseek, .read = vwsnd_audio_read, @@ -3225,7 +3225,7 @@ static int vwsnd_mixer_ioctl(struct inode *ioctl, return retval; } -static struct file_operations vwsnd_mixer_fops = { +static const struct file_operations vwsnd_mixer_fops = { .owner = THIS_MODULE, .llseek = no_llseek, .ioctl = vwsnd_mixer_ioctl, -- cgit v1.2.3