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:
likun17
2024-10-23 14:38:03 +08:00
committed by Xiang Xiao
parent 61f7582cc7
commit 6a8262314f
-5
View File
@@ -1017,13 +1017,10 @@ static int sensor_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
case SNIOC_FLUSH:
{
nxrmutex_lock(&upper->lock);
/* If the sensor is not activated, return -EINVAL. */
if (upper->state.nsubscribers == 0)
{
nxrmutex_unlock(&upper->lock);
return -EINVAL;
}
@@ -1061,8 +1058,6 @@ static int sensor_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
ret = 0;
}
}
nxrmutex_unlock(&upper->lock);
}
break;