driver/sensor: Fetch(with O_NONBLOCK) will directly return.
when sensor is disable. Change-Id: I02c02aa447ee0b0d681082b4209ecd36e10f2547 Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
This commit is contained in:
parent
54ea96da6b
commit
46ea549630
@ -273,6 +273,11 @@ static ssize_t sensor_read(FAR struct file *filep, FAR char *buffer,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (!upper->enabled)
|
||||||
|
{
|
||||||
|
ret = -EAGAIN;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
ret = lower->ops->fetch(lower, buffer, len);
|
ret = lower->ops->fetch(lower, buffer, len);
|
||||||
}
|
}
|
||||||
@ -289,7 +294,7 @@ static ssize_t sensor_read(FAR struct file *filep, FAR char *buffer,
|
|||||||
if (filep->f_oflags & O_NONBLOCK)
|
if (filep->f_oflags & O_NONBLOCK)
|
||||||
{
|
{
|
||||||
ret = -EAGAIN;
|
ret = -EAGAIN;
|
||||||
goto again;
|
goto out;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -324,7 +329,7 @@ static ssize_t sensor_read(FAR struct file *filep, FAR char *buffer,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
again:
|
out:
|
||||||
nxsem_post(&upper->exclsem);
|
nxsem_post(&upper->exclsem);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user