]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
staging: unisys: visornic_resume needs to mirror _serverdown_complete
authorTim Sell <Timothy.Sell@unisys.com>
Tue, 28 Jul 2015 16:29:09 +0000 (12:29 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 31 Jul 2015 23:10:35 +0000 (16:10 -0700)
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: Tim Sell <Timothy.Sell@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/unisys/visornic/visornic_main.c

index 02906ef6c4c68a5fe4fa85aef599d4a222b16ace..dd908b8f40efba51461343961c8cae5d0ef34f82 100644 (file)
@@ -2071,39 +2071,35 @@ static int visornic_resume(struct visor_device *dev,
 
        netdev = devdata->netdev;
 
-       if (devdata->server_down && !devdata->server_change_state) {
-               devdata->server_change_state = true;
-               /* Must transition channel to ATTACHED state BEFORE
-                * we can start using the device again.
-                * TODO: State transitions
-                */
-               if (!devdata->threadinfo.id)
-                       visor_thread_start(&devdata->threadinfo,
-                                          process_incoming_rsps,
-                                          devdata, "vnic_incoming");
-               else
-                       pr_warn("vnic_incoming already running!\n");
-
-               init_rcv_bufs(netdev, devdata);
-               spin_lock_irqsave(&devdata->priv_lock, flags);
-               devdata->enabled = 1;
-
-               /* 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_lock_irqsave(&devdata->priv_lock, flags);
+       if (devdata->server_change_state) {
                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",
+               dev_err(&dev->device, "%s server already changing state\n",
                        __func__);
-               return -EIO;
+               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;
+       spin_unlock_irqrestore(&devdata->priv_lock, flags);
+       /* Must transition channel to ATTACHED state BEFORE
+        * we can start using the device again.
+        * TODO: State transitions
+        */
+       if (!devdata->threadinfo.id)
+               visor_thread_start(&devdata->threadinfo,
+                                  process_incoming_rsps,
+                                  devdata, "vnic_incoming");
+       else
+               pr_warn("vnic_incoming already running!\n");
+
+       rtnl_lock();
+       dev_open(netdev);
+       rtnl_unlock();
 
        complete_func(dev, 0);
        return 0;