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

ax88796: start_xmit fix using net_device_ops

This patch hooks up the start_xmit/tx_timeout/get_stats callbacks
in the ax88796 driver since they no longer are installed by the
lib8390 code. Without this patch the function dev_hard_start_xmit()
crashes due to a start_xmit callback with the value NULL.

While at it, update the ax88796 driver to make use of use of struct
net_device_ops.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Magnus Damm and committed by
David S. Miller
d57bc36e 937f1ba5

+21 -6
+21 -6
drivers/net/ax88796.c
··· 37 37 #define __ei_open ax_ei_open 38 38 #define __ei_close ax_ei_close 39 39 #define __ei_poll ax_ei_poll 40 + #define __ei_start_xmit ax_ei_start_xmit 40 41 #define __ei_tx_timeout ax_ei_tx_timeout 42 + #define __ei_get_stats ax_ei_get_stats 43 + #define __ei_set_multicast_list ax_ei_set_multicast_list 41 44 #define __ei_interrupt ax_ei_interrupt 42 45 #define ____alloc_ei_netdev ax__alloc_ei_netdev 43 46 #define __NS8390_init ax_NS8390_init ··· 626 623 } 627 624 #endif 628 625 626 + static const struct net_device_ops ax_netdev_ops = { 627 + .ndo_open = ax_open, 628 + .ndo_stop = ax_close, 629 + .ndo_do_ioctl = ax_ioctl, 630 + 631 + .ndo_start_xmit = ax_ei_start_xmit, 632 + .ndo_tx_timeout = ax_ei_tx_timeout, 633 + .ndo_get_stats = ax_ei_get_stats, 634 + .ndo_set_multicast_list = ax_ei_set_multicast_list, 635 + .ndo_validate_addr = eth_validate_addr, 636 + .ndo_set_mac_address = eth_mac_addr, 637 + .ndo_change_mtu = eth_change_mtu, 638 + #ifdef CONFIG_NET_POLL_CONTROLLER 639 + .ndo_poll_controller = ax_ei_poll, 640 + #endif 641 + }; 642 + 629 643 /* setup code */ 630 644 631 645 static void ax_initial_setup(struct net_device *dev, struct ei_device *ei_local) ··· 758 738 ei_status.get_8390_hdr = &ax_get_8390_hdr; 759 739 ei_status.priv = 0; 760 740 761 - dev->open = ax_open; 762 - dev->stop = ax_close; 763 - dev->do_ioctl = ax_ioctl; 741 + dev->netdev_ops = &ax_netdev_ops; 764 742 dev->ethtool_ops = &ax_ethtool_ops; 765 743 766 744 ax->msg_enable = NETIF_MSG_LINK; ··· 771 753 ax->mii.mdio_write = ax_phy_write; 772 754 ax->mii.dev = dev; 773 755 774 - #ifdef CONFIG_NET_POLL_CONTROLLER 775 - dev->poll_controller = ax_ei_poll; 776 - #endif 777 756 ax_NS8390_init(dev, 0); 778 757 779 758 if (first_init)