Skip to contentSkip to conversation

Staging: vc04_services: bcm2835-camera: Fix code style checks

PATCH Superseded Moritz C. Weber 2 participants 16 messages Feb 17, 2024 – Feb 19, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v2 cover Staging: vc04_services: bcm2835-camera: Fix code style checks

Resubmit these patches to fix multiple code style checks for better readability, consistency, and to address errors indicated by Gregs patch bot

Moritz C. Weber (8):
Staging: vc04_services: bcm2835-camera: fix brace code style check
Staging: vc04_services: bcm2835-camera: fix brace code style check
Staging: vc04_services: bcm2835-camera: fix brace code style check
Staging: vc04_services: bcm2835-camera: fix brace code style check
Staging: vc04_services: bcm2835-camera: fix brace code style check
Staging: vc04_services: bcm2835-camera: fix blank line style check
Staging: vc04_services: bcm2835-camera: fix brace code style check
Staging: vc04_services: bcm2835-camera: fix brace code style check

 .../bcm2835-camera/bcm2835-camera.c           | 61 +++++++++----------
 1 file changed, 28 insertions(+), 33 deletions(-)
Signature · 1 line
2.30.2
#1 lore raw

PATCH v2 1/8 Staging: vc04_services: bcm2835-camera: fix brace code style check

Reformat function parameters to fix checkpatch check:
Increase readability and consistency

---
 .../vc04_services/bcm2835-camera/bcm2835-camera.c     | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c +5 -6
index e6e89784d..05e5e4ab1 100644
@@ -350,12 +350,11 @@ static void buffer_cb(struct vchiq_mmal_instance *instance,
 			if (is_capturing(dev)) {
 				v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev,
 					 "Grab another frame");
-				vchiq_mmal_port_parameter_set(
-					instance,
-					dev->capture.camera_port,
-					MMAL_PARAMETER_CAPTURE,
-					&dev->capture.frame_count,
-					sizeof(dev->capture.frame_count));
+				vchiq_mmal_port_parameter_set(instance,
+							      dev->capture.camera_port,
+							      MMAL_PARAMETER_CAPTURE,
+							      &dev->capture.frame_count,
+							      sizeof(dev->capture.frame_count));
 			}
 			if (vchiq_mmal_submit_buffer(instance, port,
 						     &buf->mmal))
Signature · 1 line
2.30.2
#2 lore raw

PATCH v2 2/8 Staging: vc04_services: bcm2835-camera: fix brace code style check

In reply to Moritz C. Weber

Reformat function parameters to fix checkpatch check:
Increase readability and consistency

---
 .../vc04_services/bcm2835-camera/bcm2835-camera.c     | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c +5 -6
index 05e5e4ab1..1fa868163 100644
@@ -405,12 +405,11 @@ static void buffer_cb(struct vchiq_mmal_instance *instance,
 	    is_capturing(dev)) {
 		v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev,
 			 "Grab another frame as buffer has EOS");
-		vchiq_mmal_port_parameter_set(
-			instance,
-			dev->capture.camera_port,
-			MMAL_PARAMETER_CAPTURE,
-			&dev->capture.frame_count,
-			sizeof(dev->capture.frame_count));
+		vchiq_mmal_port_parameter_set(instance,
+					      dev->capture.camera_port,
+					      MMAL_PARAMETER_CAPTURE,
+					      &dev->capture.frame_count,
+					      sizeof(dev->capture.frame_count));
 	}
 }
 
Signature · 1 line
2.30.2
#3 lore raw

PATCH v2 3/8 Staging: vc04_services: bcm2835-camera: fix brace code style check

In reply to Moritz C. Weber

Reformat function parameters to fix checkpatch check:
Increase readability and consistency

---
 .../vc04_services/bcm2835-camera/bcm2835-camera.c        | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c +4 -5
