mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
msm: camera: Allow driver file to be opend only once.
Use proper synchronization to ensure driver file is opened only once. CRs-Fixed: 2023513 Change-Id: I71e55e2d487fe561d3f596590b3e8102c5e921b5 Signed-off-by: Trishansh Bhardwaj <tbhardwa@codeaurora.org> (cherry picked from commit 84f8c42e5d848b1d04f49d253f98296e8c2280b9)
This commit is contained in:
parent
aaab8b2495
commit
20ffd0b6f0
1 changed files with 1 additions and 3 deletions
|
@ -753,11 +753,9 @@ static int msm_open(struct file *filep)
|
|||
BUG_ON(!pvdev);
|
||||
|
||||
/* !!! only ONE open is allowed !!! */
|
||||
if (atomic_read(&pvdev->opened))
|
||||
if (atomic_cmpxchg(&pvdev->opened, 0, 1))
|
||||
return -EBUSY;
|
||||
|
||||
atomic_set(&pvdev->opened, 1);
|
||||
|
||||
spin_lock_irqsave(&msm_pid_lock, flags);
|
||||
msm_pid = get_pid(task_pid(current));
|
||||
spin_unlock_irqrestore(&msm_pid_lock, flags);
|
||||
|
|
Loading…
Reference in a new issue