aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorLuiz Fernando N. Capitulino <lcapitulino@mandriva.com.br>2006-08-05 19:37:11 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2006-09-27 14:58:52 -0400
commit066202dd48cf3296b6cc22b5fcf89aef33fa0efc (patch)
tree1730104f5b1634e0dca42c5ea7a331fb1c773813 /drivers/usb
parentf2ebf92c9e1930a8f79b7eb49a32122931929014 (diff)
USB: Make file operations structs in drivers/usb const.
Making structs const prevents accidental bugs and with the proper debug options they're protected against corruption. Signed-off-by: Luiz Fernando N. Capitulino <lcapitulino@mandriva.com.br> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/class/usblp.c2
-rw-r--r--drivers/usb/core/devices.c2
-rw-r--r--drivers/usb/core/devio.c2
-rw-r--r--drivers/usb/core/file.c2
-rw-r--r--drivers/usb/core/inode.c6
-rw-r--r--drivers/usb/core/usb.h4
-rw-r--r--drivers/usb/gadget/at91_udc.c2
-rw-r--r--drivers/usb/gadget/inode.c8
-rw-r--r--drivers/usb/gadget/omap_udc.c2
-rw-r--r--drivers/usb/host/isp116x-hcd.c2
-rw-r--r--drivers/usb/host/sl811-hcd.c2
-rw-r--r--drivers/usb/host/uhci-debug.c4
-rw-r--r--drivers/usb/image/mdc800.c4
-rw-r--r--drivers/usb/input/hiddev.c2
-rw-r--r--drivers/usb/misc/auerswald.c2
-rw-r--r--drivers/usb/misc/idmouse.c2
-rw-r--r--drivers/usb/misc/ldusb.c2
-rw-r--r--drivers/usb/misc/legousbtower.c2
-rw-r--r--drivers/usb/misc/sisusbvga/sisusb.c2
-rw-r--r--drivers/usb/misc/usblcd.c2
-rw-r--r--drivers/usb/mon/mon_stat.c2
-rw-r--r--drivers/usb/mon/mon_text.c2
-rw-r--r--drivers/usb/mon/usb_mon.h4
-rw-r--r--drivers/usb/usb-skeleton.c2
24 files changed, 33 insertions, 33 deletions
diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c
index 48dee4b8d8e5..292919d260a0 100644
--- a/drivers/usb/class/usblp.c
+++ b/drivers/usb/class/usblp.c
@@ -813,7 +813,7 @@ static unsigned int usblp_quirks (__u16 vendor, __u16 product)
813 return 0; 813 return 0;
814} 814}
815 815
816static struct file_operations usblp_fops = { 816static const struct file_operations usblp_fops = {
817 .owner = THIS_MODULE, 817 .owner = THIS_MODULE,
818 .read = usblp_read, 818 .read = usblp_read,
819 .write = usblp_write, 819 .write = usblp_write,
diff --git a/drivers/usb/core/devices.c b/drivers/usb/core/devices.c
index c0f37343a276..241d37326ea9 100644
--- a/drivers/usb/core/devices.c
+++ b/drivers/usb/core/devices.c
@@ -667,7 +667,7 @@ static loff_t usb_device_lseek(struct file * file, loff_t offset, int orig)
667 return ret; 667 return ret;
668} 668}
669 669
670struct file_operations usbfs_devices_fops = { 670const struct file_operations usbfs_devices_fops = {
671 .llseek = usb_device_lseek, 671 .llseek = usb_device_lseek,
672 .read = usb_device_read, 672 .read = usb_device_read,
673 .poll = usb_device_poll, 673 .poll = usb_device_poll,
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index e84f19d4089c..43c08724a2d8 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -1572,7 +1572,7 @@ static unsigned int usbdev_poll(struct file *file, struct poll_table_struct *wai
1572 return mask; 1572 return mask;
1573} 1573}
1574 1574
1575struct file_operations usbfs_device_file_operations = { 1575const struct file_operations usbfs_device_file_operations = {
1576 .llseek = usbdev_lseek, 1576 .llseek = usbdev_lseek,
1577 .read = usbdev_read, 1577 .read = usbdev_read,
1578 .poll = usbdev_poll, 1578 .poll = usbdev_poll,
diff --git a/drivers/usb/core/file.c b/drivers/usb/core/file.c
index 8de4f8c99d61..c376c655c5de 100644
--- a/drivers/usb/core/file.c
+++ b/drivers/usb/core/file.c
@@ -55,7 +55,7 @@ static int usb_open(struct inode * inode, struct file * file)
55 return err; 55 return err;
56} 56}
57 57
58static struct file_operations usb_fops = { 58static const struct file_operations usb_fops = {
59 .owner = THIS_MODULE, 59 .owner = THIS_MODULE,
60 .open = usb_open, 60 .open = usb_open,
61}; 61};
diff --git a/drivers/usb/core/inode.c b/drivers/usb/core/inode.c
index 58b4b1012120..df3d152f0493 100644
--- a/drivers/usb/core/inode.c
+++ b/drivers/usb/core/inode.c
@@ -44,7 +44,7 @@
44#include "hcd.h" 44#include "hcd.h"
45 45
46static struct super_operations usbfs_ops; 46static struct super_operations usbfs_ops;
47static struct file_operations default_file_operations; 47static const struct file_operations default_file_operations;
48static struct vfsmount *usbfs_mount; 48static struct vfsmount *usbfs_mount;
49static int usbfs_mount_count; /* = 0 */ 49static int usbfs_mount_count; /* = 0 */
50static int ignore_mount = 0; 50static int ignore_mount = 0;
@@ -407,7 +407,7 @@ static int default_open (struct inode *inode, struct file *file)
407 return 0; 407 return 0;
408} 408}
409 409
410static struct file_operations default_file_operations = { 410static const struct file_operations default_file_operations = {
411 .read = default_read_file, 411 .read = default_read_file,
412 .write = default_write_file, 412 .write = default_write_file,
413 .open = default_open, 413 .open = default_open,
@@ -494,7 +494,7 @@ static int fs_create_by_name (const char *name, mode_t mode,
494 494
495static struct dentry *fs_create_file (const char *name, mode_t mode, 495static struct dentry *fs_create_file (const char *name, mode_t mode,
496 struct dentry *parent, void *data, 496 struct dentry *parent, void *data,
497 struct file_operations *fops, 497 const struct file_operations *fops,
498 uid_t uid, gid_t gid) 498 uid_t uid, gid_t gid)
499{ 499{
500 struct dentry *dentry; 500 struct dentry *dentry;
diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h
index 98675fb1bc4c..6096ead2758c 100644
--- a/drivers/usb/core/usb.h
+++ b/drivers/usb/core/usb.h
@@ -90,8 +90,8 @@ extern const char *usbcore_name;
90/* usbfs stuff */ 90/* usbfs stuff */
91extern struct mutex usbfs_mutex; 91extern struct mutex usbfs_mutex;
92extern struct usb_driver usbfs_driver; 92extern struct usb_driver usbfs_driver;
93extern struct file_operations usbfs_devices_fops; 93extern const struct file_operations usbfs_devices_fops;
94extern struct file_operations usbfs_device_file_operations; 94extern const struct file_operations usbfs_device_file_operations;
95extern void usbfs_conn_disc_event(void); 95extern void usbfs_conn_disc_event(void);
96 96
97extern int usbdev_init(void); 97extern int usbdev_init(void);
diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c
index cfebca05ead5..d00958a01cfb 100644
--- a/drivers/usb/gadget/at91_udc.c
+++ b/drivers/usb/gadget/at91_udc.c
@@ -247,7 +247,7 @@ static int proc_udc_open(struct inode *inode, struct file *file)
247 return single_open(file, proc_udc_show, PDE(inode)->data); 247 return single_open(file, proc_udc_show, PDE(inode)->data);
248} 248}
249 249
250static struct file_operations proc_ops = { 250static const struct file_operations proc_ops = {
251 .open = proc_udc_open, 251 .open = proc_udc_open,
252 .read = seq_read, 252 .read = seq_read,
253 .llseek = seq_lseek, 253 .llseek = seq_lseek,
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c
index ab508858f341..1072e987ff21 100644
--- a/drivers/usb/gadget/inode.c
+++ b/drivers/usb/gadget/inode.c
@@ -714,7 +714,7 @@ ep_aio_write(struct kiocb *iocb, const char __user *ubuf, size_t len, loff_t o)
714/*----------------------------------------------------------------------*/ 714/*----------------------------------------------------------------------*/
715 715
716/* used after endpoint configuration */ 716/* used after endpoint configuration */
717static struct file_operations ep_io_operations = { 717static const struct file_operations ep_io_operations = {
718 .owner = THIS_MODULE, 718 .owner = THIS_MODULE,
719 .llseek = no_llseek, 719 .llseek = no_llseek,
720 720
@@ -873,7 +873,7 @@ ep_open (struct inode *inode, struct file *fd)
873} 873}
874 874
875/* used before endpoint configuration */ 875/* used before endpoint configuration */
876static struct file_operations ep_config_operations = { 876static const struct file_operations ep_config_operations = {
877 .owner = THIS_MODULE, 877 .owner = THIS_MODULE,
878 .llseek = no_llseek, 878 .llseek = no_llseek,
879 879
@@ -1247,7 +1247,7 @@ static int dev_ioctl (struct inode *inode, struct file *fd,
1247} 1247}
1248 1248
1249/* used after device configuration */ 1249/* used after device configuration */
1250static struct file_operations ep0_io_operations = { 1250static const struct file_operations ep0_io_operations = {
1251 .owner = THIS_MODULE, 1251 .owner = THIS_MODULE,
1252 .llseek = no_llseek, 1252 .llseek = no_llseek,
1253 1253
@@ -1929,7 +1929,7 @@ dev_open (struct inode *inode, struct file *fd)
1929 return value; 1929 return value;
1930} 1930}
1931 1931
1932static struct file_operations dev_init_operations = { 1932static const struct file_operations dev_init_operations = {
1933 .owner = THIS_MODULE, 1933 .owner = THIS_MODULE,
1934 .llseek = no_llseek, 1934 .llseek = no_llseek,
1935 1935
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c
index 81f0389fcc94..0a64504c2545 100644
--- a/drivers/usb/gadget/omap_udc.c
+++ b/drivers/usb/gadget/omap_udc.c
@@ -2437,7 +2437,7 @@ static int proc_udc_open(struct inode *inode, struct file *file)
2437 return single_open(file, proc_udc_show, NULL); 2437 return single_open(file, proc_udc_show, NULL);
2438} 2438}
2439 2439
2440static struct file_operations proc_ops = { 2440static const struct file_operations proc_ops = {
2441 .open = proc_udc_open, 2441 .open = proc_udc_open,
2442 .read = seq_read, 2442 .read = seq_read,
2443 .llseek = seq_lseek, 2443 .llseek = seq_lseek,
diff --git a/drivers/usb/host/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c
index 8c6b38a0b5bb..a72e041df8e7 100644
--- a/drivers/usb/host/isp116x-hcd.c
+++ b/drivers/usb/host/isp116x-hcd.c
@@ -1207,7 +1207,7 @@ static int isp116x_open_seq(struct inode *inode, struct file *file)
1207 return single_open(file, isp116x_show_dbg, inode->i_private); 1207 return single_open(file, isp116x_show_dbg, inode->i_private);
1208} 1208}
1209 1209
1210static struct file_operations isp116x_debug_fops = { 1210static const struct file_operations isp116x_debug_fops = {
1211 .open = isp116x_open_seq, 1211 .open = isp116x_open_seq,
1212 .read = seq_read, 1212 .read = seq_read,
1213 .llseek = seq_lseek, 1213 .llseek = seq_lseek,
diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c
index 9de115d9db27..8c17da37600b 100644
--- a/drivers/usb/host/sl811-hcd.c
+++ b/drivers/usb/host/sl811-hcd.c
@@ -1517,7 +1517,7 @@ static int proc_sl811h_open(struct inode *inode, struct file *file)
1517 return single_open(file, proc_sl811h_show, PDE(inode)->data); 1517 return single_open(file, proc_sl811h_show, PDE(inode)->data);
1518} 1518}
1519 1519
1520static struct file_operations proc_ops = { 1520static const struct file_operations proc_ops = {
1521 .open = proc_sl811h_open, 1521 .open = proc_sl811h_open,
1522 .read = seq_read, 1522 .read = seq_read,
1523 .llseek = seq_lseek, 1523 .llseek = seq_lseek,
diff --git a/drivers/usb/host/uhci-debug.c b/drivers/usb/host/uhci-debug.c
index d1372cb27f33..e345f15b7d87 100644
--- a/drivers/usb/host/uhci-debug.c
+++ b/drivers/usb/host/uhci-debug.c
@@ -16,7 +16,7 @@
16 16
17#include "uhci-hcd.h" 17#include "uhci-hcd.h"
18 18
19#define uhci_debug_operations (* (struct file_operations *) NULL) 19#define uhci_debug_operations (* (const struct file_operations *) NULL)
20static struct dentry *uhci_debugfs_root; 20static struct dentry *uhci_debugfs_root;
21 21
22#ifdef DEBUG 22#ifdef DEBUG
@@ -500,7 +500,7 @@ static int uhci_debug_release(struct inode *inode, struct file *file)
500} 500}
501 501
502#undef uhci_debug_operations 502#undef uhci_debug_operations
503static struct file_operations uhci_debug_operations = { 503static const struct file_operations uhci_debug_operations = {
504 .owner = THIS_MODULE, 504 .owner = THIS_MODULE,
505 .open = uhci_debug_open, 505 .open = uhci_debug_open,
506 .llseek = uhci_debug_lseek, 506 .llseek = uhci_debug_lseek,
diff --git a/drivers/usb/image/mdc800.c b/drivers/usb/image/mdc800.c
index 08daf400f985..ca6305c1d64c 100644
--- a/drivers/usb/image/mdc800.c
+++ b/drivers/usb/image/mdc800.c
@@ -424,7 +424,7 @@ static void mdc800_usb_download_notify (struct urb *urb, struct pt_regs *res)
424 ***************************************************************************/ 424 ***************************************************************************/
425 425
426static struct usb_driver mdc800_usb_driver; 426static struct usb_driver mdc800_usb_driver;
427static struct file_operations mdc800_device_ops; 427static const struct file_operations mdc800_device_ops;
428static struct usb_class_driver mdc800_class = { 428static struct usb_class_driver mdc800_class = {
429 .name = "mdc800%d", 429 .name = "mdc800%d",
430 .fops = &mdc800_device_ops, 430 .fops = &mdc800_device_ops,
@@ -941,7 +941,7 @@ static ssize_t mdc800_device_write (struct file *file, const char __user *buf, s
941****************************************************************************/ 941****************************************************************************/
942 942
943/* File Operations of this drivers */ 943/* File Operations of this drivers */
944static struct file_operations mdc800_device_ops = 944static const struct file_operations mdc800_device_ops =
945{ 945{
946 .owner = THIS_MODULE, 946 .owner = THIS_MODULE,
947 .read = mdc800_device_read, 947 .read = mdc800_device_read,
diff --git a/drivers/usb/input/hiddev.c b/drivers/usb/input/hiddev.c
index f6b839c257a7..a2b419d13740 100644
--- a/drivers/usb/input/hiddev.c
+++ b/drivers/usb/input/hiddev.c
@@ -722,7 +722,7 @@ inval:
722 return -EINVAL; 722 return -EINVAL;
723} 723}
724 724
725static struct file_operations hiddev_fops = { 725static const struct file_operations hiddev_fops = {
726 .owner = THIS_MODULE, 726 .owner = THIS_MODULE,
727 .read = hiddev_read, 727 .read = hiddev_read,
728 .write = hiddev_write, 728 .write = hiddev_write,
diff --git a/drivers/usb/misc/auerswald.c b/drivers/usb/misc/auerswald.c
index 1fef36e71c57..4a329d8488b7 100644
--- a/drivers/usb/misc/auerswald.c
+++ b/drivers/usb/misc/auerswald.c
@@ -1858,7 +1858,7 @@ static int auerchar_release (struct inode *inode, struct file *file)
1858 1858
1859/*----------------------------------------------------------------------*/ 1859/*----------------------------------------------------------------------*/
1860/* File operation structure */ 1860/* File operation structure */
1861static struct file_operations auerswald_fops = 1861static const struct file_operations auerswald_fops =
1862{ 1862{
1863 .owner = THIS_MODULE, 1863 .owner = THIS_MODULE,
1864 .llseek = no_llseek, 1864 .llseek = no_llseek,
diff --git a/drivers/usb/misc/idmouse.c b/drivers/usb/misc/idmouse.c
index fcd69c52aea9..8e6e195a22ba 100644
--- a/drivers/usb/misc/idmouse.c
+++ b/drivers/usb/misc/idmouse.c
@@ -98,7 +98,7 @@ static int idmouse_probe(struct usb_interface *interface,
98static void idmouse_disconnect(struct usb_interface *interface); 98static void idmouse_disconnect(struct usb_interface *interface);
99 99
100/* file operation pointers */ 100/* file operation pointers */
101static struct file_operations idmouse_fops = { 101static const struct file_operations idmouse_fops = {
102 .owner = THIS_MODULE, 102 .owner = THIS_MODULE,
103 .read = idmouse_read, 103 .read = idmouse_read,
104 .open = idmouse_open, 104 .open = idmouse_open,
diff --git a/drivers/usb/misc/ldusb.c b/drivers/usb/misc/ldusb.c
index f30ab1fbb3c8..741736b6c134 100644
--- a/drivers/usb/misc/ldusb.c
+++ b/drivers/usb/misc/ldusb.c
@@ -589,7 +589,7 @@ exit:
589} 589}
590 590
591/* file operations needed when we register this driver */ 591/* file operations needed when we register this driver */
592static struct file_operations ld_usb_fops = { 592static const struct file_operations ld_usb_fops = {
593 .owner = THIS_MODULE, 593 .owner = THIS_MODULE,
594 .read = ld_usb_read, 594 .read = ld_usb_read,
595 .write = ld_usb_write, 595 .write = ld_usb_write,
diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c
index 7699d970e680..77c36e63c7bf 100644
--- a/drivers/usb/misc/legousbtower.c
+++ b/drivers/usb/misc/legousbtower.c
@@ -259,7 +259,7 @@ static void tower_disconnect (struct usb_interface *interface);
259static DEFINE_MUTEX (disconnect_mutex); 259static DEFINE_MUTEX (disconnect_mutex);
260 260
261/* file operations needed when we register this driver */ 261/* file operations needed when we register this driver */
262static struct file_operations tower_fops = { 262static const struct file_operations tower_fops = {
263 .owner = THIS_MODULE, 263 .owner = THIS_MODULE,
264 .read = tower_read, 264 .read = tower_read,
265 .write = tower_write, 265 .write = tower_write,
diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c
index e16582f3733c..a44124c7e851 100644
--- a/drivers/usb/misc/sisusbvga/sisusb.c
+++ b/drivers/usb/misc/sisusbvga/sisusb.c
@@ -3179,7 +3179,7 @@ sisusb_compat_ioctl(struct file *f, unsigned int cmd, unsigned long arg)
3179} 3179}
3180#endif 3180#endif
3181 3181
3182static struct file_operations usb_sisusb_fops = { 3182static const struct file_operations usb_sisusb_fops = {
3183 .owner = THIS_MODULE, 3183 .owner = THIS_MODULE,
3184 .open = sisusb_open, 3184 .open = sisusb_open,
3185 .release = sisusb_release, 3185 .release = sisusb_release,
diff --git a/drivers/usb/misc/usblcd.c b/drivers/usb/misc/usblcd.c
index e095772dd8e9..53e59e362330 100644
--- a/drivers/usb/misc/usblcd.c
+++ b/drivers/usb/misc/usblcd.c
@@ -239,7 +239,7 @@ error:
239 return retval; 239 return retval;
240} 240}
241 241
242static struct file_operations lcd_fops = { 242static const struct file_operations lcd_fops = {
243 .owner = THIS_MODULE, 243 .owner = THIS_MODULE,
244 .read = lcd_read, 244 .read = lcd_read,
245 .write = lcd_write, 245 .write = lcd_write,
diff --git a/drivers/usb/mon/mon_stat.c b/drivers/usb/mon/mon_stat.c
index 86ad2b381c4b..f6d1491256c4 100644
--- a/drivers/usb/mon/mon_stat.c
+++ b/drivers/usb/mon/mon_stat.c
@@ -62,7 +62,7 @@ static int mon_stat_release(struct inode *inode, struct file *file)
62 return 0; 62 return 0;
63} 63}
64 64
65struct file_operations mon_fops_stat = { 65const struct file_operations mon_fops_stat = {
66 .owner = THIS_MODULE, 66 .owner = THIS_MODULE,
67 .open = mon_stat_open, 67 .open = mon_stat_open,
68 .llseek = no_llseek, 68 .llseek = no_llseek,
diff --git a/drivers/usb/mon/mon_text.c b/drivers/usb/mon/mon_text.c
index 2fd39b4fa166..775e374a960c 100644
--- a/drivers/usb/mon/mon_text.c
+++ b/drivers/usb/mon/mon_text.c
@@ -435,7 +435,7 @@ static int mon_text_release(struct inode *inode, struct file *file)
435 return 0; 435 return 0;
436} 436}
437 437
438struct file_operations mon_fops_text = { 438const struct file_operations mon_fops_text = {
439 .owner = THIS_MODULE, 439 .owner = THIS_MODULE,
440 .open = mon_text_open, 440 .open = mon_text_open,
441 .llseek = no_llseek, 441 .llseek = no_llseek,
diff --git a/drivers/usb/mon/usb_mon.h b/drivers/usb/mon/usb_mon.h
index 33678c24ebee..50efc8ee7c21 100644
--- a/drivers/usb/mon/usb_mon.h
+++ b/drivers/usb/mon/usb_mon.h
@@ -53,7 +53,7 @@ extern char mon_dmapeek(unsigned char *dst, dma_addr_t dma_addr, int len);
53 53
54extern struct mutex mon_lock; 54extern struct mutex mon_lock;
55 55
56extern struct file_operations mon_fops_text; 56extern const struct file_operations mon_fops_text;
57extern struct file_operations mon_fops_stat; 57extern const struct file_operations mon_fops_stat;
58 58
59#endif /* __USB_MON_H */ 59#endif /* __USB_MON_H */
diff --git a/drivers/usb/usb-skeleton.c b/drivers/usb/usb-skeleton.c
index 33f0e81c58d3..3339373239ad 100644
--- a/drivers/usb/usb-skeleton.c
+++ b/drivers/usb/usb-skeleton.c
@@ -243,7 +243,7 @@ exit:
243 return retval; 243 return retval;
244} 244}
245 245
246static struct file_operations skel_fops = { 246static const struct file_operations skel_fops = {
247 .owner = THIS_MODULE, 247 .owner = THIS_MODULE,
248 .read = skel_read, 248 .read = skel_read,
249 .write = skel_write, 249 .write = skel_write,