index 1fa868163..dfa9e7670 100644
@@ -418,11 +418,10 @@ static int enable_camera(struct bcm2835_mmal_dev *dev)
 	int ret;
 
 	if (!dev->camera_use_count) {
-		ret = vchiq_mmal_port_parameter_set(
-			dev->instance,
-			&dev->component[COMP_CAMERA]->control,
-			MMAL_PARAMETER_CAMERA_NUM, &dev->camera_num,
-			sizeof(dev->camera_num));
+		ret = vchiq_mmal_port_parameter_set(dev->instance,
+						    &dev->component[COMP_CAMERA]->control,
+						    MMAL_PARAMETER_CAMERA_NUM, &dev->camera_num,
+						    sizeof(dev->camera_num));
 		if (ret < 0) {
 			v4l2_err(&dev->v4l2_dev,
 				 "Failed setting camera num, ret %d\n", ret);
Signature · 1 line
2.30.2
#4 lore raw

PATCH v2 4/8 Staging: vc04_services: bcm2835-camera: fix brace code style check

In reply to Moritz C. Weber

Reformat function parameters to fix checkpatch check:
Increase readability and consistency

---
 .../vc04_services/bcm2835-camera/bcm2835-camera.c      | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c +5 -5
index dfa9e7670..e2d058732 100644
@@ -465,11 +465,11 @@ static int disable_camera(struct bcm2835_mmal_dev *dev)
 				 "Failed disabling camera, ret %d\n", ret);
 			return -EINVAL;
 		}
-		vchiq_mmal_port_parameter_set(
-			dev->instance,
-			&dev->component[COMP_CAMERA]->control,
-			MMAL_PARAMETER_CAMERA_NUM, &i,
-			sizeof(i));
+		vchiq_mmal_port_parameter_set(dev->instance,
+					      &dev->component[COMP_CAMERA]->control,
+					      MMAL_PARAMETER_CAMERA_NUM,
+					      &i,
+					      sizeof(i));
 	}
 	v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev,
 		 "Camera refcount now %d\n", dev->camera_use_count);
Signature · 1 line
2.30.2
#5 lore raw

PATCH v2 5/8 Staging: vc04_services: bcm2835-camera: fix brace code style check

In reply to Moritz C. Weber

Reformat function parameters to fix checkpatch check:
Increase readability and consistency

---
 .../staging/vc04_services/bcm2835-camera/bcm2835-camera.c    | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c +2 -3
index e2d058732..b9745bb80 100644
@@ -783,9 +783,8 @@ static int vidioc_overlay(struct file *file, void *f, unsigned int on)
 			ret = vchiq_mmal_port_connect_tunnel(dev->instance, src,
 							     NULL);
 		if (ret >= 0)
-			ret = vchiq_mmal_component_disable(
-					dev->instance,
-					dev->component[COMP_PREVIEW]);
+			ret = vchiq_mmal_component_disable(dev->instance,
+							   dev->component[COMP_PREVIEW]);
 
 		disable_camera(dev);
 		return ret;
Signature · 1 line
2.30.2
#6 lore raw

PATCH v2 6/8 Staging: vc04_services: bcm2835-camera: fix blank line style check

In reply to Moritz C. Weber

Remove blank line to fix checkpatch check:
Increase readability and consistency

---
 drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c | 1 -
 1 file changed, 1 deletion(-)
drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c +0 -1
index b9745bb80..a25a361c8 100644
@@ -1002,7 +1002,6 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
 	return 0;
 }
 
