1
0
Fork 0
alistair23-linux/drivers/char/imx_amp
Robin Gong d75952f993 LF-857-1: char: imx_amp: imx_sema4: enlarge lock protect
Currently, there is only spin lock added in imx_sema4_mutex_lock(),but
sema4 driver assume any mutex should be handled one by one and complain
when mutex locked once again before unlocked. Hence, if another lock happens
indeed after the last imx_sema4_mutex_lock(),the complains "imx_sema4_
mutex_lock 135 already locked" would come out over again and again as below.
So delay lock released into imx_sema4_mutex_unlock() to elimate such race
contition.

Thread1:                              Thread2:
  ....                               ....
                                     ------------------------------------------
  imx_sema4_mutex_lock ---->grabbed->|imx_sema4_mutex_lock                     |
                                     |"imx_sema4_mutex_lock 135 already locked"|
                                     ------------------------------------------
  imx_sema4_mutex_unlock             imx_sema4_mutex_unlock
  ....                               .....

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Reviewed-by: Anson Huang <anson.huang@nxp.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
(cherry picked from commit 362fdbb91f1c2e386adc6147c07f714be6134907)
2020-02-26 04:17:45 +08:00
..
Kconfig
Makefile
imx_sema4.c LF-857-1: char: imx_amp: imx_sema4: enlarge lock protect 2020-02-26 04:17:45 +08:00