Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: renesas: vsp1: Initialize control handler after subdev

Some VSP modules initialize their control handler after initializing the
subdev, while some initialize it before. This makes the code
inconsistent and more error prone. Standardize on control initialization
after initializing the subdev.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi+renesas@ideasonboard.com>

+16 -16
+10 -10
drivers/media/platform/renesas/vsp1/vsp1_hgo.c
··· 192 192 if (hgo == NULL) 193 193 return ERR_PTR(-ENOMEM); 194 194 195 + /* Initialize the video device and queue for statistics data. */ 196 + ret = vsp1_histogram_init(vsp1, &hgo->histo, VSP1_ENTITY_HGO, "hgo", 197 + &hgo_entity_ops, hgo_mbus_formats, 198 + ARRAY_SIZE(hgo_mbus_formats), 199 + HGO_DATA_SIZE, V4L2_META_FMT_VSP1_HGO); 200 + if (ret < 0) { 201 + vsp1_entity_destroy(&hgo->histo.entity); 202 + return ERR_PTR(ret); 203 + } 204 + 195 205 /* Initialize the control handler. */ 196 206 v4l2_ctrl_handler_init(&hgo->ctrls.handler, 197 207 vsp1->info->gen >= 3 ? 2 : 1); ··· 216 206 hgo->num_bins = 64; 217 207 218 208 hgo->histo.entity.subdev.ctrl_handler = &hgo->ctrls.handler; 219 - 220 - /* Initialize the video device and queue for statistics data. */ 221 - ret = vsp1_histogram_init(vsp1, &hgo->histo, VSP1_ENTITY_HGO, "hgo", 222 - &hgo_entity_ops, hgo_mbus_formats, 223 - ARRAY_SIZE(hgo_mbus_formats), 224 - HGO_DATA_SIZE, V4L2_META_FMT_VSP1_HGO); 225 - if (ret < 0) { 226 - vsp1_entity_destroy(&hgo->histo.entity); 227 - return ERR_PTR(ret); 228 - } 229 209 230 210 return hgo; 231 211 }
+6 -6
drivers/media/platform/renesas/vsp1/vsp1_hgt.c
··· 191 191 if (hgt == NULL) 192 192 return ERR_PTR(-ENOMEM); 193 193 194 - /* Initialize the control handler. */ 195 - v4l2_ctrl_handler_init(&hgt->ctrls, 1); 196 - v4l2_ctrl_new_custom(&hgt->ctrls, &hgt_hue_areas, NULL); 197 - 198 - hgt->histo.entity.subdev.ctrl_handler = &hgt->ctrls; 199 - 200 194 /* Initialize the video device and queue for statistics data. */ 201 195 ret = vsp1_histogram_init(vsp1, &hgt->histo, VSP1_ENTITY_HGT, "hgt", 202 196 &hgt_entity_ops, hgt_mbus_formats, ··· 200 206 vsp1_entity_destroy(&hgt->histo.entity); 201 207 return ERR_PTR(ret); 202 208 } 209 + 210 + /* Initialize the control handler. */ 211 + v4l2_ctrl_handler_init(&hgt->ctrls, 1); 212 + v4l2_ctrl_new_custom(&hgt->ctrls, &hgt_hue_areas, NULL); 213 + 214 + hgt->histo.entity.subdev.ctrl_handler = &hgt->ctrls; 203 215 204 216 v4l2_ctrl_handler_setup(&hgt->ctrls); 205 217