mirror of
https://github.com/apache/nuttx.git
synced 2026-10-23 23:08:44 +00:00
stm32/comp: propagate enable error and handle lock in ioctl
In comp_ioctl(), propagate the return code of comp_enable() to caller so failures (such as when the comparator CSR register is locked) return -EPERM. Also call comp_lock_set() if the comparator was configured with locking, handling cases where initialization was delayed. Assisted-by: Gemini:gemini-3.8-pro Signed-off-by: Daniel P. Carvalho <danieloak@gmail.com>
This commit is contained in:
parent
3f4dc2ddf3
commit
774387d980
1 changed files with 7 additions and 2 deletions
|
|
@ -929,7 +929,12 @@ static int comp_ioctl(struct comp_dev_s *dev, int cmd, unsigned long arg)
|
|||
{
|
||||
/* Enable comparator */
|
||||
|
||||
comp_enable(priv, true);
|
||||
ret = comp_enable(priv, true);
|
||||
if (ret == OK && priv->lock)
|
||||
{
|
||||
comp_lock_set(priv, true);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -937,7 +942,7 @@ static int comp_ioctl(struct comp_dev_s *dev, int cmd, unsigned long arg)
|
|||
{
|
||||
/* Disable comparator */
|
||||
|
||||
comp_enable(priv, false);
|
||||
ret = comp_enable(priv, false);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue