Commit de2e0456 authored by Marek Vasut's avatar Marek Vasut Committed by Mauro Carvalho Chehab

[media] media: imx: Drop warning upon multiple S_STREAM disable calls

Calling S_STREAM OFF multiple times on a video device is valid, although
dubious, practice. Instead of warning about it and setting stream count
lower than zero, just ignore the subsequent S_STREAM calls and correct
the stream count to zero.
Signed-off-by: default avatarMarek Vasut <marex@denx.de>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 21e54111
...@@ -391,7 +391,8 @@ static int prp_s_stream(struct v4l2_subdev *sd, int enable) ...@@ -391,7 +391,8 @@ static int prp_s_stream(struct v4l2_subdev *sd, int enable)
update_count: update_count:
priv->stream_count += enable ? 1 : -1; priv->stream_count += enable ? 1 : -1;
WARN_ON(priv->stream_count < 0); if (priv->stream_count < 0)
priv->stream_count = 0;
out: out:
mutex_unlock(&priv->lock); mutex_unlock(&priv->lock);
return ret; return ret;
......
...@@ -1140,7 +1140,8 @@ static int prp_s_stream(struct v4l2_subdev *sd, int enable) ...@@ -1140,7 +1140,8 @@ static int prp_s_stream(struct v4l2_subdev *sd, int enable)
update_count: update_count:
priv->stream_count += enable ? 1 : -1; priv->stream_count += enable ? 1 : -1;
WARN_ON(priv->stream_count < 0); if (priv->stream_count < 0)
priv->stream_count = 0;
out: out:
mutex_unlock(&priv->lock); mutex_unlock(&priv->lock);
return ret; return ret;
......
...@@ -864,7 +864,8 @@ static int csi_s_stream(struct v4l2_subdev *sd, int enable) ...@@ -864,7 +864,8 @@ static int csi_s_stream(struct v4l2_subdev *sd, int enable)
update_count: update_count:
priv->stream_count += enable ? 1 : -1; priv->stream_count += enable ? 1 : -1;
WARN_ON(priv->stream_count < 0); if (priv->stream_count < 0)
priv->stream_count = 0;
out: out:
mutex_unlock(&priv->lock); mutex_unlock(&priv->lock);
return ret; return ret;
......
...@@ -536,7 +536,8 @@ static int vdic_s_stream(struct v4l2_subdev *sd, int enable) ...@@ -536,7 +536,8 @@ static int vdic_s_stream(struct v4l2_subdev *sd, int enable)
update_count: update_count:
priv->stream_count += enable ? 1 : -1; priv->stream_count += enable ? 1 : -1;
WARN_ON(priv->stream_count < 0); if (priv->stream_count < 0)
priv->stream_count = 0;
out: out:
mutex_unlock(&priv->lock); mutex_unlock(&priv->lock);
return ret; return ret;
......
...@@ -397,7 +397,8 @@ static int csi2_s_stream(struct v4l2_subdev *sd, int enable) ...@@ -397,7 +397,8 @@ static int csi2_s_stream(struct v4l2_subdev *sd, int enable)
update_count: update_count:
csi2->stream_count += enable ? 1 : -1; csi2->stream_count += enable ? 1 : -1;
WARN_ON(csi2->stream_count < 0); if (csi2->stream_count < 0)
csi2->stream_count = 0;
out: out:
mutex_unlock(&csi2->lock); mutex_unlock(&csi2->lock);
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment