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
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;
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 */
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 */
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;
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. */