Commit 8b36ac44 authored by Arend van Spriel's avatar Arend van Spriel Committed by Greg Kroah-Hartman

staging: brcm80211: reducing indentation levels in bcmsdh_sdmmc.c

Some functions in the source file had a lot of indentation levels
forcing statements to be spread over multiple lines impairing the
readability of the code.
Reported-by: default avatarJoe Perches <joe@perches.com>
Reviewed-by: default avatarFranky (Zhenhui) Lin <frankyl@broadcom.com>
Reviewed-by: default avatarRoland Vossen <rvossen@broadcom.com>
Signed-off-by: default avatarFranky Lin <frankyl@broadcom.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 9f3697f9
...@@ -70,92 +70,80 @@ brcmf_pm_resume_wait(struct brcmf_sdio_dev *sdiodev, wait_queue_head_t *wq) ...@@ -70,92 +70,80 @@ brcmf_pm_resume_wait(struct brcmf_sdio_dev *sdiodev, wait_queue_head_t *wq)
#endif #endif
} }
int brcmf_sdioh_request_byte(struct brcmf_sdio_dev *sdiodev, uint rw, uint func, static inline int brcmf_sdioh_f0_write_byte(struct brcmf_sdio_dev *sdiodev,
uint regaddr, u8 *byte) uint regaddr, u8 *byte)
{ {
struct sdio_func *sdfunc = sdiodev->func[0];
int err_ret; int err_ret;
brcmf_dbg(INFO, "rw=%d, func=%d, addr=0x%05x\n", rw, func, regaddr); /*
* Can only directly write to some F0 registers.
brcmf_pm_resume_wait(sdiodev, &sdiodev->request_byte_wait); * Handle F2 enable/disable and Abort command
if (brcmf_pm_resume_error(sdiodev))
return -EIO;
if (rw) { /* CMD52 Write */
if (func == 0) {
/* Can only directly write to some F0 registers.
* Handle F2 enable
* as a special case. * as a special case.
*/ */
if (regaddr == SDIO_CCCR_IOEx) { if (regaddr == SDIO_CCCR_IOEx) {
if (sdiodev->func[2]) { sdfunc = sdiodev->func[2];
sdio_claim_host(sdiodev->func[2]); if (sdfunc) {
sdio_claim_host(sdfunc);
if (*byte & SDIO_FUNC_ENABLE_2) { if (*byte & SDIO_FUNC_ENABLE_2) {
/* Enable Function 2 */ /* Enable Function 2 */
err_ret = err_ret = sdio_enable_func(sdfunc);
sdio_enable_func
(sdiodev->func[2]);
if (err_ret) if (err_ret)
brcmf_dbg(ERROR, brcmf_dbg(ERROR,
"enable F2 failed:%d\n", "enable F2 failed:%d\n",
err_ret); err_ret);
} else { } else {
/* Disable Function 2 */ /* Disable Function 2 */
err_ret = err_ret = sdio_disable_func(sdfunc);
sdio_disable_func
(sdiodev->func[2]);
if (err_ret) if (err_ret)
brcmf_dbg(ERROR, brcmf_dbg(ERROR,
"Disable F2 failed:%d\n", "Disable F2 failed:%d\n",
err_ret); err_ret);
} }
sdio_release_host(sdiodev->func[2]); sdio_release_host(sdfunc);
}
} }
/* to allow abort command through F1 */ } else if (regaddr == SDIO_CCCR_ABORT) {
else if (regaddr == SDIO_CCCR_ABORT) { sdio_claim_host(sdfunc);
sdio_claim_host(sdiodev->func[func]); sdio_writeb(sdfunc, *byte, regaddr, &err_ret);
/* sdio_release_host(sdfunc);
* this sdio_f0_writeb() can be replaced
* with another api
* depending upon MMC driver change.
* As of this time, this is temporaray one
*/
sdio_writeb(sdiodev->func[func], *byte,
regaddr, &err_ret);
sdio_release_host(sdiodev->func[func]);
} else if (regaddr < 0xF0) { } else if (regaddr < 0xF0) {
brcmf_dbg(ERROR, "F0 Wr:0x%02x: write disallowed\n", brcmf_dbg(ERROR, "F0 Wr:0x%02x: write disallowed\n", regaddr);
regaddr); err_ret = -EPERM;
} else { } else {
/* Claim host controller, perform F0 write, sdio_claim_host(sdfunc);
and release */ sdio_f0_writeb(sdfunc, *byte, regaddr, &err_ret);
sdio_claim_host(sdiodev->func[func]); sdio_release_host(sdfunc);
sdio_f0_writeb(sdiodev->func[func], *byte,
regaddr, &err_ret);
sdio_release_host(sdiodev->func[func]);
} }
return err_ret;
}
int brcmf_sdioh_request_byte(struct brcmf_sdio_dev *sdiodev, uint rw, uint func,
uint regaddr, u8 *byte)
{
int err_ret;
brcmf_dbg(INFO, "rw=%d, func=%d, addr=0x%05x\n", rw, func, regaddr);
brcmf_pm_resume_wait(sdiodev, &sdiodev->request_byte_wait);
if (brcmf_pm_resume_error(sdiodev))
return -EIO;
if (rw && func == 0) {
/* handle F0 separately */
err_ret = brcmf_sdioh_f0_write_byte(sdiodev, regaddr, byte);
} else { } else {
/* Claim host controller, perform Fn write,
and release */
sdio_claim_host(sdiodev->func[func]); sdio_claim_host(sdiodev->func[func]);
if (rw) /* CMD52 Write */
sdio_writeb(sdiodev->func[func], *byte, regaddr, sdio_writeb(sdiodev->func[func], *byte, regaddr,
&err_ret); &err_ret);
sdio_release_host(sdiodev->func[func]); else if (func == 0) {
} *byte = sdio_f0_readb(sdiodev->func[func], regaddr,
} else { /* CMD52 Read */
/* Claim host controller, perform Fn read, and release */
sdio_claim_host(sdiodev->func[func]);
if (func == 0) {
*byte =
sdio_f0_readb(sdiodev->func[func], regaddr,
&err_ret); &err_ret);
} else { } else {
*byte = *byte = sdio_readb(sdiodev->func[func], regaddr,
sdio_readb(sdiodev->func[func], regaddr,
&err_ret); &err_ret);
} }
sdio_release_host(sdiodev->func[func]); sdio_release_host(sdiodev->func[func]);
} }
...@@ -197,11 +185,9 @@ int brcmf_sdioh_request_word(struct brcmf_sdio_dev *sdiodev, ...@@ -197,11 +185,9 @@ int brcmf_sdioh_request_word(struct brcmf_sdio_dev *sdiodev,
brcmf_dbg(ERROR, "Invalid nbytes: %d\n", nbytes); brcmf_dbg(ERROR, "Invalid nbytes: %d\n", nbytes);
} else { /* CMD52 Read */ } else { /* CMD52 Read */
if (nbytes == 4) if (nbytes == 4)
*word = *word = sdio_readl(sdiodev->func[func], addr, &err_ret);
sdio_readl(sdiodev->func[func], addr, &err_ret);
else if (nbytes == 2) else if (nbytes == 2)
*word = *word = sdio_readw(sdiodev->func[func], addr,
sdio_readw(sdiodev->func[func], addr,
&err_ret) & 0xFFFF; &err_ret) & 0xFFFF;
else else
brcmf_dbg(ERROR, "Invalid nbytes: %d\n", nbytes); brcmf_dbg(ERROR, "Invalid nbytes: %d\n", nbytes);
......
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