From 5dfe4c964a0dd7bb3a1d64a4166835a153146207 Mon Sep 17 00:00:00 2001 From: Arjan van de Ven Date: Mon, 12 Feb 2007 00:55:31 -0800 Subject: [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: Arjan van de Ven Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/cris/arch-v10/drivers/ds1302.c | 2 +- arch/cris/arch-v10/drivers/eeprom.c | 2 +- arch/cris/arch-v10/drivers/gpio.c | 2 +- arch/cris/arch-v10/drivers/i2c.c | 2 +- arch/cris/arch-v10/drivers/pcf8563.c | 2 +- arch/cris/arch-v32/drivers/cryptocop.c | 2 +- arch/cris/arch-v32/drivers/gpio.c | 2 +- arch/cris/arch-v32/drivers/i2c.c | 2 +- arch/cris/arch-v32/drivers/pcf8563.c | 2 +- arch/cris/arch-v32/drivers/sync_serial.c | 2 +- arch/cris/kernel/profile.c | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) (limited to 'arch/cris') diff --git a/arch/cris/arch-v10/drivers/ds1302.c b/arch/cris/arch-v10/drivers/ds1302.c index 3cf4f23de1d..88eff7f54ea 100644 --- a/arch/cris/arch-v10/drivers/ds1302.c +++ b/arch/cris/arch-v10/drivers/ds1302.c @@ -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, }; diff --git a/arch/cris/arch-v10/drivers/eeprom.c b/arch/cris/arch-v10/drivers/eeprom.c index 284ebfda03f..be35a70798a 100644 --- a/arch/cris/arch-v10/drivers/eeprom.c +++ b/arch/cris/arch-v10/drivers/eeprom.c @@ -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, diff --git a/arch/cris/arch-v10/drivers/gpio.c b/arch/cris/arch-v10/drivers/gpio.c index 9aba18b931d..f389ed6998f 100644 --- a/arch/cris/arch-v10/drivers/gpio.c +++ b/arch/cris/arch-v10/drivers/gpio.c @@ -838,7 +838,7 @@ gpio_leds_ioctl(unsigned int cmd, unsigned long arg) return 0; } -struct file_operations gpio_fops = { +const struct file_operations gpio_fops = { .owner = THIS_MODULE, .poll = gpio_poll, .ioctl = gpio_ioctl, diff --git a/arch/cris/arch-v10/drivers/i2c.c b/arch/cris/arch-v10/drivers/i2c.c index 092c724a645..aca81ddaf60 100644 --- a/arch/cris/arch-v10/drivers/i2c.c +++ b/arch/cris/arch-v10/drivers/i2c.c @@ -692,7 +692,7 @@ i2c_ioctl(struct inode *inode, struct file *file, return 0; } -static struct file_operations i2c_fops = { +static const struct file_operations i2c_fops = { .owner = THIS_MODULE, .ioctl = i2c_ioctl, .open = i2c_open, diff --git a/arch/cris/arch-v10/drivers/pcf8563.c b/arch/cris/arch-v10/drivers/pcf8563.c index 8c830eefc89..107796e5014 100644 --- a/arch/cris/arch-v10/drivers/pcf8563.c +++ b/arch/cris/arch-v10/drivers/pcf8563.c @@ -56,7 +56,7 @@ static const unsigned char days_in_month[] = int pcf8563_ioctl(struct inode *, struct file *, unsigned int, unsigned long); -static struct file_operations pcf8563_fops = { +static const struct file_operations pcf8563_fops = { .owner = THIS_MODULE, .ioctl = pcf8563_ioctl, }; diff --git a/arch/cris/arch-v32/drivers/cryptocop.c b/arch/cris/arch-v32/drivers/cryptocop.c index 2449637e6fc..1a071f17446 100644 --- a/arch/cris/arch-v32/drivers/cryptocop.c +++ b/arch/cris/arch-v32/drivers/cryptocop.c @@ -266,7 +266,7 @@ static void print_user_dma_lists(struct cryptocop_dma_list_operation *dma_op); -struct file_operations cryptocop_fops = { +const struct file_operations cryptocop_fops = { owner: THIS_MODULE, open: cryptocop_open, release: cryptocop_release, diff --git a/arch/cris/arch-v32/drivers/gpio.c b/arch/cris/arch-v32/drivers/gpio.c index 08d36f0955c..d82c5c56113 100644 --- a/arch/cris/arch-v32/drivers/gpio.c +++ b/arch/cris/arch-v32/drivers/gpio.c @@ -705,7 +705,7 @@ gpio_leds_ioctl(unsigned int cmd, unsigned long arg) return 0; } -struct file_operations gpio_fops = { +const struct file_operations gpio_fops = { .owner = THIS_MODULE, .poll = gpio_poll, .ioctl = gpio_ioctl, diff --git a/arch/cris/arch-v32/drivers/i2c.c b/arch/cris/arch-v32/drivers/i2c.c index 95f00188c62..5d6c52737df 100644 --- a/arch/cris/arch-v32/drivers/i2c.c +++ b/arch/cris/arch-v32/drivers/i2c.c @@ -573,7 +573,7 @@ i2c_ioctl(struct inode *inode, struct file *file, return 0; } -static struct file_operations i2c_fops = { +static const struct file_operations i2c_fops = { owner: THIS_MODULE, ioctl: i2c_ioctl, open: i2c_open, diff --git a/arch/cris/arch-v32/drivers/pcf8563.c b/arch/cris/arch-v32/drivers/pcf8563.c index 2fc7d75a35d..544ab017941 100644 --- a/arch/cris/arch-v32/drivers/pcf8563.c +++ b/arch/cris/arch-v32/drivers/pcf8563.c @@ -50,7 +50,7 @@ int pcf8563_ioctl(struct inode *, struct file *, unsigned int, unsigned long); int pcf8563_open(struct inode *, struct file *); int pcf8563_release(struct inode *, struct file *); -static struct file_operations pcf8563_fops = { +static const struct file_operations pcf8563_fops = { owner: THIS_MODULE, ioctl: pcf8563_ioctl, open: pcf8563_open, diff --git a/arch/cris/arch-v32/drivers/sync_serial.c b/arch/cris/arch-v32/drivers/sync_serial.c index 424eb0eb1cd..df89298aafc 100644 --- a/arch/cris/arch-v32/drivers/sync_serial.c +++ b/arch/cris/arch-v32/drivers/sync_serial.c @@ -187,7 +187,7 @@ static struct sync_port ports[]= #define NUMBER_OF_PORTS (sizeof(ports)/sizeof(sync_port)) -static struct file_operations sync_serial_fops = { +static const struct file_operations sync_serial_fops = { .owner = THIS_MODULE, .write = sync_serial_write, .read = sync_serial_read, diff --git a/arch/cris/kernel/profile.c b/arch/cris/kernel/profile.c index f60ab785f23..4cfcae62050 100644 --- a/arch/cris/kernel/profile.c +++ b/arch/cris/kernel/profile.c @@ -50,7 +50,7 @@ write_cris_profile(struct file *file, const char __user *buf, memset(sample_buffer, 0, SAMPLE_BUFFER_SIZE); } -static struct file_operations cris_proc_profile_operations = { +static const struct file_operations cris_proc_profile_operations = { .read = read_cris_profile, .write = write_cris_profile, }; -- cgit v1.2.3