mirror of
https://github.com/apache/nuttx.git
synced 2026-05-22 13:52:22 +08:00
drivers/input/ff: use small lock to replace enter_critical_section
replace critical_section with spinlock Signed-off-by: fangpeina <fangpeina@xiaomi.com>
This commit is contained in:
@@ -204,7 +204,6 @@ static int ff_erase_effect(FAR struct ff_upperhalf_s *upper, int effect_id,
|
||||
FAR struct file *filep)
|
||||
{
|
||||
FAR struct ff_lowerhalf_s *lower = upper->lower;
|
||||
irqstate_t flags;
|
||||
int ret;
|
||||
|
||||
ret = ff_check_effect_access(upper, effect_id, filep);
|
||||
@@ -213,9 +212,7 @@ static int ff_erase_effect(FAR struct ff_upperhalf_s *upper, int effect_id,
|
||||
return ret;
|
||||
}
|
||||
|
||||
flags = enter_critical_section();
|
||||
lower->playback(lower, effect_id, 0);
|
||||
leave_critical_section(flags);
|
||||
|
||||
upper->effects[effect_id].owner = NULL;
|
||||
if (lower->erase != NULL)
|
||||
@@ -465,7 +462,6 @@ static int ff_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
|
||||
int ff_event(FAR struct ff_lowerhalf_s *lower, uint32_t code, int value)
|
||||
{
|
||||
irqstate_t flags;
|
||||
int ret = OK;
|
||||
|
||||
switch (code)
|
||||
@@ -477,9 +473,7 @@ int ff_event(FAR struct ff_lowerhalf_s *lower, uint32_t code, int value)
|
||||
break;
|
||||
}
|
||||
|
||||
flags = enter_critical_section();
|
||||
lower->set_gain(lower, value);
|
||||
leave_critical_section(flags);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -490,9 +484,7 @@ int ff_event(FAR struct ff_lowerhalf_s *lower, uint32_t code, int value)
|
||||
break;
|
||||
}
|
||||
|
||||
flags = enter_critical_section();
|
||||
lower->set_autocenter(lower, value);
|
||||
leave_critical_section(flags);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -500,9 +492,7 @@ int ff_event(FAR struct ff_lowerhalf_s *lower, uint32_t code, int value)
|
||||
{
|
||||
if (ff_check_effect_access(lower->priv, code, NULL) == 0)
|
||||
{
|
||||
flags = enter_critical_section();
|
||||
ret = lower->playback(lower, code, value);
|
||||
leave_critical_section(flags);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user