aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorArjan van de Ven <arjan@linux.intel.com>2007-02-12 03:55:32 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-12 12:48:45 -0500
commit2b8693c0617e972fc0b2fd1ebf8de97e15b656c3 (patch)
tree3eb7dfbc8d5e4031e4992bdd566e211f5ada71f3 /drivers/infiniband
parent5dfe4c964a0dd7bb3a1d64a4166835a153146207 (diff)
[PATCH] mark struct file_operations const 3
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 <arjan@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/core/ucm.c2
-rw-r--r--drivers/infiniband/core/ucma.c2
-rw-r--r--drivers/infiniband/core/user_mad.c4
-rw-r--r--drivers/infiniband/core/uverbs_main.c6
-rw-r--r--drivers/infiniband/hw/ipath/ipath_diag.c4
-rw-r--r--drivers/infiniband/hw/ipath/ipath_file_ops.c6
-rw-r--r--drivers/infiniband/hw/ipath/ipath_fs.c14
-rw-r--r--drivers/infiniband/hw/ipath/ipath_kernel.h2
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_fs.c4
9 files changed, 22 insertions, 22 deletions
diff --git a/drivers/infiniband/core/ucm.c b/drivers/infiniband/core/ucm.c
index f15220a0ee75..ee51d79a7ad5 100644
--- a/drivers/infiniband/core/ucm.c
+++ b/drivers/infiniband/core/ucm.c
@@ -1221,7 +1221,7 @@ static void ib_ucm_release_class_dev(struct class_device *class_dev)
1221 kfree(dev); 1221 kfree(dev);
1222} 1222}
1223 1223
1224static struct file_operations ucm_fops = { 1224static const struct file_operations ucm_fops = {
1225 .owner = THIS_MODULE, 1225 .owner = THIS_MODULE,
1226 .open = ib_ucm_open, 1226 .open = ib_ucm_open,
1227 .release = ib_ucm_close, 1227 .release = ib_ucm_close,
diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c
index e2e8d329b443..6b81b98961c7 100644
--- a/drivers/infiniband/core/ucma.c
+++ b/drivers/infiniband/core/ucma.c
@@ -833,7 +833,7 @@ static int ucma_close(struct inode *inode, struct file *filp)
833 return 0; 833 return 0;
834} 834}
835 835
836static struct file_operations ucma_fops = { 836static const struct file_operations ucma_fops = {
837 .owner = THIS_MODULE, 837 .owner = THIS_MODULE,
838 .open = ucma_open, 838 .open = ucma_open,
839 .release = ucma_close, 839 .release = ucma_close,
diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c
index 807fbd6b8414..c069ebeba8e3 100644
--- a/drivers/infiniband/core/user_mad.c
+++ b/drivers/infiniband/core/user_mad.c
@@ -771,7 +771,7 @@ static int ib_umad_close(struct inode *inode, struct file *filp)
771 return 0; 771 return 0;
772} 772}
773 773
774static struct file_operations umad_fops = { 774static const struct file_operations umad_fops = {
775 .owner = THIS_MODULE, 775 .owner = THIS_MODULE,
776 .read = ib_umad_read, 776 .read = ib_umad_read,
777 .write = ib_umad_write, 777 .write = ib_umad_write,
@@ -846,7 +846,7 @@ static int ib_umad_sm_close(struct inode *inode, struct file *filp)
846 return ret; 846 return ret;
847} 847}
848 848
849static struct file_operations umad_sm_fops = { 849static const struct file_operations umad_sm_fops = {
850 .owner = THIS_MODULE, 850 .owner = THIS_MODULE,
851 .open = ib_umad_sm_open, 851 .open = ib_umad_sm_open,
852 .release = ib_umad_sm_close 852 .release = ib_umad_sm_close
diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c
index a617ca7b6923..f8bc822a3cc3 100644
--- a/drivers/infiniband/core/uverbs_main.c
+++ b/drivers/infiniband/core/uverbs_main.c
@@ -375,7 +375,7 @@ static int ib_uverbs_event_close(struct inode *inode, struct file *filp)
375 return 0; 375 return 0;
376} 376}
377 377
378static struct file_operations uverbs_event_fops = { 378static const struct file_operations uverbs_event_fops = {
379 .owner = THIS_MODULE, 379 .owner = THIS_MODULE,
380 .read = ib_uverbs_event_read, 380 .read = ib_uverbs_event_read,
381 .poll = ib_uverbs_event_poll, 381 .poll = ib_uverbs_event_poll,
@@ -679,14 +679,14 @@ static int ib_uverbs_close(struct inode *inode, struct file *filp)
679 return 0; 679 return 0;
680} 680}
681 681
682static struct file_operations uverbs_fops = { 682static const struct file_operations uverbs_fops = {
683 .owner = THIS_MODULE, 683 .owner = THIS_MODULE,
684 .write = ib_uverbs_write, 684 .write = ib_uverbs_write,
685 .open = ib_uverbs_open, 685 .open = ib_uverbs_open,
686 .release = ib_uverbs_close 686 .release = ib_uverbs_close
687}; 687};
688 688
689static struct file_operations uverbs_mmap_fops = { 689static const struct file_operations uverbs_mmap_fops = {
690 .owner = THIS_MODULE, 690 .owner = THIS_MODULE,
691 .write = ib_uverbs_write, 691 .write = ib_uverbs_write,
692 .mmap = ib_uverbs_mmap, 692 .mmap = ib_uverbs_mmap,
diff --git a/drivers/infiniband/hw/ipath/ipath_diag.c b/drivers/infiniband/hw/ipath/ipath_diag.c
index 28c087b824c2..0f13a2182cc7 100644
--- a/drivers/infiniband/hw/ipath/ipath_diag.c
+++ b/drivers/infiniband/hw/ipath/ipath_diag.c
@@ -59,7 +59,7 @@ static ssize_t ipath_diag_read(struct file *fp, char __user *data,
59static ssize_t ipath_diag_write(struct file *fp, const char __user *data, 59static ssize_t ipath_diag_write(struct file *fp, const char __user *data,
60 size_t count, loff_t *off); 60 size_t count, loff_t *off);
61 61
62static struct file_operations diag_file_ops = { 62static const struct file_operations diag_file_ops = {
63 .owner = THIS_MODULE, 63 .owner = THIS_MODULE,
64 .write = ipath_diag_write, 64 .write = ipath_diag_write,
65 .read = ipath_diag_read, 65 .read = ipath_diag_read,
@@ -71,7 +71,7 @@ static ssize_t ipath_diagpkt_write(struct file *fp,
71 const char __user *data, 71 const char __user *data,
72 size_t count, loff_t *off); 72 size_t count, loff_t *off);
73 73
74static struct file_operations diagpkt_file_ops = { 74static const struct file_operations diagpkt_file_ops = {
75 .owner = THIS_MODULE, 75 .owner = THIS_MODULE,
76 .write = ipath_diagpkt_write, 76 .write = ipath_diagpkt_write,
77}; 77};
diff --git a/drivers/infiniband/hw/ipath/ipath_file_ops.c b/drivers/infiniband/hw/ipath/ipath_file_ops.c
index b932bcb67a5e..5d64ff875297 100644
--- a/drivers/infiniband/hw/ipath/ipath_file_ops.c
+++ b/drivers/infiniband/hw/ipath/ipath_file_ops.c
@@ -54,7 +54,7 @@ static ssize_t ipath_write(struct file *, const char __user *, size_t,
54static unsigned int ipath_poll(struct file *, struct poll_table_struct *); 54static unsigned int ipath_poll(struct file *, struct poll_table_struct *);
55static int ipath_mmap(struct file *, struct vm_area_struct *); 55static int ipath_mmap(struct file *, struct vm_area_struct *);
56 56
57static struct file_operations ipath_file_ops = { 57static const struct file_operations ipath_file_ops = {
58 .owner = THIS_MODULE, 58 .owner = THIS_MODULE,
59 .write = ipath_write, 59 .write = ipath_write,
60 .open = ipath_open, 60 .open = ipath_open,
@@ -2153,7 +2153,7 @@ bail:
2153 2153
2154static struct class *ipath_class; 2154static struct class *ipath_class;
2155 2155
2156static int init_cdev(int minor, char *name, struct file_operations *fops, 2156static int init_cdev(int minor, char *name, const struct file_operations *fops,
2157 struct cdev **cdevp, struct class_device **class_devp) 2157 struct cdev **cdevp, struct class_device **class_devp)
2158{ 2158{
2159 const dev_t dev = MKDEV(IPATH_MAJOR, minor); 2159 const dev_t dev = MKDEV(IPATH_MAJOR, minor);
@@ -2210,7 +2210,7 @@ done:
2210 return ret; 2210 return ret;
2211} 2211}
2212 2212
2213int ipath_cdev_init(int minor, char *name, struct file_operations *fops, 2213int ipath_cdev_init(int minor, char *name, const struct file_operations *fops,
2214 struct cdev **cdevp, struct class_device **class_devp) 2214 struct cdev **cdevp, struct class_device **class_devp)
2215{ 2215{
2216 return init_cdev(minor, name, fops, cdevp, class_devp); 2216 return init_cdev(minor, name, fops, cdevp, class_devp);
diff --git a/drivers/infiniband/hw/ipath/ipath_fs.c b/drivers/infiniband/hw/ipath/ipath_fs.c
index 79a60f020a21..5b40a846ff95 100644
--- a/drivers/infiniband/hw/ipath/ipath_fs.c
+++ b/drivers/infiniband/hw/ipath/ipath_fs.c
@@ -47,7 +47,7 @@
47static struct super_block *ipath_super; 47static struct super_block *ipath_super;
48 48
49static int ipathfs_mknod(struct inode *dir, struct dentry *dentry, 49static int ipathfs_mknod(struct inode *dir, struct dentry *dentry,
50 int mode, struct file_operations *fops, 50 int mode, const struct file_operations *fops,
51 void *data) 51 void *data)
52{ 52{
53 int error; 53 int error;
@@ -81,7 +81,7 @@ bail:
81 81
82static int create_file(const char *name, mode_t mode, 82static int create_file(const char *name, mode_t mode,
83 struct dentry *parent, struct dentry **dentry, 83 struct dentry *parent, struct dentry **dentry,
84 struct file_operations *fops, void *data) 84 const struct file_operations *fops, void *data)
85{ 85{
86 int error; 86 int error;
87 87
@@ -105,7 +105,7 @@ static ssize_t atomic_stats_read(struct file *file, char __user *buf,
105 sizeof ipath_stats); 105 sizeof ipath_stats);
106} 106}
107 107
108static struct file_operations atomic_stats_ops = { 108static const struct file_operations atomic_stats_ops = {
109 .read = atomic_stats_read, 109 .read = atomic_stats_read,
110}; 110};
111 111
@@ -127,7 +127,7 @@ static ssize_t atomic_counters_read(struct file *file, char __user *buf,
127 sizeof counters); 127 sizeof counters);
128} 128}
129 129
130static struct file_operations atomic_counters_ops = { 130static const struct file_operations atomic_counters_ops = {
131 .read = atomic_counters_read, 131 .read = atomic_counters_read,
132}; 132};
133 133
@@ -166,7 +166,7 @@ static ssize_t atomic_node_info_read(struct file *file, char __user *buf,
166 sizeof nodeinfo); 166 sizeof nodeinfo);
167} 167}
168 168
169static struct file_operations atomic_node_info_ops = { 169static const struct file_operations atomic_node_info_ops = {
170 .read = atomic_node_info_read, 170 .read = atomic_node_info_read,
171}; 171};
172 172
@@ -291,7 +291,7 @@ static ssize_t atomic_port_info_read(struct file *file, char __user *buf,
291 sizeof portinfo); 291 sizeof portinfo);
292} 292}
293 293
294static struct file_operations atomic_port_info_ops = { 294static const struct file_operations atomic_port_info_ops = {
295 .read = atomic_port_info_read, 295 .read = atomic_port_info_read,
296}; 296};
297 297
@@ -394,7 +394,7 @@ bail:
394 return ret; 394 return ret;
395} 395}
396 396
397static struct file_operations flash_ops = { 397static const struct file_operations flash_ops = {
398 .read = flash_read, 398 .read = flash_read,
399 .write = flash_write, 399 .write = flash_write,
400}; 400};
diff --git a/drivers/infiniband/hw/ipath/ipath_kernel.h b/drivers/infiniband/hw/ipath/ipath_kernel.h
index 986b2125b8f5..6d8d05fb5999 100644
--- a/drivers/infiniband/hw/ipath/ipath_kernel.h
+++ b/drivers/infiniband/hw/ipath/ipath_kernel.h
@@ -593,7 +593,7 @@ void ipath_shutdown_device(struct ipath_devdata *);
593void ipath_disarm_senderrbufs(struct ipath_devdata *); 593void ipath_disarm_senderrbufs(struct ipath_devdata *);
594 594
595struct file_operations; 595struct file_operations;
596int ipath_cdev_init(int minor, char *name, struct file_operations *fops, 596int ipath_cdev_init(int minor, char *name, const struct file_operations *fops,
597 struct cdev **cdevp, struct class_device **class_devp); 597 struct cdev **cdevp, struct class_device **class_devp);
598void ipath_cdev_cleanup(struct cdev **cdevp, 598void ipath_cdev_cleanup(struct cdev **cdevp,
599 struct class_device **class_devp); 599 struct class_device **class_devp);
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_fs.c b/drivers/infiniband/ulp/ipoib/ipoib_fs.c
index f1cb83688b31..44c174182a82 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_fs.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_fs.c
@@ -146,7 +146,7 @@ static int ipoib_mcg_open(struct inode *inode, struct file *file)
146 return 0; 146 return 0;
147} 147}
148 148
149static struct file_operations ipoib_mcg_fops = { 149static const struct file_operations ipoib_mcg_fops = {
150 .owner = THIS_MODULE, 150 .owner = THIS_MODULE,
151 .open = ipoib_mcg_open, 151 .open = ipoib_mcg_open,
152 .read = seq_read, 152 .read = seq_read,
@@ -252,7 +252,7 @@ static int ipoib_path_open(struct inode *inode, struct file *file)
252 return 0; 252 return 0;
253} 253}
254 254
255static struct file_operations ipoib_path_fops = { 255static const struct file_operations ipoib_path_fops = {
256 .owner = THIS_MODULE, 256 .owner = THIS_MODULE,
257 .open = ipoib_path_open, 257 .open = ipoib_path_open,
258 .read = seq_read, 258 .read = seq_read,