Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

USB: constify usb_mon_operations structure

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>

authored by

Julia Lawall and committed by
Greg Kroah-Hartman
6fb8ac81 c7c78067

+5 -5
+2 -2
drivers/usb/core/hcd.c
··· 3000 3000 3001 3001 #if defined(CONFIG_USB_MON) || defined(CONFIG_USB_MON_MODULE) 3002 3002 3003 - struct usb_mon_operations *mon_ops; 3003 + const struct usb_mon_operations *mon_ops; 3004 3004 3005 3005 /* 3006 3006 * The registration is unlocked. ··· 3010 3010 * symbols from usbcore, usbcore gets referenced and cannot be unloaded first. 3011 3011 */ 3012 3012 3013 - int usb_mon_register (struct usb_mon_operations *ops) 3013 + int usb_mon_register(const struct usb_mon_operations *ops) 3014 3014 { 3015 3015 3016 3016 if (mon_ops)
+1 -1
drivers/usb/mon/mon_main.c
··· 241 241 /* 242 242 * Ops 243 243 */ 244 - static struct usb_mon_operations mon_ops_0 = { 244 + static const struct usb_mon_operations mon_ops_0 = { 245 245 .urb_submit = mon_submit, 246 246 .urb_submit_error = mon_submit_error, 247 247 .urb_complete = mon_complete,
+2 -2
include/linux/usb/hcd.h
··· 660 660 /* void (*urb_unlink)(struct usb_bus *bus, struct urb *urb); */ 661 661 }; 662 662 663 - extern struct usb_mon_operations *mon_ops; 663 + extern const struct usb_mon_operations *mon_ops; 664 664 665 665 static inline void usbmon_urb_submit(struct usb_bus *bus, struct urb *urb) 666 666 { ··· 682 682 (*mon_ops->urb_complete)(bus, urb, status); 683 683 } 684 684 685 - int usb_mon_register(struct usb_mon_operations *ops); 685 + int usb_mon_register(const struct usb_mon_operations *ops); 686 686 void usb_mon_deregister(void); 687 687 688 688 #else