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

net: usbnet: make driver_info const

The driver_info field that is used for describing each of the usb-net
drivers using the usbnet.c core all declare their information as const
and the usbnet.c itself does not try and modify the struct.

It is therefore a good idea to make this const in the usbnet.c structure
in case anyone tries to modify it.

Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Ben Dooks and committed by
David S. Miller
f3edc2db 8873c064

+7 -7
+6 -6
drivers/net/usb/usbnet.c
··· 802 802 int usbnet_stop (struct net_device *net) 803 803 { 804 804 struct usbnet *dev = netdev_priv(net); 805 - struct driver_info *info = dev->driver_info; 805 + const struct driver_info *info = dev->driver_info; 806 806 int retval, pm, mpn; 807 807 808 808 clear_bit(EVENT_DEV_OPEN, &dev->flags); ··· 865 865 { 866 866 struct usbnet *dev = netdev_priv(net); 867 867 int retval; 868 - struct driver_info *info = dev->driver_info; 868 + const struct driver_info *info = dev->driver_info; 869 869 870 870 if ((retval = usb_autopm_get_interface(dev->intf)) < 0) { 871 871 netif_info(dev, ifup, dev->net, ··· 1205 1205 } 1206 1206 1207 1207 if (test_bit (EVENT_LINK_RESET, &dev->flags)) { 1208 - struct driver_info *info = dev->driver_info; 1208 + const struct driver_info *info = dev->driver_info; 1209 1209 int retval = 0; 1210 1210 1211 1211 clear_bit (EVENT_LINK_RESET, &dev->flags); ··· 1353 1353 unsigned int length; 1354 1354 struct urb *urb = NULL; 1355 1355 struct skb_data *entry; 1356 - struct driver_info *info = dev->driver_info; 1356 + const struct driver_info *info = dev->driver_info; 1357 1357 unsigned long flags; 1358 1358 int retval; 1359 1359 ··· 1647 1647 struct usbnet *dev; 1648 1648 struct net_device *net; 1649 1649 struct usb_host_interface *interface; 1650 - struct driver_info *info; 1650 + const struct driver_info *info; 1651 1651 struct usb_device *xdev; 1652 1652 int status; 1653 1653 const char *name; ··· 1663 1663 } 1664 1664 1665 1665 name = udev->dev.driver->name; 1666 - info = (struct driver_info *) prod->driver_info; 1666 + info = (const struct driver_info *) prod->driver_info; 1667 1667 if (!info) { 1668 1668 dev_dbg (&udev->dev, "blacklisted by %s\n", name); 1669 1669 return -ENODEV;
+1 -1
include/linux/usb/usbnet.h
··· 28 28 /* housekeeping */ 29 29 struct usb_device *udev; 30 30 struct usb_interface *intf; 31 - struct driver_info *driver_info; 31 + const struct driver_info *driver_info; 32 32 const char *driver_name; 33 33 void *driver_priv; 34 34 wait_queue_head_t wait;