mirror of
https://github.com/apache/nuttx.git
synced 2026-05-28 11:56:10 +08:00
sched_lock refine: remove sched_[un]lock in xxx_waitsample
Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user