Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a78fcc11 authored by Guennadi Liakhovetski's avatar Guennadi Liakhovetski Committed by Mauro Carvalho Chehab
Browse files

[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: default avatarGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Acked-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 0ff6a6e8
Loading
Loading
Loading
Loading
+13 −14
Original line number Diff line number Diff line
@@ -512,22 +512,21 @@ static int soc_camera_add_device(struct soc_camera_device *icd)
	if (ici->icd)
		return -EBUSY;

	if (ici->ops->clock_start) {
	ret = ici->ops->clock_start(ici);
	if (ret < 0)
		return ret;
	}

	if (ici->ops->add) {
		ret = ici->ops->add(icd);
		if (ret < 0)
			goto eadd;
	}

	ici->icd = icd;

	return 0;

eadd:
	if (ici->ops->clock_stop)
	ici->ops->clock_stop(ici);
	return ret;
}
@@ -539,8 +538,8 @@ static void soc_camera_remove_device(struct soc_camera_device *icd)
	if (WARN_ON(icd != ici->icd))
		return;

	if (ici->ops->remove)
		ici->ops->remove(icd);
	if (ici->ops->clock_stop)
	ici->ops->clock_stop(ici);
	ici->icd = NULL;
}
@@ -1383,8 +1382,8 @@ int soc_camera_host_register(struct soc_camera_host *ici)
	    ((!ici->ops->init_videobuf ||
	      !ici->ops->reqbufs) &&
	     !ici->ops->init_videobuf2) ||
	    !ici->ops->add ||
	    !ici->ops->remove ||
	    !ici->ops->clock_start ||
	    !ici->ops->clock_stop ||
	    !ici->ops->poll ||
	    !ici->v4l2_dev.dev)
		return -EINVAL;