140-linux_3.18.patch 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. --- a/src/include/drv_dsl_cpe_os_linux.h
  2. +++ b/src/include/drv_dsl_cpe_os_linux.h
  3. @@ -214,12 +214,35 @@ static inline int dsl_mutex_lock(struct
  4. #define DSL_DRV_MUTEX_LOCK(id) down_interruptible(&(id))
  5. #define DSL_DRV_MUTEX_UNLOCK(id) up(&(id))
  6. #endif
  7. +
  8. +static inline long
  9. +ugly_hack_sleep_on_timeout(wait_queue_head_t *q, long timeout)
  10. +{
  11. + unsigned long flags;
  12. + wait_queue_t wait;
  13. +
  14. + init_waitqueue_entry(&wait, current);
  15. +
  16. + __set_current_state(TASK_INTERRUPTIBLE);
  17. + spin_lock_irqsave(&q->lock, flags);
  18. + __add_wait_queue(q, &wait);
  19. + spin_unlock(&q->lock);
  20. +
  21. + timeout = schedule_timeout(timeout);
  22. +
  23. + spin_lock_irq(&q->lock);
  24. + __remove_wait_queue(q, &wait);
  25. + spin_unlock_irqrestore(&q->lock, flags);
  26. +
  27. + return timeout;
  28. +}
  29. +
  30. #define DSL_DRV_INIT_WAKELIST(name,queue) init_waitqueue_head(&(queue))
  31. #define DSL_DRV_WAKEUP_WAKELIST(queue) wake_up_interruptible(&(queue))
  32. #define DSL_DRV_INIT_EVENT(name,ev) init_waitqueue_head(&(ev))
  33. /* wait for an event, timeout is measured in ms */
  34. -#define DSL_DRV_WAIT_EVENT_TIMEOUT(ev,t) interruptible_sleep_on_timeout(&(ev), (t) * HZ / 1000)
  35. -#define DSL_DRV_WAIT_EVENT(ev) interruptible_sleep_on(&(ev))
  36. +#define DSL_DRV_WAIT_EVENT_TIMEOUT(ev,t) ugly_hack_sleep_on_timeout(&(ev), (t) * HZ / 1000)
  37. +#define DSL_DRV_WAIT_EVENT(ev) ugly_hack_sleep_on_timeout(&(ev), MAX_SCHEDULE_TIMEOUT)
  38. #define DSL_DRV_WAKEUP_EVENT(ev) wake_up_interruptible(&(ev))
  39. #define DSL_DRV_TimeMSecGet() DSL_DRV_ElapsedTimeMSecGet(0)
  40. #define DSL_WAIT(ms) msleep(ms)