Staging: rts5208: Add new variable idx to shorten line length and increase readability
authorVatika Harlalka <vatikaharlalka@gmail.com>
Wed, 18 Mar 2015 21:44:15 +0000 (03:14 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 20 Mar 2015 12:28:22 +0000 (13:28 +0100)
Add new variable idx to shorten line length of other statements
and increase readability.

Signed-off-by: Vatika Harlalka <vatikaharlalka@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rts5208/ms.c

index 5a9321b4d7982cdabfeefa074b11f3c7c7cac37e..4c38ff9d9a765ec22c6ecab81ec2aae3da7949fd 100644 (file)
@@ -2194,7 +2194,7 @@ static int ms_build_l2p_tbl(struct rtsx_chip *chip, int seg_no)
        struct zone_entry *segment;
        bool defect_flag;
        int retval, table_size, disable_cnt, i;
-       u16 start, end, phy_blk, log_blk, tmp_blk;
+       u16 start, end, phy_blk, log_blk, tmp_blk, idx;
        u8 extra[MS_EXTRA_SIZE], us1, us2;
 
        dev_dbg(rtsx_dev(chip), "ms_build_l2p_tbl: %d\n", seg_no);
@@ -2305,13 +2305,15 @@ static int ms_build_l2p_tbl(struct rtsx_chip *chip, int seg_no)
                        continue;
                }
 
-               if (segment->l2p_table[log_blk - ms_start_idx[seg_no]] == 0xFFFF) {
-                       segment->l2p_table[log_blk - ms_start_idx[seg_no]] = phy_blk;
+               idx = log_blk - ms_start_idx[seg_no];
+
+               if (segment->l2p_table[idx] == 0xFFFF) {
+                       segment->l2p_table[idx] = phy_blk;
                        continue;
                }
 
                us1 = extra[0] & 0x10;
-               tmp_blk = segment->l2p_table[log_blk - ms_start_idx[seg_no]];
+               tmp_blk = segment->l2p_table[idx];
                retval = ms_read_extra_data(chip, tmp_blk, 0,
                                        extra, MS_EXTRA_SIZE);
                if (retval != STATUS_SUCCESS)
@@ -2342,7 +2344,8 @@ static int ms_build_l2p_tbl(struct rtsx_chip *chip, int seg_no)
 
        for (log_blk = ms_start_idx[seg_no];
             log_blk < ms_start_idx[seg_no + 1]; log_blk++) {
-               if (segment->l2p_table[log_blk-ms_start_idx[seg_no]] == 0xFFFF) {
+               idx = log_blk - ms_start_idx[seg_no];
+               if (segment->l2p_table[idx] == 0xFFFF) {
                        phy_blk = ms_get_unused_block(chip, seg_no);
                        if (phy_blk == 0xFFFF) {
                                chip->card_wp |= MS_CARD;
@@ -2352,7 +2355,7 @@ static int ms_build_l2p_tbl(struct rtsx_chip *chip, int seg_no)
                        if (retval != STATUS_SUCCESS)
                                TRACE_GOTO(chip, BUILD_FAIL);
 
-                       segment->l2p_table[log_blk-ms_start_idx[seg_no]] = phy_blk;
+                       segment->l2p_table[idx] = phy_blk;
                        if (seg_no == ms_card->segment_cnt - 1) {
                                if (segment->unused_blk_cnt < 2) {
                                        chip->card_wp |= MS_CARD;