-
 static int mmal_setup_video_component(struct bcm2835_mmal_dev *dev,
 				      struct v4l2_format *f)
 {
Signature · 1 line
2.30.2
#7 lore raw

PATCH v2 7/8 Staging: vc04_services: bcm2835-camera: fix brace code style check

In reply to Moritz C. Weber

Reformat function parameters to fix checkpatch check:
Increase readability and consistency

---
 drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c +2 -2
index a25a361c8..9cd79850b 100644
@@ -1037,8 +1037,8 @@ static int mmal_setup_video_component(struct bcm2835_mmal_dev *dev,
 
 	if (overlay_enabled) {
 		ret = vchiq_mmal_port_connect_tunnel(dev->instance,
-				preview_port,
-				&dev->component[COMP_PREVIEW]->input[0]);
+						     preview_port,
+						     &dev->component[COMP_PREVIEW]->input[0]);
 		if (ret)
 			return ret;
 
Signature · 1 line
2.30.2
#8 lore raw

PATCH v2 8/8 Staging: vc04_services: bcm2835-camera: fix brace code style check

In reply to Moritz C. Weber

Reformat function parameters to fix checkpatch check:
Increase readability and consistency

---
 .../vc04_services/bcm2835-camera/bcm2835-camera.c      | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c +5 -5
index 9cd79850b..c3ba490e5 100644
@@ -1715,11 +1715,11 @@ static int mmal_init(struct bcm2835_mmal_dev *dev)
 	{
 		unsigned int enable = 1;
 
-		vchiq_mmal_port_parameter_set(
-			dev->instance,
-			&dev->component[COMP_VIDEO_ENCODE]->control,
-			MMAL_PARAMETER_VIDEO_IMMUTABLE_INPUT,
-			&enable, sizeof(enable));
+		vchiq_mmal_port_parameter_set(dev->instance,
+					      &dev->component[COMP_VIDEO_ENCODE]->control,
+					      MMAL_PARAMETER_VIDEO_IMMUTABLE_INPUT,
+					      &enable,
+					      sizeof(enable));
 
 		vchiq_mmal_port_parameter_set(dev->instance,
 					      &dev->component[COMP_VIDEO_ENCODE]->control,
Signature · 1 line
2.30.2
#9 lore raw
In reply to Moritz C. Weber
Quoted 11 lines · Moritz C. Weber

Resubmit these patches to fix multiple code style checks for better readability, consistency, and to address errors indicated by Gregs patch bot

Moritz C. Weber (8):
Staging: vc04_services: bcm2835-camera: fix brace code style check
Staging: vc04_services: bcm2835-camera: fix brace code style check
Staging: vc04_services: bcm2835-camera: fix brace code style check
Staging: vc04_services: bcm2835-camera: fix brace code style check
Staging: vc04_services: bcm2835-camera: fix brace code style check
Staging: vc04_services: bcm2835-camera: fix blank line style check
Staging: vc04_services: bcm2835-camera: fix brace code style check
Staging: vc04_services: bcm2835-camera: fix brace code style check

These are automatically rejected because you sent 8 patches with the same subject. But really they should just be one patch. In v1 Greg complained that you were changing a bunch of random stuff. It's not clear what was going on there because it was random text and there was no way it would compile.

Was it an AI generated patch or what one earth happened?

Anyway, that was the issue, not that you need to break up the patch line by line and send each line as a separate patch.

regards,
dan carpenter

#10 lore raw
Quoted 10 lines · Dan Carpenter
Quoted 9 lines · Moritz C. Weber

Resubmit these patches to fix multiple code style checks for better readability, consistency, and to address errors indicated by Gregs patch bot

Moritz C. Weber (8):
Staging: vc04_services: bcm2835-camera: fix brace code style check
Staging: vc04_services: bcm2835-camera: fix brace code style check
Staging: vc04_services: bcm2835-camera: fix brace code style check
Staging: vc04_services: bcm2835-camera: fix brace code style check
Staging: vc04_services: bcm2835-camera: fix brace code style check
Staging: vc04_services: bcm2835-camera: fix blank line style check

This blank line patch would be still separate of course.

Quoted 2 lines
Quoted 2 lines

Staging: vc04_services: bcm2835-camera: fix brace code style check
Staging: vc04_services: bcm2835-camera: fix brace code style check

regards,
dan carpenter

#11 lore raw

Ok.. thanks for the explanation. Did not want to ask back stupidly what the script was actually complaining about without providing a suggestion on what I understood what it was asking for. I will submit a version 3 patch for the braces and a separate blank line patch with both good cover letters.

Best regards,
Moritz

Quoted 21 lines · Dan Carpenter
Quoted 10 lines · Dan Carpenter
Quoted 9 lines · Moritz C. Weber

Resubmit these patches to fix multiple code style checks for better readability, consistency, and to address errors indicated by Gregs patch bot

Moritz C. Weber (8):
Staging: vc04_services: bcm2835-camera: fix brace code style check
Staging: vc04_services: bcm2835-camera: fix brace code style check
Staging: vc04_services: bcm2835-camera: fix brace code style check
Staging: vc04_services: bcm2835-camera: fix brace code style check
Staging: vc04_services: bcm2835-camera: fix brace code style check
Staging: vc04_services: bcm2835-camera: fix blank line style check

This blank line patch would be still separate of course.

Quoted 2 lines
Quoted 2 lines

Staging: vc04_services: bcm2835-camera: fix brace code style check
Staging: vc04_services: bcm2835-camera: fix brace code style check

regards,
dan carpenter

#12 lore raw

v3 cover Staging: vc04_services: bcm2835-camera: Fix code style checks

In reply to Dan Carpenter

Resubmit these patches to address comments to rebase the 8 v2 changes into 2 patches topicwise
Fix patches with same subject issue based on v2, which fixes multiple code style checks for better readability, consistency, and fixes typos from v1

Moritz C. Weber (2):
Staging: vc04_services: bcm2835-camera: fix blank line style check
Staging: vc04_services: bcm2835-camera: fix brace code style check

 .../bcm2835-camera/bcm2835-camera.c           | 61 +++++++++----------
 1 file changed, 28 insertions(+), 33 deletions(-)
Signature · 1 line
2.30.2
#13 lore raw

PATCH v3 1/2 Staging: vc04_services: bcm2835-camera: fix blank line style check

Remove blank line to fix checkpatch check:
Increase readability and consistency

---
 drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c | 1 -
 1 file changed, 1 deletion(-)
drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c +0 -1
index e6e89784d..e6ff5ea04 100644
@@ -1006,7 +1006,6 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
 	return 0;
 }
 
-
 static int mmal_setup_video_component(struct bcm2835_mmal_dev *dev,
 				      struct v4l2_format *f)
 {
Signature · 1 line
2.30.2
#14 lore raw

PATCH v3 2/2 Staging: vc04_services: bcm2835-camera: fix brace code style check

In reply to Moritz C. Weber

Reformat function parameters to fix checkpatch check:
Increase readability and consistency

---
 .../bcm2835-camera/bcm2835-camera.c           | 60 +++++++++----------
 1 file changed, 28 insertions(+), 32 deletions(-)
drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c +28 -32
index e6ff5ea04..c3ba490e5 100644
@@ -350,12 +350,11 @@ static void buffer_cb(struct vchiq_mmal_instance *instance,
 			if (is_capturing(dev)) {
 				v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev,
 					 "Grab another frame");
-				vchiq_mmal_port_parameter_set(
-					instance,
-					dev->capture.camera_port,
-					MMAL_PARAMETER_CAPTURE,
-					&dev->capture.frame_count,
-					sizeof(dev->capture.frame_count));
+				vchiq_mmal_port_parameter_set(instance,
+							      dev->capture.camera_port,
+							      MMAL_PARAMETER_CAPTURE,
+							      &dev->capture.frame_count,
+							      sizeof(dev->capture.frame_count));
 			}
 			if (vchiq_mmal_submit_buffer(instance, port,
 						     &buf->mmal))
@@ -406,12 +405,11 @@ static void buffer_cb(struct vchiq_mmal_instance *instance,
 	    is_capturing(dev)) {
 		v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev,
 			 "Grab another frame as buffer has EOS");
-		vchiq_mmal_port_parameter_set(
-			instance,
-			dev->capture.camera_port,
-			MMAL_PARAMETER_CAPTURE,
-			&dev->capture.frame_count,
-			sizeof(dev->capture.frame_count));
+		vchiq_mmal_port_parameter_set(instance,
+					      dev->capture.camera_port,
+					      MMAL_PARAMETER_CAPTURE,
+					      &dev->capture.frame_count,
+					      sizeof(dev->capture.frame_count));
 	}
 }
 
@@ -420,11 +418,10 @@ static int enable_camera(struct bcm2835_mmal_dev *dev)
 	int ret;
 
 	if (!dev->camera_use_count) {
-		ret = vchiq_mmal_port_parameter_set(
-			dev->instance,
-			&dev->component[COMP_CAMERA]->control,
-			MMAL_PARAMETER_CAMERA_NUM, &dev->camera_num,
-			sizeof(dev->camera_num));
+		ret = vchiq_mmal_port_parameter_set(dev->instance,
+						    &dev->component[COMP_CAMERA]->control,
+						    MMAL_PARAMETER_CAMERA_NUM, &dev->camera_num,
+						    sizeof(dev->camera_num));
 		if (ret < 0) {
 			v4l2_err(&dev->v4l2_dev,
 				 "Failed setting camera num, ret %d\n", ret);
@@ -468,11 +465,11 @@ static int disable_camera(struct bcm2835_mmal_dev *dev)
 				 "Failed disabling camera, ret %d\n", ret);
 			return -EINVAL;
 		}
-		vchiq_mmal_port_parameter_set(
-			dev->instance,
-			&dev->component[COMP_CAMERA]->control,
-			MMAL_PARAMETER_CAMERA_NUM, &i,
-			sizeof(i));
+		vchiq_mmal_port_parameter_set(dev->instance,
+					      &dev->component[COMP_CAMERA]->control,
+					      MMAL_PARAMETER_CAMERA_NUM,
+					      &i,
+					      sizeof(i));
 	}
 	v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev,
 		 "Camera refcount now %d\n", dev->camera_use_count);
