drivers/sensors/gnss: Fix deactivate failure when using both topic and device
Deactivate lower driver fails when both uORB topic and driver device are subscribed and opened. Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
This commit is contained in:
parent
c0f7dd979e
commit
3093b28860
1 changed files with 5 additions and 4 deletions
|
@ -171,11 +171,12 @@ static int gnss_activate(FAR struct sensor_lowerhalf_s *lower,
|
||||||
if ((upper->crefs == 0 && enable) || (upper->crefs == 1 && !enable))
|
if ((upper->crefs == 0 && enable) || (upper->crefs == 1 && !enable))
|
||||||
{
|
{
|
||||||
ret = upper->lower->ops->activate(upper->lower, filep, enable);
|
ret = upper->lower->ops->activate(upper->lower, filep, enable);
|
||||||
|
}
|
||||||
|
|
||||||
if (ret >= 0)
|
if (ret >= 0)
|
||||||
{
|
{
|
||||||
upper->crefs += enable ? 1 : -1;
|
upper->crefs += enable ? 1 : -1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
nxmutex_unlock(&upper->lock);
|
nxmutex_unlock(&upper->lock);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Reference in a new issue