mwifiex: code rearrangement in mwifiex_get_rd_port()

Get rid of 'if else' usage by returning in 'if' block.
This improves readability by removing indentations.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
Amitkumar Karwar 2013-05-17 17:53:56 -07:00 committed by John W. Linville
parent ab93d4ff36
commit e6a520304f
1 changed files with 16 additions and 15 deletions

View File

@ -512,22 +512,23 @@ static int mwifiex_get_rd_port(struct mwifiex_adapter *adapter, u8 *port)
*port = CTRL_PORT; *port = CTRL_PORT;
dev_dbg(adapter->dev, "data: port=%d mp_rd_bitmap=0x%08x\n", dev_dbg(adapter->dev, "data: port=%d mp_rd_bitmap=0x%08x\n",
*port, card->mp_rd_bitmap); *port, card->mp_rd_bitmap);
} else { return 0;
if (card->mp_rd_bitmap & (1 << card->curr_rd_port)) { }
card->mp_rd_bitmap &= (u32)
(~(1 << card->curr_rd_port)); if (!(card->mp_rd_bitmap & (1 << card->curr_rd_port)))
return -1;
/* We are now handling the SDIO data ports */
card->mp_rd_bitmap &= (u32)(~(1 << card->curr_rd_port));
*port = card->curr_rd_port; *port = card->curr_rd_port;
if (++card->curr_rd_port == card->max_ports) if (++card->curr_rd_port == card->max_ports)
card->curr_rd_port = reg->start_rd_port; card->curr_rd_port = reg->start_rd_port;
} else {
return -1;
}
dev_dbg(adapter->dev, dev_dbg(adapter->dev,
"data: port=%d mp_rd_bitmap=0x%08x -> 0x%08x\n", "data: port=%d mp_rd_bitmap=0x%08x -> 0x%08x\n",
*port, rd_bitmap, card->mp_rd_bitmap); *port, rd_bitmap, card->mp_rd_bitmap);
}
return 0; return 0;
} }