提交 a78fcc11 编写于 作者: G Guennadi Liakhovetski 提交者: Mauro Carvalho Chehab

[media] soc-camera: make .clock_{start,stop} compulsory, .add / .remove optional

All existing soc-camera host drivers use .clock_start() and .clock_stop()
callbacks to activate and deactivate their camera interfaces, whereas
.add() and .remove() callbacks are usually dummy. Make the former two
compulsory and the latter two optional.
Signed-off-by: NGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: NHans Verkuil <hans.verkuil@cisco.com>
Acked-by: NLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 0ff6a6e8
...@@ -512,23 +512,22 @@ static int soc_camera_add_device(struct soc_camera_device *icd) ...@@ -512,23 +512,22 @@ static int soc_camera_add_device(struct soc_camera_device *icd)
if (ici->icd) if (ici->icd)
return -EBUSY; return -EBUSY;
if (ici->ops->clock_start) { ret = ici->ops->clock_start(ici);
ret = ici->ops->clock_start(ici); if (ret < 0)
return ret;
if (ici->ops->add) {
ret = ici->ops->add(icd);
if (ret < 0) if (ret < 0)
return ret; goto eadd;
} }
ret = ici->ops->add(icd);
if (ret < 0)
goto eadd;
ici->icd = icd; ici->icd = icd;
return 0; return 0;
eadd: eadd:
if (ici->ops->clock_stop) ici->ops->clock_stop(ici);
ici->ops->clock_stop(ici);
return ret; return ret;
} }
...@@ -539,9 +538,9 @@ static void soc_camera_remove_device(struct soc_camera_device *icd) ...@@ -539,9 +538,9 @@ static void soc_camera_remove_device(struct soc_camera_device *icd)
if (WARN_ON(icd != ici->icd)) if (WARN_ON(icd != ici->icd))
return; return;
ici->ops->remove(icd); if (ici->ops->remove)
if (ici->ops->clock_stop) ici->ops->remove(icd);
ici->ops->clock_stop(ici); ici->ops->clock_stop(ici);
ici->icd = NULL; ici->icd = NULL;
} }
...@@ -1383,8 +1382,8 @@ int soc_camera_host_register(struct soc_camera_host *ici) ...@@ -1383,8 +1382,8 @@ int soc_camera_host_register(struct soc_camera_host *ici)
((!ici->ops->init_videobuf || ((!ici->ops->init_videobuf ||
!ici->ops->reqbufs) && !ici->ops->reqbufs) &&
!ici->ops->init_videobuf2) || !ici->ops->init_videobuf2) ||
!ici->ops->add || !ici->ops->clock_start ||
!ici->ops->remove || !ici->ops->clock_stop ||
!ici->ops->poll || !ici->ops->poll ||
!ici->v4l2_dev.dev) !ici->v4l2_dev.dev)
return -EINVAL; return -EINVAL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册