struct timer_list timer;
struct completion watchdog_wait;
struct task_struct *watchdog_tsk;
- bool wd_timer_valid;
- uint save_ms;
+ bool wd_active;
struct workqueue_struct *brcmf_wq;
struct work_struct datawork;
brcmf_sdio_clkctl(bus, CLK_NONE, pendok);
} else {
brcmf_sdio_clkctl(bus, CLK_AVAIL, pendok);
- brcmf_sdio_wd_timer(bus, BRCMF_WD_POLL_MS);
+ brcmf_sdio_wd_timer(bus, true);
}
bus->sleeping = sleep;
brcmf_dbg(SDIO, "new state %s\n",
if (bus->idlecount > bus->idletime) {
brcmf_dbg(SDIO, "idle\n");
sdio_claim_host(bus->sdiodev->func[1]);
- brcmf_sdio_wd_timer(bus, 0);
+ brcmf_sdio_wd_timer(bus, false);
bus->idlecount = 0;
brcmf_sdio_bus_sleep(bus, true, false);
sdio_release_host(bus->sdiodev->func[1]);
if (bus->watchdog_tsk) {
complete(&bus->watchdog_wait);
/* Reschedule the watchdog */
- if (bus->wd_timer_valid)
+ if (bus->wd_active)
mod_timer(&bus->timer,
jiffies + msecs_to_jiffies(BRCMF_WD_POLL_MS));
}
/* Start the watchdog timer */
bus->sdcnt.tickcnt = 0;
- brcmf_sdio_wd_timer(bus, BRCMF_WD_POLL_MS);
+ brcmf_sdio_wd_timer(bus, true);
sdio_claim_host(sdiodev->func[1]);
if (bus->ci) {
if (bus->sdiodev->state != BRCMF_SDIOD_NOMEDIUM) {
sdio_claim_host(bus->sdiodev->func[1]);
- brcmf_sdio_wd_timer(bus, 0);
+ brcmf_sdio_wd_timer(bus, false);
brcmf_sdio_clkctl(bus, CLK_AVAIL, false);
/* Leave the device in state where it is
* 'passive'. This is done by resetting all
brcmf_dbg(TRACE, "Disconnected\n");
}
-void brcmf_sdio_wd_timer(struct brcmf_sdio *bus, uint wdtick)
+void brcmf_sdio_wd_timer(struct brcmf_sdio *bus, bool active)
{
/* Totally stop the timer */
- if (!wdtick && bus->wd_timer_valid) {
+ if (!active && bus->wd_active) {
del_timer_sync(&bus->timer);
- bus->wd_timer_valid = false;
- bus->save_ms = wdtick;
+ bus->wd_active = false;
return;
}
if (bus->sdiodev->state != BRCMF_SDIOD_DATA)
return;
- if (wdtick) {
- if (bus->save_ms != BRCMF_WD_POLL_MS) {
- if (bus->wd_timer_valid)
- /* Stop timer and restart at new value */
- del_timer_sync(&bus->timer);
-
+ if (active) {
+ if (!bus->wd_active) {
/* Create timer again when watchdog period is
dynamically changed or in the first instance
*/
bus->timer.expires =
jiffies + msecs_to_jiffies(BRCMF_WD_POLL_MS);
add_timer(&bus->timer);
-
+ bus->wd_active = true;
} else {
/* Re arm the timer, at last watchdog period */
mod_timer(&bus->timer,
jiffies + msecs_to_jiffies(BRCMF_WD_POLL_MS));
}
-
- bus->wd_timer_valid = true;
- bus->save_ms = wdtick;
}
}