sched_lock refine: remove sched_[un]lock in xxx_waitsample

Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
hujun5
2023-09-26 20:37:09 +08:00
committed by Xiang Xiao
parent b2e6d7b9d7
commit 1a65f5ed88
5 changed files with 17 additions and 52 deletions
-12
View File
@@ -1263,12 +1263,8 @@ static int usbhost_waitsample(FAR struct usbhost_state_s *priv,
/* Interrupts must be disabled when this is called to (1) prevent posting
* of semaphores from interrupt handlers, and (2) to prevent sampled data
* from changing until it has been reported.
*
* In addition, we will also disable pre-emption to prevent other threads
* from getting control while we muck with the semaphores.
*/
sched_lock();
flags = enter_critical_section();
/* Now release the semaphore that manages mutually exclusive access to
@@ -1322,14 +1318,6 @@ errout:
*/
leave_critical_section(flags);
/* Restore pre-emption. We might get suspended here but that is okay
* because we already have our sample. Note: this means that if there
* were two threads reading from the HIDMOUSE for some reason, the data
* might be read out of order.
*/
sched_unlock();
return ret;
}
-12
View File
@@ -960,12 +960,8 @@ static int usbhost_waitsample(FAR struct usbhost_state_s *priv,
/* Interrupts must be disabled when this is called to (1) prevent posting
* of semaphores from interrupt handlers, and (2) to prevent sampled data
* from changing until it has been reported.
*
* In addition, we will also disable pre-emption to prevent other threads
* from getting control while we muck with the semaphores.
*/
sched_lock();
flags = enter_critical_section();
/* Now release the semaphore that manages mutually exclusive access to
@@ -1019,14 +1015,6 @@ errout:
*/
leave_critical_section(flags);
/* Restore pre-emption. We might get suspended here but that is okay
* because we already have our sample. Note: this means that if there
* were two threads reading from the HIDMOUSE for some reason, the data
* might be read out of order.
*/
sched_unlock();
return ret;
}