summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Dooks <ben-linux@fluff.org>2018-10-01 12:02:43 -0400
committerDavid S. Miller <davem@davemloft.net>2018-10-03 01:22:46 -0400
commitf3edc2dbe0ad0bbbd8450cd37328f99acf215fd8 (patch)
tree12b4c4b97ef171c0e208b80c1cd8b949b6ca8dac
parent8873c064d1de579ea23412a6d3eee972593f142b (diff)
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>
-rw-r--r--drivers/net/usb/usbnet.c12
-rw-r--r--include/linux/usb/usbnet.h2
2 files changed, 7 insertions, 7 deletions
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 73aa33364d80..504282af27e5 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -802,7 +802,7 @@ static void usbnet_terminate_urbs(struct usbnet *dev)
802int usbnet_stop (struct net_device *net) 802int usbnet_stop (struct net_device *net)
803{ 803{
804 struct usbnet *dev = netdev_priv(net); 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 int retval, pm, mpn; 806 int retval, pm, mpn;
807 807
808 clear_bit(EVENT_DEV_OPEN, &dev->flags); 808 clear_bit(EVENT_DEV_OPEN, &dev->flags);
@@ -865,7 +865,7 @@ int usbnet_open (struct net_device *net)
865{ 865{
866 struct usbnet *dev = netdev_priv(net); 866 struct usbnet *dev = netdev_priv(net);
867 int retval; 867 int retval;
868 struct driver_info *info = dev->driver_info; 868 const struct driver_info *info = dev->driver_info;
869 869
870 if ((retval = usb_autopm_get_interface(dev->intf)) < 0) { 870 if ((retval = usb_autopm_get_interface(dev->intf)) < 0) {
871 netif_info(dev, ifup, dev->net, 871 netif_info(dev, ifup, dev->net,
@@ -1205,7 +1205,7 @@ fail_lowmem:
1205 } 1205 }
1206 1206
1207 if (test_bit (EVENT_LINK_RESET, &dev->flags)) { 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 int retval = 0; 1209 int retval = 0;
1210 1210
1211 clear_bit (EVENT_LINK_RESET, &dev->flags); 1211 clear_bit (EVENT_LINK_RESET, &dev->flags);
@@ -1353,7 +1353,7 @@ netdev_tx_t usbnet_start_xmit (struct sk_buff *skb,
1353 unsigned int length; 1353 unsigned int length;
1354 struct urb *urb = NULL; 1354 struct urb *urb = NULL;
1355 struct skb_data *entry; 1355 struct skb_data *entry;
1356 struct driver_info *info = dev->driver_info; 1356 const struct driver_info *info = dev->driver_info;
1357 unsigned long flags; 1357 unsigned long flags;
1358 int retval; 1358 int retval;
1359 1359
@@ -1647,7 +1647,7 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
1647 struct usbnet *dev; 1647 struct usbnet *dev;
1648 struct net_device *net; 1648 struct net_device *net;
1649 struct usb_host_interface *interface; 1649 struct usb_host_interface *interface;
1650 struct driver_info *info; 1650 const struct driver_info *info;
1651 struct usb_device *xdev; 1651 struct usb_device *xdev;
1652 int status; 1652 int status;
1653 const char *name; 1653 const char *name;
@@ -1663,7 +1663,7 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
1663 } 1663 }
1664 1664
1665 name = udev->dev.driver->name; 1665 name = udev->dev.driver->name;
1666 info = (struct driver_info *) prod->driver_info; 1666 info = (const struct driver_info *) prod->driver_info;
1667 if (!info) { 1667 if (!info) {
1668 dev_dbg (&udev->dev, "blacklisted by %s\n", name); 1668 dev_dbg (&udev->dev, "blacklisted by %s\n", name);
1669 return -ENODEV; 1669 return -ENODEV;
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index e2ec3582e549..d8860f2d0976 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -28,7 +28,7 @@ struct usbnet {
28 /* housekeeping */ 28 /* housekeeping */
29 struct usb_device *udev; 29 struct usb_device *udev;
30 struct usb_interface *intf; 30 struct usb_interface *intf;
31 struct driver_info *driver_info; 31 const struct driver_info *driver_info;
32 const char *driver_name; 32 const char *driver_name;
33 void *driver_priv; 33 void *driver_priv;
34 wait_queue_head_t wait; 34 wait_queue_head_t wait;