mirror of
https://github.com/apache/nuttx.git
synced 2026-05-30 13:27:01 +08:00
drivers/sensors: sensor bug fix.
flush fixes the problem of not being able to get the lock.
call trace:
A thread: rptun thread:
lock upper_lock
lock upper_lock
rpmsg send -> wait upper_lock
unlock upper_lock
wait response <--\-- don't reponse this rpmsg request
unlock upper_lock
Signed-off-by: likun17 <likun17@xiaomi.com>
This commit is contained in:
@@ -1017,13 +1017,10 @@ static int sensor_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
|
|
||||||
case SNIOC_FLUSH:
|
case SNIOC_FLUSH:
|
||||||
{
|
{
|
||||||
nxrmutex_lock(&upper->lock);
|
|
||||||
|
|
||||||
/* If the sensor is not activated, return -EINVAL. */
|
/* If the sensor is not activated, return -EINVAL. */
|
||||||
|
|
||||||
if (upper->state.nsubscribers == 0)
|
if (upper->state.nsubscribers == 0)
|
||||||
{
|
{
|
||||||
nxrmutex_unlock(&upper->lock);
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1061,8 +1058,6 @@ static int sensor_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nxrmutex_unlock(&upper->lock);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user