mirror of
https://github.com/torvalds/linux.git
synced 2026-06-09 23:23:53 +02:00
net: wireless: bcmdhd: Make responce waiting uninterruptible
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
This commit is contained in:
parent
0daae7684b
commit
794eb6216d
|
|
@ -671,16 +671,12 @@ dhd_timeout_expired(dhd_timeout_t *tmo)
|
|||
} else {
|
||||
wait_queue_head_t delay_wait;
|
||||
DECLARE_WAITQUEUE(wait, current);
|
||||
int pending;
|
||||
init_waitqueue_head(&delay_wait);
|
||||
add_wait_queue(&delay_wait, &wait);
|
||||
set_current_state(TASK_INTERRUPTIBLE);
|
||||
schedule_timeout(1);
|
||||
pending = signal_pending(current);
|
||||
remove_wait_queue(&delay_wait, &wait);
|
||||
set_current_state(TASK_RUNNING);
|
||||
if (pending)
|
||||
return 1; /* Interrupted */
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
@ -3912,7 +3908,6 @@ int
|
|||
dhd_os_ioctl_resp_wait(dhd_pub_t *pub, uint *condition, bool *pending)
|
||||
{
|
||||
dhd_info_t * dhd = (dhd_info_t *)(pub->info);
|
||||
DECLARE_WAITQUEUE(wait, current);
|
||||
int timeout = dhd_ioctl_timeout_msec;
|
||||
|
||||
/* Convert timeout in millsecond to jiffies */
|
||||
|
|
@ -3922,23 +3917,7 @@ dhd_os_ioctl_resp_wait(dhd_pub_t *pub, uint *condition, bool *pending)
|
|||
timeout = timeout * HZ / 1000;
|
||||
#endif
|
||||
|
||||
/* Wait until control frame is available */
|
||||
add_wait_queue(&dhd->ioctl_resp_wait, &wait);
|
||||
set_current_state(TASK_INTERRUPTIBLE);
|
||||
|
||||
/* Memory barrier to support multi-processing
|
||||
* As the variable "condition", which points to dhd->rxlen (dhd_bus_rxctl[dhd_sdio.c])
|
||||
* Can be changed by another processor.
|
||||
*/
|
||||
smp_mb();
|
||||
while (!(*condition) && timeout) {
|
||||
timeout = schedule_timeout(timeout);
|
||||
smp_mb();
|
||||
}
|
||||
|
||||
set_current_state(TASK_RUNNING);
|
||||
remove_wait_queue(&dhd->ioctl_resp_wait, &wait);
|
||||
|
||||
timeout = wait_event_timeout(dhd->ioctl_resp_wait, (*condition), timeout);
|
||||
return timeout;
|
||||
}
|
||||
|
||||
|
|
@ -3948,7 +3927,7 @@ dhd_os_ioctl_resp_wake(dhd_pub_t *pub)
|
|||
dhd_info_t *dhd = (dhd_info_t *)(pub->info);
|
||||
|
||||
if (waitqueue_active(&dhd->ioctl_resp_wait)) {
|
||||
wake_up_interruptible(&dhd->ioctl_resp_wait);
|
||||
wake_up(&dhd->ioctl_resp_wait);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
@ -4297,8 +4276,13 @@ void dhd_wait_for_event(dhd_pub_t *dhd, bool *lockvar)
|
|||
{
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0))
|
||||
struct dhd_info *dhdinfo = dhd->info;
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
|
||||
int timeout = msecs_to_jiffies(2000);
|
||||
#else
|
||||
int timeout = 2 * HZ;
|
||||
#endif
|
||||
dhd_os_sdunlock(dhd);
|
||||
wait_event_interruptible_timeout(dhdinfo->ctrl_wait, (*lockvar == FALSE), HZ * 2);
|
||||
wait_event_timeout(dhdinfo->ctrl_wait, (*lockvar == FALSE), timeout);
|
||||
dhd_os_sdlock(dhd);
|
||||
#endif
|
||||
return;
|
||||
|
|
@ -4309,7 +4293,7 @@ void dhd_wait_event_wakeup(dhd_pub_t *dhd)
|
|||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0))
|
||||
struct dhd_info *dhdinfo = dhd->info;
|
||||
if (waitqueue_active(&dhdinfo->ctrl_wait))
|
||||
wake_up_interruptible(&dhdinfo->ctrl_wait);
|
||||
wake_up(&dhdinfo->ctrl_wait);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3124,9 +3124,9 @@ dhd_bus_init(dhd_pub_t *dhdp, bool enforce_mutex)
|
|||
dhd_timeout_start(&tmo, DHD_WAIT_F2RDY * 1000);
|
||||
|
||||
ready = 0;
|
||||
while (ready != enable && !dhd_timeout_expired(&tmo))
|
||||
ready = bcmsdh_cfg_read(bus->sdh, SDIO_FUNC_0, SDIOD_CCCR_IORDY, NULL);
|
||||
|
||||
do {
|
||||
ready = bcmsdh_cfg_read(bus->sdh, SDIO_FUNC_0, SDIOD_CCCR_IORDY, NULL);
|
||||
} while (ready != enable && !dhd_timeout_expired(&tmo));
|
||||
|
||||
DHD_INFO(("%s: enable 0x%02x, ready 0x%02x (waited %uus)\n",
|
||||
__FUNCTION__, enable, ready, tmo.elapsed));
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user