]> git.karo-electronics.de Git - linux-beck.git/commitdiff
mwifiex: code rearrangement in mwifiex_get_rd_port()
authorAmitkumar Karwar <akarwar@marvell.com>
Sat, 18 May 2013 00:53:56 +0000 (17:53 -0700)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 22 May 2013 19:09:05 +0000 (15:09 -0400)
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>
drivers/net/wireless/mwifiex/sdio.c

index e4357a6dd8dce422a9e52dd5a2f1e38ce6bbb4bc..a18a5b4998d4c59891a6141ecd25068140914f6d 100644 (file)
@@ -512,22 +512,23 @@ static int mwifiex_get_rd_port(struct mwifiex_adapter *adapter, u8 *port)
                *port = CTRL_PORT;
                dev_dbg(adapter->dev, "data: port=%d mp_rd_bitmap=0x%08x\n",
                        *port, card->mp_rd_bitmap);
-       } else {
-               if (card->mp_rd_bitmap & (1 << card->curr_rd_port)) {
-                       card->mp_rd_bitmap &= (u32)
-                                               (~(1 << card->curr_rd_port));
-                       *port = card->curr_rd_port;
+               return 0;
+       }
 
-                       if (++card->curr_rd_port == card->max_ports)
-                               card->curr_rd_port = reg->start_rd_port;
-               } else {
-                       return -1;
-               }
+       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;
+
+       if (++card->curr_rd_port == card->max_ports)
+               card->curr_rd_port = reg->start_rd_port;
+
+       dev_dbg(adapter->dev,
+               "data: port=%d mp_rd_bitmap=0x%08x -> 0x%08x\n",
+               *port, rd_bitmap, card->mp_rd_bitmap);
 
-               dev_dbg(adapter->dev,
-                       "data: port=%d mp_rd_bitmap=0x%08x -> 0x%08x\n",
-                       *port, rd_bitmap, card->mp_rd_bitmap);
-       }
        return 0;
 }