Commit a60f0c8b authored by Stefan Wahren's avatar Stefan Wahren Committed by Greg Kroah-Hartman
Browse files

staging: bcm2835-camera: reduce multiline statements

parent f23e128a
Loading
Loading
Loading
Loading
+22 −35
Original line number Diff line number Diff line
@@ -369,8 +369,7 @@ static void buffer_cb(struct vchiq_mmal_instance *instance,

	if (dev->capture.vc_start_timestamp != -1 && pts) {
		ktime_t timestamp;
		s64 runtime_us = pts -
		    dev->capture.vc_start_timestamp;
		s64 runtime_us = pts - dev->capture.vc_start_timestamp;
		timestamp = ktime_add_us(dev->capture.kernel_start_ts,
					 runtime_us);
		v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev,
@@ -420,8 +419,7 @@ static int enable_camera(struct bm2835_mmal_dev *dev)
			return -EINVAL;
		}

		ret = vchiq_mmal_component_enable(
				dev->instance,
		ret = vchiq_mmal_component_enable(dev->instance,
						  dev->component[COMP_CAMERA]);
		if (ret < 0) {
			v4l2_err(&dev->v4l2_dev,
@@ -451,9 +449,7 @@ static int disable_camera(struct bm2835_mmal_dev *dev)

		v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev,
			 "Disabling camera\n");
		ret =
		    vchiq_mmal_component_disable(
				dev->instance,
		ret = vchiq_mmal_component_disable(dev->instance,
						   dev->component[COMP_CAMERA]);
		if (ret < 0) {
			v4l2_err(&dev->v4l2_dev,
@@ -555,8 +551,8 @@ static int start_streaming(struct vb2_queue *vq, unsigned int count)

	/* enable the camera port */
	dev->capture.port->cb_ctx = dev;
	ret =
	    vchiq_mmal_port_enable(dev->instance, dev->capture.port, buffer_cb);
	ret = vchiq_mmal_port_enable(dev->instance, dev->capture.port,
				     buffer_cb);
	if (ret) {
		v4l2_err(&dev->v4l2_dev,
			 "Failed to enable capture port - error %d. Disabling camera port again\n",
@@ -767,15 +763,13 @@ static int vidioc_overlay(struct file *file, void *f, unsigned int on)
	    (!on && !dev->component[COMP_PREVIEW]->enabled))
		return 0;	/* already in requested state */

	src =
	    &dev->component[COMP_CAMERA]->output[CAM_PORT_PREVIEW];
	src = &dev->component[COMP_CAMERA]->output[CAM_PORT_PREVIEW];

	if (!on) {
		/* disconnect preview ports and disable component */
		ret = vchiq_mmal_port_disable(dev->instance, src);
		if (!ret)
			ret =
			    vchiq_mmal_port_connect_tunnel(dev->instance, src,
			ret = vchiq_mmal_port_connect_tunnel(dev->instance, src,
							     NULL);
		if (ret >= 0)
			ret = vchiq_mmal_component_disable(
@@ -800,8 +794,7 @@ static int vidioc_overlay(struct file *file, void *f, unsigned int on)
	if (enable_camera(dev) < 0)
		return -EINVAL;

	ret = vchiq_mmal_component_enable(
			dev->instance,
	ret = vchiq_mmal_component_enable(dev->instance,
					  dev->component[COMP_PREVIEW]);
	if (ret < 0)
		return ret;
@@ -1210,8 +1203,7 @@ static int mmal_setup_components(struct bm2835_mmal_dev *dev,
	}

	remove_padding = mfmt->remove_padding;
	vchiq_mmal_port_parameter_set(dev->instance,
				      camera_port,
	vchiq_mmal_port_parameter_set(dev->instance, camera_port,
				      MMAL_PARAMETER_NO_IMAGE_PADDING,
				      &remove_padding, sizeof(remove_padding));

@@ -1665,8 +1657,7 @@ static int mmal_init(struct bm2835_mmal_dev *dev)
	dev->capture.enc_level = V4L2_MPEG_VIDEO_H264_LEVEL_4_0;

	/* get the preview component ready */
	ret = vchiq_mmal_component_init(
			dev->instance, "ril.video_render",
	ret = vchiq_mmal_component_init(dev->instance, "ril.video_render",
					&dev->component[COMP_PREVIEW]);
	if (ret < 0)
		goto unreg_camera;
@@ -1679,8 +1670,7 @@ static int mmal_init(struct bm2835_mmal_dev *dev)
	}

	/* get the image encoder component ready */
	ret = vchiq_mmal_component_init(
		dev->instance, "ril.image_encode",
	ret = vchiq_mmal_component_init(dev->instance, "ril.image_encode",
					&dev->component[COMP_IMAGE_ENCODE]);
	if (ret < 0)
		goto unreg_preview;
@@ -1741,14 +1731,12 @@ static int mmal_init(struct bm2835_mmal_dev *dev)

unreg_vid_encoder:
	pr_err("Cleanup: Destroy video encoder\n");
	vchiq_mmal_component_finalise(
		dev->instance,
	vchiq_mmal_component_finalise(dev->instance,
				      dev->component[COMP_VIDEO_ENCODE]);

unreg_image_encoder:
	pr_err("Cleanup: Destroy image encoder\n");
	vchiq_mmal_component_finalise(
		dev->instance,
	vchiq_mmal_component_finalise(dev->instance,
				      dev->component[COMP_IMAGE_ENCODE]);

unreg_preview:
@@ -1782,8 +1770,7 @@ static int bm2835_mmal_init_device(struct bm2835_mmal_dev *dev,
	/* video device needs to be able to access instance data */
	video_set_drvdata(vfd, dev);

	ret = video_register_device(vfd,
				    VFL_TYPE_VIDEO,
	ret = video_register_device(vfd, VFL_TYPE_VIDEO,
				    video_nr[dev->camera_num]);
	if (ret < 0)
		return ret;
+1 −2
Original line number Diff line number Diff line
@@ -839,8 +839,7 @@ static int ctrl_set_scene_mode(struct bm2835_mmal_dev *dev,
		enum mmal_parameter_exposuremeteringmode metering_mode;

		for (i = 0; i < ARRAY_SIZE(scene_configs); i++) {
			if (scene_configs[i].v4l2_scene ==
				ctrl->val) {
			if (scene_configs[i].v4l2_scene == ctrl->val) {
				scene = &scene_configs[i];
				break;
			}