110-semaphore-lock.patch 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. --- a/src/include/drv_dsl_cpe_pm_core.h
  2. +++ b/src/include/drv_dsl_cpe_pm_core.h
  3. @@ -1510,9 +1510,9 @@ typedef struct
  4. /** Common PM module mutex*/
  5. DSL_DRV_Mutex_t pmMutex;
  6. /** PM module direction Near-End mutex*/
  7. - DSL_DRV_Mutex_t pmNeMutex;
  8. + struct semaphore pmNeMutex;
  9. /** PM module direction Far-End mutex*/
  10. - DSL_DRV_Mutex_t pmFeMutex;
  11. + struct semaphore pmFeMutex;
  12. /** PM module Near-End access mutex*/
  13. DSL_DRV_Mutex_t pmNeAccessMutex;
  14. /** PM module Far-End access mutex*/
  15. --- a/src/pm/drv_dsl_cpe_api_pm.c
  16. +++ b/src/pm/drv_dsl_cpe_api_pm.c
  17. @@ -220,9 +220,9 @@ DSL_Error_t DSL_DRV_PM_Start(
  18. /* init PM module common mutex */
  19. DSL_DRV_MUTEX_INIT(DSL_DRV_PM_CONTEXT(pContext)->pmMutex);
  20. /* init PM module direction Near-End mutex */
  21. - DSL_DRV_MUTEX_INIT(DSL_DRV_PM_CONTEXT(pContext)->pmNeMutex);
  22. + sema_init(&(DSL_DRV_PM_CONTEXT(pContext)->pmNeMutex),1);
  23. /* init PM module direction Far-End mutex */
  24. - DSL_DRV_MUTEX_INIT(DSL_DRV_PM_CONTEXT(pContext)->pmFeMutex);
  25. + sema_init(&(DSL_DRV_PM_CONTEXT(pContext)->pmFeMutex),1);
  26. /* init PM module Near-End access mutex */
  27. DSL_DRV_MUTEX_INIT(DSL_DRV_PM_CONTEXT(pContext)->pmNeAccessMutex);
  28. /* init PM module Far-End access mutex */
  29. @@ -592,7 +592,7 @@ DSL_Error_t DSL_DRV_PM_Stop(
  30. if( DSL_DRV_PM_CONTEXT(pContext)->pmThreadFe.bRun != DSL_TRUE )
  31. {
  32. DSL_DEBUG(DSL_DBG_WRN,
  33. - (pContext, SYS_DBG_WRN"DSL[%02d]: PM module Near-End thread already stopped"
  34. + (pContext, SYS_DBG_WRN"DSL[%02d]: PM module Far-End thread already stopped"
  35. DSL_DRV_CRLF, DSL_DEV_NUM(pContext)));
  36. }
  37. else
  38. --- a/src/pm/drv_dsl_cpe_pm_core.c
  39. +++ b/src/pm/drv_dsl_cpe_pm_core.c
  40. @@ -1022,7 +1022,7 @@ DSL_Error_t DSL_DRV_PM_DirectionMutexCon
  41. {
  42. if( bLock )
  43. {
  44. - if( DSL_DRV_MUTEX_LOCK(DSL_DRV_PM_CONTEXT(pContext)->pmNeMutex) )
  45. + if(down_interruptible(&(DSL_DRV_PM_CONTEXT(pContext)->pmNeMutex)))
  46. {
  47. DSL_DEBUG( DSL_DBG_ERR,
  48. (pContext, SYS_DBG_ERR"DSL[%02d]: ERROR - Couldn't lock PM NE mutex!"
  49. @@ -1034,14 +1034,14 @@ DSL_Error_t DSL_DRV_PM_DirectionMutexCon
  50. else
  51. {
  52. /* Unlock PM module NE Mutex*/
  53. - DSL_DRV_MUTEX_UNLOCK(DSL_DRV_PM_CONTEXT(pContext)->pmNeMutex);
  54. + up(&(DSL_DRV_PM_CONTEXT(pContext)->pmNeMutex));
  55. }
  56. }
  57. else
  58. {
  59. if( bLock )
  60. {
  61. - if( DSL_DRV_MUTEX_LOCK(DSL_DRV_PM_CONTEXT(pContext)->pmFeMutex) )
  62. + if(down_interruptible(&(DSL_DRV_PM_CONTEXT(pContext)->pmFeMutex)))
  63. {
  64. DSL_DEBUG( DSL_DBG_ERR,
  65. (pContext, SYS_DBG_ERR"DSL[%02d]: ERROR - Couldn't lock PM FE mutex!"
  66. @@ -1053,7 +1053,7 @@ DSL_Error_t DSL_DRV_PM_DirectionMutexCon
  67. else
  68. {
  69. /* Unlock PM module FE Mutex*/
  70. - DSL_DRV_MUTEX_UNLOCK(DSL_DRV_PM_CONTEXT(pContext)->pmFeMutex);
  71. + up(&(DSL_DRV_PM_CONTEXT(pContext)->pmFeMutex));
  72. }
  73. }
  74. @@ -1139,7 +1139,7 @@ DSL_Error_t DSL_DRV_PM_Lock(DSL_Context_
  75. if( !(DSL_DRV_PM_CONTEXT(pContext)->bPmLock) )
  76. {
  77. /* Lock PM module Near-End Mutex*/
  78. - if( DSL_DRV_MUTEX_LOCK(DSL_DRV_PM_CONTEXT(pContext)->pmNeMutex) )
  79. + if(down_interruptible(&(DSL_DRV_PM_CONTEXT(pContext)->pmNeMutex)))
  80. {
  81. DSL_DEBUG( DSL_DBG_ERR,
  82. (pContext, SYS_DBG_ERR"DSL[%02d]: ERROR - Couldn't lock PM NE mutex!"
  83. @@ -1148,8 +1148,8 @@ DSL_Error_t DSL_DRV_PM_Lock(DSL_Context_
  84. return DSL_ERR_SEMAPHORE_GET;
  85. }
  86. - /* Lock PM module Near-End Mutex*/
  87. - if( DSL_DRV_MUTEX_LOCK(DSL_DRV_PM_CONTEXT(pContext)->pmFeMutex) )
  88. + /* Lock PM module Far-End Mutex*/
  89. + if( down_interruptible(&(DSL_DRV_PM_CONTEXT(pContext)->pmFeMutex)) )
  90. {
  91. DSL_DEBUG( DSL_DBG_ERR,
  92. (pContext, SYS_DBG_ERR"DSL[%02d]: ERROR - Couldn't lock PM FE mutex!"
  93. @@ -1193,10 +1193,10 @@ DSL_Error_t DSL_DRV_PM_UnLock(DSL_Contex
  94. if( DSL_DRV_PM_CONTEXT(pContext)->bPmLock )
  95. {
  96. /* Unlock PM module NE Mutex*/
  97. - DSL_DRV_MUTEX_UNLOCK(DSL_DRV_PM_CONTEXT(pContext)->pmNeMutex);
  98. + up(&(DSL_DRV_PM_CONTEXT(pContext)->pmNeMutex));
  99. /* Unlock PM module FE Mutex*/
  100. - DSL_DRV_MUTEX_UNLOCK(DSL_DRV_PM_CONTEXT(pContext)->pmFeMutex);
  101. + up(&(DSL_DRV_PM_CONTEXT(pContext)->pmFeMutex));
  102. /* Clear bPmLock flag*/
  103. DSL_DRV_PM_CONTEXT(pContext)->bPmLock = DSL_FALSE;