aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/usb/usbnet.c
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2009-03-20 15:35:54 -0400
committerDavid S. Miller <davem@davemloft.net>2009-03-21 22:41:01 -0400
commit777baa4711c6b8373f4e03a3a558d44a6b046d7a (patch)
tree5c6f4f07f1d72433f906437369e8ab81011b5870 /drivers/net/usb/usbnet.c
parent805aaa29fa3c5afb26cb42f440f40d3f7f5c4bdc (diff)
usbnet: support net_device_ops
Use net_device_ops for usbnet device, and export for use by other derived drivers. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Acked-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/usb/usbnet.c')
-rw-r--r--drivers/net/usb/usbnet.c31
1 files changed, 23 insertions, 8 deletions
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 084141692245..659654f45880 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -223,7 +223,7 @@ EXPORT_SYMBOL_GPL(usbnet_skb_return);
223 * 223 *
224 *-------------------------------------------------------------------------*/ 224 *-------------------------------------------------------------------------*/
225 225
226static int usbnet_change_mtu (struct net_device *net, int new_mtu) 226int usbnet_change_mtu (struct net_device *net, int new_mtu)
227{ 227{
228 struct usbnet *dev = netdev_priv(net); 228 struct usbnet *dev = netdev_priv(net);
229 int ll_mtu = new_mtu + net->hard_header_len; 229 int ll_mtu = new_mtu + net->hard_header_len;
@@ -246,6 +246,7 @@ static int usbnet_change_mtu (struct net_device *net, int new_mtu)
246 246
247 return 0; 247 return 0;
248} 248}
249EXPORT_SYMBOL_GPL(usbnet_change_mtu);
249 250
250/*-------------------------------------------------------------------------*/ 251/*-------------------------------------------------------------------------*/
251 252
@@ -540,7 +541,7 @@ EXPORT_SYMBOL_GPL(usbnet_unlink_rx_urbs);
540 541
541// precondition: never called in_interrupt 542// precondition: never called in_interrupt
542 543
543static int usbnet_stop (struct net_device *net) 544int usbnet_stop (struct net_device *net)
544{ 545{
545 struct usbnet *dev = netdev_priv(net); 546 struct usbnet *dev = netdev_priv(net);
546 int temp; 547 int temp;
@@ -584,6 +585,7 @@ static int usbnet_stop (struct net_device *net)
584 585
585 return 0; 586 return 0;
586} 587}
588EXPORT_SYMBOL_GPL(usbnet_stop);
587 589
588/*-------------------------------------------------------------------------*/ 590/*-------------------------------------------------------------------------*/
589 591
@@ -591,7 +593,7 @@ static int usbnet_stop (struct net_device *net)
591 593
592// precondition: never called in_interrupt 594// precondition: never called in_interrupt
593 595
594static int usbnet_open (struct net_device *net) 596int usbnet_open (struct net_device *net)
595{ 597{
596 struct usbnet *dev = netdev_priv(net); 598 struct usbnet *dev = netdev_priv(net);
597 int retval; 599 int retval;
@@ -666,6 +668,7 @@ done:
666done_nopm: 668done_nopm:
667 return retval; 669 return retval;
668} 670}
671EXPORT_SYMBOL_GPL(usbnet_open);
669 672
670/*-------------------------------------------------------------------------*/ 673/*-------------------------------------------------------------------------*/
671 674
@@ -900,7 +903,7 @@ static void tx_complete (struct urb *urb)
900 903
901/*-------------------------------------------------------------------------*/ 904/*-------------------------------------------------------------------------*/
902 905
903static void usbnet_tx_timeout (struct net_device *net) 906void usbnet_tx_timeout (struct net_device *net)
904{ 907{
905 struct usbnet *dev = netdev_priv(net); 908 struct usbnet *dev = netdev_priv(net);
906 909
@@ -909,10 +912,11 @@ static void usbnet_tx_timeout (struct net_device *net)
909 912
910 // FIXME: device recovery -- reset? 913 // FIXME: device recovery -- reset?
911} 914}
915EXPORT_SYMBOL_GPL(usbnet_tx_timeout);
912 916
913/*-------------------------------------------------------------------------*/ 917/*-------------------------------------------------------------------------*/
914 918
915static int usbnet_start_xmit (struct sk_buff *skb, struct net_device *net) 919int usbnet_start_xmit (struct sk_buff *skb, struct net_device *net)
916{ 920{
917 struct usbnet *dev = netdev_priv(net); 921 struct usbnet *dev = netdev_priv(net);
918 int length; 922 int length;
@@ -995,7 +999,7 @@ drop:
995 } 999 }
996 return retval; 1000 return retval;
997} 1001}
998 1002EXPORT_SYMBOL_GPL(usbnet_start_xmit);
999 1003
1000/*-------------------------------------------------------------------------*/ 1004/*-------------------------------------------------------------------------*/
1001 1005
@@ -1102,6 +1106,15 @@ void usbnet_disconnect (struct usb_interface *intf)
1102} 1106}
1103EXPORT_SYMBOL_GPL(usbnet_disconnect); 1107EXPORT_SYMBOL_GPL(usbnet_disconnect);
1104 1108
1109static const struct net_device_ops usbnet_netdev_ops = {
1110 .ndo_open = usbnet_open,
1111 .ndo_stop = usbnet_stop,
1112 .ndo_start_xmit = usbnet_start_xmit,
1113 .ndo_tx_timeout = usbnet_tx_timeout,
1114 .ndo_change_mtu = usbnet_change_mtu,
1115 .ndo_set_mac_address = eth_mac_addr,
1116 .ndo_validate_addr = eth_validate_addr,
1117};
1105 1118
1106/*-------------------------------------------------------------------------*/ 1119/*-------------------------------------------------------------------------*/
1107 1120
@@ -1171,12 +1184,14 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
1171 net->features |= NETIF_F_HIGHDMA; 1184 net->features |= NETIF_F_HIGHDMA;
1172#endif 1185#endif
1173 1186
1174 net->change_mtu = usbnet_change_mtu; 1187 net->netdev_ops = &usbnet_netdev_ops;
1188#ifdef CONFIG_COMPAT_NET_DEV_OPS
1175 net->hard_start_xmit = usbnet_start_xmit; 1189 net->hard_start_xmit = usbnet_start_xmit;
1176 net->open = usbnet_open; 1190 net->open = usbnet_open;
1177 net->stop = usbnet_stop; 1191 net->stop = usbnet_stop;
1178 net->watchdog_timeo = TX_TIMEOUT_JIFFIES;
1179 net->tx_timeout = usbnet_tx_timeout; 1192 net->tx_timeout = usbnet_tx_timeout;
1193#endif
1194 net->watchdog_timeo = TX_TIMEOUT_JIFFIES;
1180 net->ethtool_ops = &usbnet_ethtool_ops; 1195 net->ethtool_ops = &usbnet_ethtool_ops;
1181 1196
1182 // allow device-specific bind/init procedures 1197 // allow device-specific bind/init procedures