mirror of
https://github.com/apache/nuttx.git
synced 2026-05-30 13:27:01 +08:00
drivers/pwm : remove critical section and mutex.
Use spinlock to replace critical section and mutex. Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
This commit is contained in:
@@ -316,10 +316,6 @@ static int pwm_start(FAR struct pwm_upperhalf_s *upper, unsigned int oflags)
|
|||||||
|
|
||||||
if (!upper->started)
|
if (!upper->started)
|
||||||
{
|
{
|
||||||
/* Disable interrupts to avoid race conditions */
|
|
||||||
|
|
||||||
flags = enter_critical_section();
|
|
||||||
|
|
||||||
/* Indicate that if will be waiting for the pulse count to complete.
|
/* Indicate that if will be waiting for the pulse count to complete.
|
||||||
* Note that we will only wait if a non-zero pulse count is specified
|
* Note that we will only wait if a non-zero pulse count is specified
|
||||||
* and if the PWM driver was opened in normal, blocking mode. Also
|
* and if the PWM driver was opened in normal, blocking mode. Also
|
||||||
@@ -369,8 +365,6 @@ static int pwm_start(FAR struct pwm_upperhalf_s *upper, unsigned int oflags)
|
|||||||
upper->started = false;
|
upper->started = false;
|
||||||
upper->waiting = false;
|
upper->waiting = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
leave_critical_section(flags);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
Reference in New Issue
Block a user