Commit 76a82abc authored by Joe Perches's avatar Joe Perches Committed by David S. Miller

tms380tr: Fix cascading if/else tab abuse

Cascading "if/else if"'s are ugly.
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e5e1ee89
...@@ -1525,10 +1525,8 @@ static void tms380tr_chk_outstanding_cmds(struct net_device *dev) ...@@ -1525,10 +1525,8 @@ static void tms380tr_chk_outstanding_cmds(struct net_device *dev)
/* Check if adapter is opened, avoiding COMMAND_REJECT /* Check if adapter is opened, avoiding COMMAND_REJECT
* interrupt by the adapter! * interrupt by the adapter!
*/ */
if(tp->AdapterOpenFlag == 0) if (tp->AdapterOpenFlag == 0) {
{ if (tp->CMDqueue & OC_OPEN) {
if(tp->CMDqueue & OC_OPEN)
{
/* Execute OPEN command */ /* Execute OPEN command */
tp->CMDqueue ^= OC_OPEN; tp->CMDqueue ^= OC_OPEN;
...@@ -1536,21 +1534,17 @@ static void tms380tr_chk_outstanding_cmds(struct net_device *dev) ...@@ -1536,21 +1534,17 @@ static void tms380tr_chk_outstanding_cmds(struct net_device *dev)
tp->scb.Parm[0] = LOWORD(Addr); tp->scb.Parm[0] = LOWORD(Addr);
tp->scb.Parm[1] = HIWORD(Addr); tp->scb.Parm[1] = HIWORD(Addr);
tp->scb.CMD = OPEN; tp->scb.CMD = OPEN;
} } else
else
/* No OPEN command queued, but adapter closed. Note: /* No OPEN command queued, but adapter closed. Note:
* We'll try to re-open the adapter in DriverPoll() * We'll try to re-open the adapter in DriverPoll()
*/ */
return; /* No adapter command issued */ return; /* No adapter command issued */
} } else {
else
{
/* Adapter is open; evaluate command queue: try to execute /* Adapter is open; evaluate command queue: try to execute
* outstanding commands (depending on priority!) CLOSE * outstanding commands (depending on priority!) CLOSE
* command queued * command queued
*/ */
if(tp->CMDqueue & OC_CLOSE) if (tp->CMDqueue & OC_CLOSE) {
{
tp->CMDqueue ^= OC_CLOSE; tp->CMDqueue ^= OC_CLOSE;
tp->AdapterOpenFlag = 0; tp->AdapterOpenFlag = 0;
tp->scb.Parm[0] = 0; /* Parm[0], Parm[1] are ignored */ tp->scb.Parm[0] = 0; /* Parm[0], Parm[1] are ignored */
...@@ -1560,109 +1554,70 @@ static void tms380tr_chk_outstanding_cmds(struct net_device *dev) ...@@ -1560,109 +1554,70 @@ static void tms380tr_chk_outstanding_cmds(struct net_device *dev)
tp->CMDqueue |= OC_OPEN; /* re-open adapter */ tp->CMDqueue |= OC_OPEN; /* re-open adapter */
else else
tp->CMDqueue = 0; /* no more commands */ tp->CMDqueue = 0; /* no more commands */
} } else if (tp->CMDqueue & OC_RECEIVE) {
else tp->CMDqueue ^= OC_RECEIVE;
{ Addr = htonl(((char *)tp->RplHead - (char *)tp) + tp->dmabuffer);
if(tp->CMDqueue & OC_RECEIVE) tp->scb.Parm[0] = LOWORD(Addr);
{ tp->scb.Parm[1] = HIWORD(Addr);
tp->CMDqueue ^= OC_RECEIVE; tp->scb.CMD = RECEIVE;
Addr = htonl(((char *)tp->RplHead - (char *)tp) + tp->dmabuffer); } else if (tp->CMDqueue & OC_TRANSMIT_HALT) {
tp->scb.Parm[0] = LOWORD(Addr); /* NOTE: TRANSMIT.HALT must be checked
tp->scb.Parm[1] = HIWORD(Addr); * before TRANSMIT.
tp->scb.CMD = RECEIVE; */
} tp->CMDqueue ^= OC_TRANSMIT_HALT;
else tp->scb.CMD = TRANSMIT_HALT;
{
if(tp->CMDqueue & OC_TRANSMIT_HALT) /* Parm[0] and Parm[1] are ignored
{ * but should be set to zero!
/* NOTE: TRANSMIT.HALT must be checked */
* before TRANSMIT. tp->scb.Parm[0] = 0;
*/ tp->scb.Parm[1] = 0;
tp->CMDqueue ^= OC_TRANSMIT_HALT; } else if (tp->CMDqueue & OC_TRANSMIT) {
tp->scb.CMD = TRANSMIT_HALT; /* NOTE: TRANSMIT must be
* checked after TRANSMIT.HALT
/* Parm[0] and Parm[1] are ignored */
* but should be set to zero! if (tp->TransmitCommandActive) {
*/ if (!tp->TransmitHaltScheduled) {
tp->scb.Parm[0] = 0; tp->TransmitHaltScheduled = 1;
tp->scb.Parm[1] = 0; tms380tr_exec_cmd(dev, OC_TRANSMIT_HALT);
}
else
{
if(tp->CMDqueue & OC_TRANSMIT)
{
/* NOTE: TRANSMIT must be
* checked after TRANSMIT.HALT
*/
if(tp->TransmitCommandActive)
{
if(!tp->TransmitHaltScheduled)
{
tp->TransmitHaltScheduled = 1;
tms380tr_exec_cmd(dev, OC_TRANSMIT_HALT) ;
}
tp->TransmitCommandActive = 0;
return;
}
tp->CMDqueue ^= OC_TRANSMIT;
tms380tr_cancel_tx_queue(tp);
Addr = htonl(((char *)tp->TplBusy - (char *)tp) + tp->dmabuffer);
tp->scb.Parm[0] = LOWORD(Addr);
tp->scb.Parm[1] = HIWORD(Addr);
tp->scb.CMD = TRANSMIT;
tp->TransmitCommandActive = 1;
}
else
{
if(tp->CMDqueue & OC_MODIFY_OPEN_PARMS)
{
tp->CMDqueue ^= OC_MODIFY_OPEN_PARMS;
tp->scb.Parm[0] = tp->ocpl.OPENOptions; /* new OPEN options*/
tp->scb.Parm[0] |= ENABLE_FULL_DUPLEX_SELECTION;
tp->scb.Parm[1] = 0; /* is ignored but should be zero */
tp->scb.CMD = MODIFY_OPEN_PARMS;
}
else
{
if(tp->CMDqueue & OC_SET_FUNCT_ADDR)
{
tp->CMDqueue ^= OC_SET_FUNCT_ADDR;
tp->scb.Parm[0] = LOWORD(tp->ocpl.FunctAddr);
tp->scb.Parm[1] = HIWORD(tp->ocpl.FunctAddr);
tp->scb.CMD = SET_FUNCT_ADDR;
}
else
{
if(tp->CMDqueue & OC_SET_GROUP_ADDR)
{
tp->CMDqueue ^= OC_SET_GROUP_ADDR;
tp->scb.Parm[0] = LOWORD(tp->ocpl.GroupAddr);
tp->scb.Parm[1] = HIWORD(tp->ocpl.GroupAddr);
tp->scb.CMD = SET_GROUP_ADDR;
}
else
{
if(tp->CMDqueue & OC_READ_ERROR_LOG)
{
tp->CMDqueue ^= OC_READ_ERROR_LOG;
Addr = htonl(((char *)&tp->errorlogtable - (char *)tp) + tp->dmabuffer);
tp->scb.Parm[0] = LOWORD(Addr);
tp->scb.Parm[1] = HIWORD(Addr);
tp->scb.CMD = READ_ERROR_LOG;
}
else
{
printk(KERN_WARNING "CheckForOutstandingCommand: unknown Command\n");
tp->CMDqueue = 0;
return;
}
}
}
}
}
} }
tp->TransmitCommandActive = 0;
return;
} }
tp->CMDqueue ^= OC_TRANSMIT;
tms380tr_cancel_tx_queue(tp);
Addr = htonl(((char *)tp->TplBusy - (char *)tp) + tp->dmabuffer);
tp->scb.Parm[0] = LOWORD(Addr);
tp->scb.Parm[1] = HIWORD(Addr);
tp->scb.CMD = TRANSMIT;
tp->TransmitCommandActive = 1;
} else if (tp->CMDqueue & OC_MODIFY_OPEN_PARMS) {
tp->CMDqueue ^= OC_MODIFY_OPEN_PARMS;
tp->scb.Parm[0] = tp->ocpl.OPENOptions; /* new OPEN options*/
tp->scb.Parm[0] |= ENABLE_FULL_DUPLEX_SELECTION;
tp->scb.Parm[1] = 0; /* is ignored but should be zero */
tp->scb.CMD = MODIFY_OPEN_PARMS;
} else if (tp->CMDqueue & OC_SET_FUNCT_ADDR) {
tp->CMDqueue ^= OC_SET_FUNCT_ADDR;
tp->scb.Parm[0] = LOWORD(tp->ocpl.FunctAddr);
tp->scb.Parm[1] = HIWORD(tp->ocpl.FunctAddr);
tp->scb.CMD = SET_FUNCT_ADDR;
} else if (tp->CMDqueue & OC_SET_GROUP_ADDR) {
tp->CMDqueue ^= OC_SET_GROUP_ADDR;
tp->scb.Parm[0] = LOWORD(tp->ocpl.GroupAddr);
tp->scb.Parm[1] = HIWORD(tp->ocpl.GroupAddr);
tp->scb.CMD = SET_GROUP_ADDR;
} else if (tp->CMDqueue & OC_READ_ERROR_LOG) {
tp->CMDqueue ^= OC_READ_ERROR_LOG;
Addr = htonl(((char *)&tp->errorlogtable - (char *)tp) + tp->dmabuffer);
tp->scb.Parm[0] = LOWORD(Addr);
tp->scb.Parm[1] = HIWORD(Addr);
tp->scb.CMD = READ_ERROR_LOG;
} else {
printk(KERN_WARNING "CheckForOutstandingCommand: unknown Command\n");
tp->CMDqueue = 0;
return;
} }
} }
......
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