USB: constify usb_mon_operations structure
authorJulia Lawall <julia.lawall@lip6.fr>
Sat, 28 Nov 2015 15:07:10 +0000 (16:07 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 1 Dec 2015 22:36:29 +0000 (14:36 -0800)
The usb_mon_operations structure is never modified, so declare it as const.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/core/hcd.c
drivers/usb/mon/mon_main.c
include/linux/usb/hcd.h

index 1c102d60cd9f4afe861a6933e9495662d74de4f5..df0e3b92533a745fa8ea848d86cdbfb50a86f7f1 100644 (file)
@@ -3000,7 +3000,7 @@ EXPORT_SYMBOL_GPL(usb_hcd_platform_shutdown);
 
 #if defined(CONFIG_USB_MON) || defined(CONFIG_USB_MON_MODULE)
 
-struct usb_mon_operations *mon_ops;
+const struct usb_mon_operations *mon_ops;
 
 /*
  * The registration is unlocked.
@@ -3010,7 +3010,7 @@ struct usb_mon_operations *mon_ops;
  * symbols from usbcore, usbcore gets referenced and cannot be unloaded first.
  */
 
-int usb_mon_register (struct usb_mon_operations *ops)
+int usb_mon_register(const struct usb_mon_operations *ops)
 {
 
        if (mon_ops)
index f7c292f4891eedb0bb0ad0cef9572f9b18ace5e6..fec3f1128fdcab5101db4f929d946f0dd13f1046 100644 (file)
@@ -241,7 +241,7 @@ static struct notifier_block mon_nb = {
 /*
  * Ops
  */
-static struct usb_mon_operations mon_ops_0 = {
+static const struct usb_mon_operations mon_ops_0 = {
        .urb_submit =   mon_submit,
        .urb_submit_error = mon_submit_error,
        .urb_complete = mon_complete,
index f89c24bd53a4cc071db1d1fc8c585f8a07cc696b..4dcf8446dbcdac6203f7f825719aac83967a19a7 100644 (file)
@@ -660,7 +660,7 @@ struct usb_mon_operations {
        /* void (*urb_unlink)(struct usb_bus *bus, struct urb *urb); */
 };
 
-extern struct usb_mon_operations *mon_ops;
+extern const struct usb_mon_operations *mon_ops;
 
 static inline void usbmon_urb_submit(struct usb_bus *bus, struct urb *urb)
 {
@@ -682,7 +682,7 @@ static inline void usbmon_urb_complete(struct usb_bus *bus, struct urb *urb,
                (*mon_ops->urb_complete)(bus, urb, status);
 }
 
-int usb_mon_register(struct usb_mon_operations *ops);
+int usb_mon_register(const struct usb_mon_operations *ops);
 void usb_mon_deregister(void);
 
 #else
This page took 0.033989 seconds and 5 git commands to generate.