Skip to content

Commit d57bc36

Browse files
Magnus Dammdavem330
authored andcommitted
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>
1 parent 937f1ba commit d57bc36

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

drivers/net/ax88796.c

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ static int phy_debug = 0;
3737
#define __ei_open ax_ei_open
3838
#define __ei_close ax_ei_close
3939
#define __ei_poll ax_ei_poll
40+
#define __ei_start_xmit ax_ei_start_xmit
4041
#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
4144
#define __ei_interrupt ax_ei_interrupt
4245
#define ____alloc_ei_netdev ax__alloc_ei_netdev
4346
#define __NS8390_init ax_NS8390_init
@@ -623,6 +626,23 @@ static void ax_eeprom_register_write(struct eeprom_93cx6 *eeprom)
623626
}
624627
#endif
625628

629+
static const struct net_device_ops ax_netdev_ops = {
630+
.ndo_open = ax_open,
631+
.ndo_stop = ax_close,
632+
.ndo_do_ioctl = ax_ioctl,
633+
634+
.ndo_start_xmit = ax_ei_start_xmit,
635+
.ndo_tx_timeout = ax_ei_tx_timeout,
636+
.ndo_get_stats = ax_ei_get_stats,
637+
.ndo_set_multicast_list = ax_ei_set_multicast_list,
638+
.ndo_validate_addr = eth_validate_addr,
639+
.ndo_set_mac_address = eth_mac_addr,
640+
.ndo_change_mtu = eth_change_mtu,
641+
#ifdef CONFIG_NET_POLL_CONTROLLER
642+
.ndo_poll_controller = ax_ei_poll,
643+
#endif
644+
};
645+
626646
/* setup code */
627647

628648
static void ax_initial_setup(struct net_device *dev, struct ei_device *ei_local)
@@ -738,9 +758,7 @@ static int ax_init_dev(struct net_device *dev, int first_init)
738758
ei_status.get_8390_hdr = &ax_get_8390_hdr;
739759
ei_status.priv = 0;
740760

741-
dev->open = ax_open;
742-
dev->stop = ax_close;
743-
dev->do_ioctl = ax_ioctl;
761+
dev->netdev_ops = &ax_netdev_ops;
744762
dev->ethtool_ops = &ax_ethtool_ops;
745763

746764
ax->msg_enable = NETIF_MSG_LINK;
@@ -753,9 +771,6 @@ static int ax_init_dev(struct net_device *dev, int first_init)
753771
ax->mii.mdio_write = ax_phy_write;
754772
ax->mii.dev = dev;
755773

756-
#ifdef CONFIG_NET_POLL_CONTROLLER
757-
dev->poll_controller = ax_ei_poll;
758-
#endif
759774
ax_NS8390_init(dev, 0);
760775

761776
if (first_init)

0 commit comments

Comments
 (0)