sensor: directly return -ENOTSUP without the set_interval or batch
implementation for lowerhalf driver. Change-Id: I7b02e0331e5f8b89b39896049a9e24ce30116f8a Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
This commit is contained in:
parent
19cea67f3e
commit
7837a21e4e
@ -371,13 +371,18 @@ static int sensor_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
|
|
||||||
case SNIOC_SET_INTERVAL:
|
case SNIOC_SET_INTERVAL:
|
||||||
{
|
{
|
||||||
|
if (lower->ops->set_interval == NULL)
|
||||||
|
{
|
||||||
|
ret = -ENOTSUP;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (upper->interval == *val)
|
if (upper->interval == *val)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = lower->ops->set_interval ?
|
ret = lower->ops->set_interval(lower, val);
|
||||||
lower->ops->set_interval(lower, val) : -ENOTSUP;
|
|
||||||
if (ret >= 0)
|
if (ret >= 0)
|
||||||
{
|
{
|
||||||
upper->interval = *val;
|
upper->interval = *val;
|
||||||
@ -387,6 +392,12 @@ static int sensor_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
|
|
||||||
case SNIOC_BATCH:
|
case SNIOC_BATCH:
|
||||||
{
|
{
|
||||||
|
if (lower->ops->batch == NULL)
|
||||||
|
{
|
||||||
|
ret = -ENOTSUP;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (upper->interval == 0)
|
if (upper->interval == 0)
|
||||||
{
|
{
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
@ -398,8 +409,7 @@ static int sensor_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = lower->ops->batch ?
|
ret = lower->ops->batch(lower, val);
|
||||||
lower->ops->batch(lower, val) : -ENOTSUP;
|
|
||||||
if (ret >= 0)
|
if (ret >= 0)
|
||||||
{
|
{
|
||||||
upper->latency = *val;
|
upper->latency = *val;
|
||||||
|
Loading…
Reference in New Issue
Block a user