Commit 175dbfae authored by Giedrius Statkevičius's avatar Giedrius Statkevičius Committed by Greg Kroah-Hartman

staging: rts5208: combine ifs where possible

Join together chained if's where possible to lower the indentation
level.

In a lot of places of this code the indentation level is already very
high.
As a result, this patch increases the code flow and readability.
Signed-off-by: default avatarGiedrius Statkevičius <giedrius.statkevicius@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8ce6b2d2
...@@ -289,13 +289,11 @@ int rtsx_reset_chip(struct rtsx_chip *chip) ...@@ -289,13 +289,11 @@ int rtsx_reset_chip(struct rtsx_chip *chip)
/* Enable ASPM */ /* Enable ASPM */
if (chip->aspm_l0s_l1_en) { if (chip->aspm_l0s_l1_en) {
if (chip->dynamic_aspm) { if (chip->dynamic_aspm) {
if (CHK_SDIO_EXIST(chip)) { if (CHK_SDIO_EXIST(chip) && CHECK_PID(chip, 0x5288)) {
if (CHECK_PID(chip, 0x5288)) {
retval = rtsx_write_cfg_dw(chip, 2, 0xC0, 0xFF, chip->aspm_l0s_l1_en); retval = rtsx_write_cfg_dw(chip, 2, 0xC0, 0xFF, chip->aspm_l0s_l1_en);
if (retval != STATUS_SUCCESS) if (retval != STATUS_SUCCESS)
TRACE_RET(chip, STATUS_FAIL); TRACE_RET(chip, STATUS_FAIL);
} }
}
} else { } else {
if (CHECK_PID(chip, 0x5208)) if (CHECK_PID(chip, 0x5208))
RTSX_WRITE_REG(chip, ASPM_FORCE_CTL, RTSX_WRITE_REG(chip, ASPM_FORCE_CTL,
...@@ -350,18 +348,14 @@ int rtsx_reset_chip(struct rtsx_chip *chip) ...@@ -350,18 +348,14 @@ int rtsx_reset_chip(struct rtsx_chip *chip)
} }
if (CHECK_PID(chip, 0x5288)) { if (CHECK_PID(chip, 0x5288) && !CHK_SDIO_EXIST(chip)) {
if (!CHK_SDIO_EXIST(chip)) { retval = rtsx_write_cfg_dw(chip, 2, 0xC0, 0xFFFF, 0x0103);
retval = rtsx_write_cfg_dw(chip, 2, 0xC0, 0xFFFF,
0x0103);
if (retval != STATUS_SUCCESS) if (retval != STATUS_SUCCESS)
TRACE_RET(chip, STATUS_FAIL); TRACE_RET(chip, STATUS_FAIL);
retval = rtsx_write_cfg_dw(chip, 2, 0x84, 0xFF, 0x03); retval = rtsx_write_cfg_dw(chip, 2, 0x84, 0xFF, 0x03);
if (retval != STATUS_SUCCESS) if (retval != STATUS_SUCCESS)
TRACE_RET(chip, STATUS_FAIL); TRACE_RET(chip, STATUS_FAIL);
}
} }
RTSX_WRITE_REG(chip, IRQSTAT0, LINK_RDY_INT, LINK_RDY_INT); RTSX_WRITE_REG(chip, IRQSTAT0, LINK_RDY_INT, LINK_RDY_INT);
...@@ -1727,10 +1721,8 @@ int rtsx_pre_handle_interrupt(struct rtsx_chip *chip) ...@@ -1727,10 +1721,8 @@ int rtsx_pre_handle_interrupt(struct rtsx_chip *chip)
chip->ocp_int = ocp_int & status; chip->ocp_int = ocp_int & status;
#endif #endif
if (chip->sd_io) { if (chip->sd_io && (chip->int_reg & DATA_DONE_INT))
if (chip->int_reg & DATA_DONE_INT)
chip->int_reg &= ~(u32)DATA_DONE_INT; chip->int_reg &= ~(u32)DATA_DONE_INT;
}
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
...@@ -1796,8 +1788,7 @@ void rtsx_do_before_power_down(struct rtsx_chip *chip, int pm_stat) ...@@ -1796,8 +1788,7 @@ void rtsx_do_before_power_down(struct rtsx_chip *chip, int pm_stat)
void rtsx_enable_aspm(struct rtsx_chip *chip) void rtsx_enable_aspm(struct rtsx_chip *chip)
{ {
if (chip->aspm_l0s_l1_en && chip->dynamic_aspm) { if (chip->aspm_l0s_l1_en && chip->dynamic_aspm && !chip->aspm_enabled) {
if (!chip->aspm_enabled) {
dev_dbg(rtsx_dev(chip), "Try to enable ASPM\n"); dev_dbg(rtsx_dev(chip), "Try to enable ASPM\n");
chip->aspm_enabled = 1; chip->aspm_enabled = 1;
...@@ -1822,7 +1813,6 @@ void rtsx_enable_aspm(struct rtsx_chip *chip) ...@@ -1822,7 +1813,6 @@ void rtsx_enable_aspm(struct rtsx_chip *chip)
0xFFFF, val); 0xFFFF, val);
} }
} }
}
} }
void rtsx_disable_aspm(struct rtsx_chip *chip) void rtsx_disable_aspm(struct rtsx_chip *chip)
...@@ -1830,8 +1820,7 @@ void rtsx_disable_aspm(struct rtsx_chip *chip) ...@@ -1830,8 +1820,7 @@ void rtsx_disable_aspm(struct rtsx_chip *chip)
if (CHECK_PID(chip, 0x5208)) if (CHECK_PID(chip, 0x5208))
rtsx_monitor_aspm_config(chip); rtsx_monitor_aspm_config(chip);
if (chip->aspm_l0s_l1_en && chip->dynamic_aspm) { if (chip->aspm_l0s_l1_en && chip->dynamic_aspm && chip->aspm_enabled) {
if (chip->aspm_enabled) {
dev_dbg(rtsx_dev(chip), "Try to disable ASPM\n"); dev_dbg(rtsx_dev(chip), "Try to disable ASPM\n");
chip->aspm_enabled = 0; chip->aspm_enabled = 0;
...@@ -1845,7 +1834,6 @@ void rtsx_disable_aspm(struct rtsx_chip *chip) ...@@ -1845,7 +1834,6 @@ void rtsx_disable_aspm(struct rtsx_chip *chip)
wait_timeout(1); wait_timeout(1);
} }
}
} }
int rtsx_read_ppbuf(struct rtsx_chip *chip, u8 *buf, int buf_len) int rtsx_read_ppbuf(struct rtsx_chip *chip, u8 *buf, int buf_len)
......
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