Commit c847020e authored by Tim Sell's avatar Tim Sell Committed by Greg Kroah-Hartman

staging: unisys: visornic_resume needs to mirror _serverdown_complete

Previously we simplified the serverdown function to basically turn it
into a dev_close(), but missed the analogous logic in visornic_resume()
(which is essentially the "book-end" of visornic_serverdown_complete()).
As a result, during IO partition recovery, the nic would go closed when
the IO partition went away, but would never be opened again when the IO
partition came back.

This patch changes visornic_resume() to use dev_open(), so that it once
again plays nicely with visornic_serverdown_complete().  Because
dev_open() forces us into the visornic_open() path, other logic in
visornic_resume() was no longer necessary, and lended to simplifying
visornic_resume() even more.

Fixes: 36645d72a377 ("staging: unisys: simplify visornic_serverdown_complete")
Signed-off-by: default avatarTim Sell <Timothy.Sell@unisys.com>
Signed-off-by: default avatarBenjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6483783d
...@@ -2071,8 +2071,21 @@ static int visornic_resume(struct visor_device *dev, ...@@ -2071,8 +2071,21 @@ static int visornic_resume(struct visor_device *dev,
netdev = devdata->netdev; netdev = devdata->netdev;
if (devdata->server_down && !devdata->server_change_state) { spin_lock_irqsave(&devdata->priv_lock, flags);
if (devdata->server_change_state) {
spin_unlock_irqrestore(&devdata->priv_lock, flags);
dev_err(&dev->device, "%s server already changing state\n",
__func__);
return -EINVAL;
}
if (!devdata->server_down) {
spin_unlock_irqrestore(&devdata->priv_lock, flags);
dev_err(&dev->device, "%s server not down\n", __func__);
complete_func(dev, 0);
return 0;
}
devdata->server_change_state = true; devdata->server_change_state = true;
spin_unlock_irqrestore(&devdata->priv_lock, flags);
/* Must transition channel to ATTACHED state BEFORE /* Must transition channel to ATTACHED state BEFORE
* we can start using the device again. * we can start using the device again.
* TODO: State transitions * TODO: State transitions
...@@ -2084,26 +2097,9 @@ static int visornic_resume(struct visor_device *dev, ...@@ -2084,26 +2097,9 @@ static int visornic_resume(struct visor_device *dev,
else else
pr_warn("vnic_incoming already running!\n"); pr_warn("vnic_incoming already running!\n");
init_rcv_bufs(netdev, devdata); rtnl_lock();
spin_lock_irqsave(&devdata->priv_lock, flags); dev_open(netdev);
devdata->enabled = 1; rtnl_unlock();
/* Now we're ready, let's send an ENB to uisnic but until
* we get an ACK back from uisnic, we'll drop the packets
*/
devdata->enab_dis_acked = 0;
spin_unlock_irqrestore(&devdata->priv_lock, flags);
/* send enable and wait for ack - don't hold lock when
* sending enable because if the queue if sull, insert
* might sleep.
*/
send_enbdis(netdev, 1, devdata);
} else if (devdata->server_change_state) {
dev_err(&dev->device, "%s server_change_state\n",
__func__);
return -EIO;
}
complete_func(dev, 0); complete_func(dev, 0);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment