I don't think these PM functions can race with userland net device
operations, but it's much easier to reason about locking if state is
consistently guarded by the same lock.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
{
struct efx_nic *efx = pci_get_drvdata(to_pci_dev(dev));
+ rtnl_lock();
+
efx->state = STATE_UNINIT;
netif_device_detach(efx->net_dev);
efx_stop_all(efx);
efx_stop_interrupts(efx, false);
+ rtnl_unlock();
+
return 0;
}
{
struct efx_nic *efx = pci_get_drvdata(to_pci_dev(dev));
+ rtnl_lock();
+
efx_start_interrupts(efx, false);
mutex_lock(&efx->mac_lock);
efx->type->resume_wol(efx);
+ rtnl_unlock();
+
/* Reschedule any quenched resets scheduled during efx_pm_freeze() */
queue_work(reset_workqueue, &efx->reset_work);