@@ -786,9 +783,8 @@ static int vidioc_overlay(struct file *file, void *f, unsigned int on)
 			ret = vchiq_mmal_port_connect_tunnel(dev->instance, src,
 							     NULL);
 		if (ret >= 0)
-			ret = vchiq_mmal_component_disable(
-					dev->instance,
-					dev->component[COMP_PREVIEW]);
+			ret = vchiq_mmal_component_disable(dev->instance,
+							   dev->component[COMP_PREVIEW]);
 
 		disable_camera(dev);
 		return ret;
@@ -1041,8 +1037,8 @@ static int mmal_setup_video_component(struct bcm2835_mmal_dev *dev,
 
 	if (overlay_enabled) {
 		ret = vchiq_mmal_port_connect_tunnel(dev->instance,
-				preview_port,
-				&dev->component[COMP_PREVIEW]->input[0]);
+						     preview_port,
+						     &dev->component[COMP_PREVIEW]->input[0]);
 		if (ret)
 			return ret;
 
@@ -1719,11 +1715,11 @@ static int mmal_init(struct bcm2835_mmal_dev *dev)
 	{
 		unsigned int enable = 1;
 
-		vchiq_mmal_port_parameter_set(
-			dev->instance,
-			&dev->component[COMP_VIDEO_ENCODE]->control,
-			MMAL_PARAMETER_VIDEO_IMMUTABLE_INPUT,
-			&enable, sizeof(enable));
+		vchiq_mmal_port_parameter_set(dev->instance,
+					      &dev->component[COMP_VIDEO_ENCODE]->control,
+					      MMAL_PARAMETER_VIDEO_IMMUTABLE_INPUT,
+					      &enable,
+					      sizeof(enable));
 
 		vchiq_mmal_port_parameter_set(dev->instance,
 					      &dev->component[COMP_VIDEO_ENCODE]->control,
Signature · 1 line
2.30.2
Reviewed-by on the v3 series
#15 lore raw
In reply to Moritz C. Weber
Quoted 9 lines · Moritz C. Weber

Resubmit these patches to address comments to rebase the 8 v2 changes into 2 patches topicwise
Fix patches with same subject issue based on v2, which fixes multiple code style checks for better readability, consistency, and fixes typos from v1

Moritz C. Weber (2):
Staging: vc04_services: bcm2835-camera: fix blank line style check
Staging: vc04_services: bcm2835-camera: fix brace code style check

Looks okay now.

regards,
dan carpenter