Skip to content

Commit

Permalink
mei: simplify write complete loop in irq handler
Browse files Browse the repository at this point in the history
extract the common, hence non conditional code
from the if-else statment

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Tomas Winkler authored and Greg Kroah-Hartman committed Nov 21, 2012
1 parent 9a84d61 commit be9d87a
Showing 1 changed file with 12 additions and 25 deletions.
37 changes: 12 additions & 25 deletions drivers/misc/mei/interrupt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1027,34 +1027,21 @@ static int mei_irq_thread_write_handler(struct mei_device *dev,
cl = pos->cl;
if (cl == NULL)
continue;
if (mei_flow_ctrl_creds(dev, cl) <= 0) {
dev_dbg(&dev->pdev->dev,
"No flow control credentials for client %d, not sending.\n",
cl->host_client_id);
continue;
}

if (cl != &dev->iamthif_cl) {
if (mei_flow_ctrl_creds(dev, cl) <= 0) {
dev_dbg(&dev->pdev->dev,
"No flow control credentials for client %d, not sending.\n",
cl->host_client_id);
continue;
}
ret = mei_irq_thread_write_complete(dev, &slots, pos,
cmpl_list);
if (ret)
return ret;

} else if (cl == &dev->iamthif_cl) {
/* IAMTHIF IOCTL */
dev_dbg(&dev->pdev->dev, "complete amthi write cb.\n");
if (mei_flow_ctrl_creds(dev, cl) <= 0) {
dev_dbg(&dev->pdev->dev,
"No flow control credentials for amthi client %d.\n",
cl->host_client_id);
continue;
}
if (cl == &dev->iamthif_cl)
ret = mei_amthif_irq_write_complete(dev, &slots,
pos, cmpl_list);
if (ret)
return ret;

}
else
ret = mei_irq_thread_write_complete(dev, &slots, pos,
cmpl_list);
if (ret)
return ret;

}
return 0;
Expand Down

0 comments on commit be9d87a

Please sign in to comment.