From 0629eaebf3844f2855dd1d8bb74ee5b8f529cb78 Mon Sep 17 00:00:00 2001 From: Roland Vossen Date: Thu, 1 Sep 2011 11:17:02 +0200 Subject: [PATCH] staging: brcm80211: replaced fullmac BRCMF_PM_RESUME_WAIT macro with function Code cleanup. Advantage is more readable code and better type checking. Reported-by: Johannes Berg Signed-off-by: Roland Vossen Reviewed-by: Franky Lin Reviewed-by: Arend van Spriel Reviewed-by: Pieter-Paul Giesberts Signed-off-by: Greg Kroah-Hartman --- .../staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c index d3d389072b5d..be022d273d54 100644 --- a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c +++ b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c @@ -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_packet_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 */ static int @@ -108,6 +100,16 @@ brcmf_pm_resume_error(struct brcmf_sdio_dev *sdiodev) 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) { int err_ret; @@ -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_PM_RESUME_WAIT(sdioh_request_byte_wait, sdiodev); + brcmf_pm_resume_wait(sdiodev, sdioh_request_byte_wait); if (brcmf_pm_resume_error(sdiodev)) return -EIO; if (rw) { /* CMD52 Write */ @@ -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", 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)) return -EIO; /* Claim host controller */ @@ -408,7 +410,7 @@ brcmf_sdioh_request_packet(struct brcmf_sdio_dev *sdiodev, uint fix_inc, 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)) return -EIO; @@ -486,7 +488,7 @@ brcmf_sdioh_request_buffer(struct brcmf_sdio_dev *sdiodev, uint pio_dma, 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)) return -EIO; /* Case 1: we don't have a packet. */ -- 2.30.2