提交 55629109 编写于 作者: P Pavel Belous 提交者: David S. Miller

net: ethernet: aquantia: Call netdev_register after all initialized.

netdev_register should be called when everything is initialized.
Also we should use net_device->reg_state field instead own
"is_ndev_registered" flag to avoid any race.
Signed-off-by: NPavel Belous <pavel.belous@aquantia.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 df9000ef
......@@ -261,16 +261,16 @@ int aq_nic_ndev_register(struct aq_nic_s *self)
ether_addr_copy(self->ndev->dev_addr, mac_addr_permanent);
}
#endif
err = register_netdev(self->ndev);
if (err < 0)
goto err_exit;
self->is_ndev_registered = true;
netif_carrier_off(self->ndev);
for (i = AQ_CFG_VECS_MAX; i--;)
aq_nic_ndev_queue_stop(self, i);
err = register_netdev(self->ndev);
if (err < 0)
goto err_exit;
err_exit:
return err;
}
......@@ -293,7 +293,7 @@ void aq_nic_ndev_free(struct aq_nic_s *self)
if (!self->ndev)
goto err_exit;
if (self->is_ndev_registered)
if (self->ndev->reg_state == NETREG_REGISTERED)
unregister_netdev(self->ndev);
if (self->aq_hw)
......
......@@ -22,7 +22,6 @@ struct aq_nic_s {
unsigned int aq_vecs;
unsigned int packet_filter;
unsigned int power_state;
bool is_ndev_registered;
u8 port;
struct aq_hw_ops aq_hw_ops;
struct aq_hw_caps_s aq_hw_caps;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册