Skip to content

Commit 62322d2

Browse files
Arjan van de VenLinus Torvalds
authored andcommitted
[PATCH] make more file_operation structs static
Mark the static struct file_operations in drivers/char as const. Making them const prevents accidental bugs, and moves them to the .rodata section so that they no longer do any false sharing; in addition with the proper debug option they are then protected against corruption.. [akpm@osdl.org: build fix] Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1 parent d459ec0 commit 62322d2

97 files changed

Lines changed: 118 additions & 118 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎drivers/char/agp/frontend.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1059,7 +1059,7 @@ static int agp_ioctl(struct inode *inode, struct file *file,
10591059
return ret_val;
10601060
}
10611061

1062-
static struct file_operations agp_fops =
1062+
static const struct file_operations agp_fops =
10631063
{
10641064
.owner = THIS_MODULE,
10651065
.llseek = no_llseek,

‎drivers/char/applicom.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ static int ac_ioctl(struct inode *, struct file *, unsigned int,
112112
unsigned long);
113113
static irqreturn_t ac_interrupt(int, void *, struct pt_regs *);
114114

115-
static struct file_operations ac_fops = {
115+
static const struct file_operations ac_fops = {
116116
.owner = THIS_MODULE,
117117
.llseek = no_llseek,
118118
.read = ac_read,

‎drivers/char/cs5535_gpio.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ static int cs5535_gpio_open(struct inode *inode, struct file *file)
158158
return nonseekable_open(inode, file);
159159
}
160160

161-
static struct file_operations cs5535_gpio_fops = {
161+
static const struct file_operations cs5535_gpio_fops = {
162162
.owner = THIS_MODULE,
163163
.write = cs5535_gpio_write,
164164
.read = cs5535_gpio_read,

‎drivers/char/ds1286.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ static unsigned int ds1286_poll(struct file *file, poll_table *wait)
281281
* The various file operations we support.
282282
*/
283283

284-
static struct file_operations ds1286_fops = {
284+
static const struct file_operations ds1286_fops = {
285285
.llseek = no_llseek,
286286
.read = ds1286_read,
287287
.poll = ds1286_poll,

‎drivers/char/ds1302.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ get_rtc_status(char *buf)
282282

283283
/* The various file operations we support. */
284284

285-
static struct file_operations rtc_fops = {
285+
static const struct file_operations rtc_fops = {
286286
.owner = THIS_MODULE,
287287
.ioctl = rtc_ioctl,
288288
};

‎drivers/char/ds1620.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ proc_therm_ds1620_read(char *buf, char **start, off_t offset,
336336
static struct proc_dir_entry *proc_therm_ds1620;
337337
#endif
338338

339-
static struct file_operations ds1620_fops = {
339+
static const struct file_operations ds1620_fops = {
340340
.owner = THIS_MODULE,
341341
.open = nonseekable_open,
342342
.read = ds1620_read,

‎drivers/char/dsp56k.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ static int dsp56k_release(struct inode *inode, struct file *file)
483483
return 0;
484484
}
485485

486-
static struct file_operations dsp56k_fops = {
486+
static const struct file_operations dsp56k_fops = {
487487
.owner = THIS_MODULE,
488488
.read = dsp56k_read,
489489
.write = dsp56k_write,

‎drivers/char/dtlk.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ static int dtlk_release(struct inode *, struct file *);
9494
static int dtlk_ioctl(struct inode *inode, struct file *file,
9595
unsigned int cmd, unsigned long arg);
9696

97-
static struct file_operations dtlk_fops =
97+
static const struct file_operations dtlk_fops =
9898
{
9999
.owner = THIS_MODULE,
100100
.read = dtlk_read,

‎drivers/char/efirtc.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ efi_rtc_close(struct inode *inode, struct file *file)
285285
* The various file operations we support.
286286
*/
287287

288-
static struct file_operations efi_rtc_fops = {
288+
static const struct file_operations efi_rtc_fops = {
289289
.owner = THIS_MODULE,
290290
.ioctl = efi_rtc_ioctl,
291291
.open = efi_rtc_open,

‎drivers/char/ftape/zftape/zftape-init.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ static ssize_t zft_read (struct file *fp, char __user *buff,
8686
static ssize_t zft_write(struct file *fp, const char __user *buff,
8787
size_t req_len, loff_t *ppos);
8888

89-
static struct file_operations zft_cdev =
89+
static const struct file_operations zft_cdev =
9090
{
9191
.owner = THIS_MODULE,
9292
.read = zft_read,

0 commit comments

Comments
 (0)