Commit 0629eaeb authored by Roland Vossen's avatar Roland Vossen Committed by Greg Kroah-Hartman

staging: brcm80211: replaced fullmac BRCMF_PM_RESUME_WAIT macro with function

Code cleanup. Advantage is more readable code and better type checking.
Reported-by: default avatarJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: default avatarRoland Vossen <rvossen@broadcom.com>
Reviewed-by: default avatarFranky Lin <frankyl@broadcom.com>
Reviewed-by: default avatarArend van Spriel <arend@broadcom.com>
Reviewed-by: default avatarPieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 72a4915f
...@@ -84,14 +84,6 @@ DECLARE_WAIT_QUEUE_HEAD(sdioh_request_byte_wait); ...@@ -84,14 +84,6 @@ DECLARE_WAIT_QUEUE_HEAD(sdioh_request_byte_wait);
DECLARE_WAIT_QUEUE_HEAD(sdioh_request_word_wait); DECLARE_WAIT_QUEUE_HEAD(sdioh_request_word_wait);
DECLARE_WAIT_QUEUE_HEAD(sdioh_request_packet_wait); DECLARE_WAIT_QUEUE_HEAD(sdioh_request_packet_wait);
DECLARE_WAIT_QUEUE_HEAD(sdioh_request_buffer_wait); DECLARE_WAIT_QUEUE_HEAD(sdioh_request_buffer_wait);
#define BRCMF_PM_RESUME_WAIT(a, b) do { \
int retry = 0; \
while (atomic_read(&b->suspend) && retry++ != 30) { \
wait_event_timeout(a, false, HZ/100); \
} \
} while (0)
#else
#define BRCMF_PM_RESUME_WAIT(a, b)
#endif /* CONFIG_PM_SLEEP */ #endif /* CONFIG_PM_SLEEP */
static int static int
...@@ -108,6 +100,16 @@ brcmf_pm_resume_error(struct brcmf_sdio_dev *sdiodev) ...@@ -108,6 +100,16 @@ brcmf_pm_resume_error(struct brcmf_sdio_dev *sdiodev)
return is_err; return is_err;
} }
static void
brcmf_pm_resume_wait(struct brcmf_sdio_dev *sdiodev, wait_queue_head_t wq)
{
#ifdef CONFIG_PM_SLEEP
int retry = 0;
while (atomic_read(&sdiodev->suspend) && retry++ != 30)
wait_event_timeout(wq, false, HZ/100);
#endif
}
static int brcmf_sdioh_enablefuncs(struct brcmf_sdio_dev *sdiodev) static int brcmf_sdioh_enablefuncs(struct brcmf_sdio_dev *sdiodev)
{ {
int err_ret; int err_ret;
...@@ -255,7 +257,7 @@ brcmf_sdioh_request_byte(struct brcmf_sdio_dev *sdiodev, uint rw, uint func, ...@@ -255,7 +257,7 @@ brcmf_sdioh_request_byte(struct brcmf_sdio_dev *sdiodev, uint rw, uint func,
brcmf_dbg(INFO, "rw=%d, func=%d, addr=0x%05x\n", rw, func, regaddr); brcmf_dbg(INFO, "rw=%d, func=%d, addr=0x%05x\n", rw, func, regaddr);
BRCMF_PM_RESUME_WAIT(sdioh_request_byte_wait, sdiodev); brcmf_pm_resume_wait(sdiodev, sdioh_request_byte_wait);
if (brcmf_pm_resume_error(sdiodev)) if (brcmf_pm_resume_error(sdiodev))
return -EIO; return -EIO;
if (rw) { /* CMD52 Write */ if (rw) { /* CMD52 Write */
...@@ -358,7 +360,7 @@ brcmf_sdioh_request_word(struct brcmf_sdio_dev *sdiodev, uint cmd_type, uint rw, ...@@ -358,7 +360,7 @@ brcmf_sdioh_request_word(struct brcmf_sdio_dev *sdiodev, uint cmd_type, uint rw,
brcmf_dbg(INFO, "cmd_type=%d, rw=%d, func=%d, addr=0x%05x, nbytes=%d\n", brcmf_dbg(INFO, "cmd_type=%d, rw=%d, func=%d, addr=0x%05x, nbytes=%d\n",
cmd_type, rw, func, addr, nbytes); cmd_type, rw, func, addr, nbytes);
BRCMF_PM_RESUME_WAIT(sdioh_request_word_wait, sdiodev); brcmf_pm_resume_wait(sdiodev, sdioh_request_word_wait);
if (brcmf_pm_resume_error(sdiodev)) if (brcmf_pm_resume_error(sdiodev))
return -EIO; return -EIO;
/* Claim host controller */ /* Claim host controller */
...@@ -408,7 +410,7 @@ brcmf_sdioh_request_packet(struct brcmf_sdio_dev *sdiodev, uint fix_inc, ...@@ -408,7 +410,7 @@ brcmf_sdioh_request_packet(struct brcmf_sdio_dev *sdiodev, uint fix_inc,
brcmf_dbg(TRACE, "Enter\n"); brcmf_dbg(TRACE, "Enter\n");
BRCMF_PM_RESUME_WAIT(sdioh_request_packet_wait, sdiodev); brcmf_pm_resume_wait(sdiodev, sdioh_request_packet_wait);
if (brcmf_pm_resume_error(sdiodev)) if (brcmf_pm_resume_error(sdiodev))
return -EIO; return -EIO;
...@@ -486,7 +488,7 @@ brcmf_sdioh_request_buffer(struct brcmf_sdio_dev *sdiodev, uint pio_dma, ...@@ -486,7 +488,7 @@ brcmf_sdioh_request_buffer(struct brcmf_sdio_dev *sdiodev, uint pio_dma,
brcmf_dbg(TRACE, "Enter\n"); brcmf_dbg(TRACE, "Enter\n");
BRCMF_PM_RESUME_WAIT(sdioh_request_buffer_wait, sdiodev); brcmf_pm_resume_wait(sdiodev, sdioh_request_buffer_wait);
if (brcmf_pm_resume_error(sdiodev)) if (brcmf_pm_resume_error(sdiodev))
return -EIO; return -EIO;
/* Case 1: we don't have a packet. */ /* Case 1: we don't have a packet. */
......
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