[PATCH 4/6] staging: unisys: visornic_resume needs to mirror _serverdown_complete

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Tim Sell <Timothy.Sell@xxxxxxxxxx>

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@xxxxxxxxxx>
Signed-off-by: Benjamin Romer <benjamin.romer@xxxxxxxxxx>
---
 drivers/staging/unisys/visornic/visornic_main.c | 56 ++++++++++++-------------
 1 file changed, 26 insertions(+), 30 deletions(-)

diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c
index 044969d..013da43 100644
--- a/drivers/staging/unisys/visornic/visornic_main.c
+++ b/drivers/staging/unisys/visornic/visornic_main.c
@@ -2061,39 +2061,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;
-- 
2.1.4

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux