1 From af066bde5a442efd50868ffed1aad30190400c91 Mon Sep 17 00:00:00 2001
2 From: Naushir Patuck <naush@raspberrypi.com>
3 Date: Tue, 19 May 2020 15:57:08 +0100
4 Subject: [PATCH] staging: vc04_services: isp: Reorder operations
7 Register the video node at the end of the probe, swapping order with
8 registering the controls.
10 Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
12 .../bcm2835-isp/bcm2835-v4l2-isp.c | 48 ++++++++++++-------
13 1 file changed, 32 insertions(+), 16 deletions(-)
15 --- a/drivers/staging/vc04_services/bcm2835-isp/bcm2835-v4l2-isp.c
16 +++ b/drivers/staging/vc04_services/bcm2835-isp/bcm2835-v4l2-isp.c
17 @@ -1295,21 +1295,6 @@ static int register_node(struct bcm2835_
19 node->queue_init = true;
21 - /* Define the device names */
22 - snprintf(vfd->name, sizeof(node->vfd.name), "%s-%s%d", BCM2835_ISP_NAME,
23 - node->name, node->id);
25 - ret = video_register_device(vfd, VFL_TYPE_GRABBER, video_nr + index);
27 - v4l2_err(&dev->v4l2_dev,
28 - "Failed to register video %s[%d] device node\n",
29 - node->name, node->id);
33 - node->registered = true;
34 - video_set_drvdata(vfd, node);
36 /* Set some controls and defaults, but only on the VIDEO_OUTPUT node. */
37 if (node_is_output(node)) {
39 @@ -1324,7 +1309,12 @@ static int register_node(struct bcm2835_
43 - v4l2_ctrl_handler_init(&dev->ctrl_handler, 4);
44 + ret = v4l2_ctrl_handler_init(&dev->ctrl_handler, 12);
46 + v4l2_err(&dev->v4l2_dev, "ctrl_handler init failed (%d)\n",
53 @@ -1350,13 +1340,39 @@ static int register_node(struct bcm2835_
56 node->vfd.ctrl_handler = &dev->ctrl_handler;
57 + if (dev->ctrl_handler.error) {
58 + ret = dev->ctrl_handler.error;
59 + v4l2_err(&dev->v4l2_dev, "controls init failed (%d)\n",
61 + v4l2_ctrl_handler_free(&dev->ctrl_handler);
66 + /* Define the device names */
67 + snprintf(vfd->name, sizeof(node->vfd.name), "%s-%s%d", BCM2835_ISP_NAME,
68 + node->name, node->id);
70 + ret = video_register_device(vfd, VFL_TYPE_GRABBER, video_nr + index);
72 + v4l2_err(&dev->v4l2_dev,
73 + "Failed to register video %s[%d] device node\n",
74 + node->name, node->id);
78 + node->registered = true;
79 + video_set_drvdata(vfd, node);
81 v4l2_info(&dev->v4l2_dev,
82 "Device node %s[%d] registered as /dev/video%d\n",
83 node->name, node->id, vfd->num);
88 + v4l2_ctrl_handler_free(&dev->ctrl_handler);
92 /* Unregister one of the /dev/video<N> nodes associated with the ISP. */