From: Tim Sell Date: Tue, 28 Jul 2015 16:29:09 +0000 (-0400) Subject: staging: unisys: visornic_resume needs to mirror _serverdown_complete X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=c847020e7ae07c6a3d68c9a617815b9d4f8a1e10;p=linux-beck.git 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: Tim Sell Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index 02906ef6c4c6..dd908b8f40ef 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -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;