Is mutex necessary in sensor drivers?

Althought the Sensor Driver Programming Guide does not specify that mutexes must be used in the driver, some included drivers (e.g. ov5693.c) make use of them, and some others (e.g. imx185.c) not. Is it necessary? If so, why?

hello euskadi,

adding mutex lock/unlock always related to race condition between sensor and kernel behavior.
you might also check the VI driver, we also have mutex to handle buffer transition.


Hi JerryChang,
So in which cases would be a mutex required/recommended? Only in buffer transition?