Commit f9a6e565 authored by Paul Kocialkowski's avatar Paul Kocialkowski Committed by Mauro Carvalho Chehab
Browse files

media: sun6i-csi: Register the media device after creation



There is no particular need to register the media device in the
subdev notify complete callback.

Register it in the v4l2 code instead where it's more in-context.

Signed-off-by: default avatarPaul Kocialkowski <paul.kocialkowski@bootlin.com>
Acked-by: default avatarJernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent 92cc5158
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -638,7 +638,7 @@ static int sun6i_subdev_notify_complete(struct v4l2_async_notifier *notifier)
	if (ret < 0)
		return ret;

	return media_device_register(&v4l2->media_dev);
	return 0;
}

static const struct v4l2_async_notifier_operations sun6i_csi_async_ops = {
@@ -685,6 +685,12 @@ static int sun6i_csi_v4l2_setup(struct sun6i_csi_device *csi_dev)

	media_device_init(media_dev);

	ret = media_device_register(media_dev);
	if (ret) {
		dev_err(dev, "failed to register media device: %d\n", ret);
		goto error_media;
	}

	/* V4L2 Control Handler */

	ret = v4l2_ctrl_handler_init(&v4l2->ctrl_handler, 0);
@@ -744,6 +750,7 @@ static int sun6i_csi_v4l2_setup(struct sun6i_csi_device *csi_dev)
	v4l2_ctrl_handler_free(&v4l2->ctrl_handler);

error_media:
	media_device_unregister(media_dev);
	media_device_cleanup(media_dev);

	return ret;