Commit 9f317de4 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

[media] soc_camera: compliance fixes

- REQBUFS(0) will stop streaming, free buffers and release the file ownership.
- Return ENOTTY for create_bufs for a vb1 driver
- Return EBUSY if there is a different streaming owner and set the new owner on
  success.
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Acked-by: default avatarGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent eb01b1bc
...@@ -384,9 +384,8 @@ static int soc_camera_reqbufs(struct file *file, void *priv, ...@@ -384,9 +384,8 @@ static int soc_camera_reqbufs(struct file *file, void *priv,
ret = vb2_reqbufs(&icd->vb2_vidq, p); ret = vb2_reqbufs(&icd->vb2_vidq, p);
} }
if (!ret && !icd->streamer) if (!ret)
icd->streamer = file; icd->streamer = p->count ? file : NULL;
return ret; return ret;
} }
...@@ -443,12 +442,19 @@ static int soc_camera_create_bufs(struct file *file, void *priv, ...@@ -443,12 +442,19 @@ static int soc_camera_create_bufs(struct file *file, void *priv,
{ {
struct soc_camera_device *icd = file->private_data; struct soc_camera_device *icd = file->private_data;
struct soc_camera_host *ici = to_soc_camera_host(icd->parent); struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
int ret;
/* videobuf2 only */ /* videobuf2 only */
if (ici->ops->init_videobuf) if (ici->ops->init_videobuf)
return -EINVAL; return -ENOTTY;
else
return vb2_create_bufs(&icd->vb2_vidq, create); if (icd->streamer && icd->streamer != file)
return -EBUSY;
ret = vb2_create_bufs(&icd->vb2_vidq, create);
if (!ret)
icd->streamer = file;
return ret;
} }
static int soc_camera_prepare_buf(struct file *file, void *priv, static int soc_camera_prepare_buf(struct file *file, void *priv,
......
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