staging: vc04_services: Fix small style issues
Subsystems (3)
v3 cover staging: vc04_services: Fix small style issues
Hi,
This is v3 of a patch series to fix some checkpatch.pl warnings in drivers/staging/vc04_services/bcm2835-camera/*
Changes from v2 [2]:
- Provide more detailed description in commit messages
Changes from v1 [1]:
- Split single patch into multiple patches
- Remove reference to eudyptula in commit message
[1]: https://lkml.kernel.org/r/30cc7b48def470f1bec8d8d255044f4f220531ee.1512368114.git.sky at genki.is [2]: https://lkml.kernel.org/r/cover.1512441073.git.sky at genki.is
[ aside: this is for task-10 of http://eudyptula-challenge.org/ ]
Genki Sky (3):
staging: vc04_services: Join multiline dereferences
staging: vc04_services: Unsplit user-visible strings
staging: vc04_services: Use __func__
.../vc04_services/bcm2835-camera/bcm2835-camera.c | 23 +++++++++------------- .../vc04_services/bcm2835-camera/mmal-vchiq.c | 7 +++---- 2 files changed, 12 insertions(+), 18 deletions(-)
--
2.15.1
PATCH v3 1/3 staging: vc04_services: Join multiline dereferences
This was found using checkpatch.pl's MULTILINE_DEREFERENCE warning. Putting the dereference onto one line makes them easier to read, especially when part of a larger expression (in this case, function arguments and ternary operator), and when the dereferences are short (as they are here).
--- .../vc04_services/bcm2835-camera/bcm2835-camera.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-)
drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c +6 -10
@@ -328,11 +328,9 @@ static void buffer_cb(struct vchiq_mmal_instance *instance,pr_debug ("Grab another frame" );vchiq_mmal_port_parameter_set ( instance, - dev->capture. - camera_port, + dev->capture.camera_port,MMAL_PARAMETER_CAPTURE , - &dev->capture. - frame_count, + &dev->capture.frame_count,sizeof (dev->capture.frame_count)); } }else {
@@ -368,11 +366,9 @@ static void buffer_cb(struct vchiq_mmal_instance *instance, "Grab another frame as buffer has EOS");vchiq_mmal_port_parameter_set ( instance, - dev->capture. - camera_port, + dev->capture.camera_port,MMAL_PARAMETER_CAPTURE , - &dev->capture. - frame_count, + &dev->capture.frame_count,sizeof (dev->capture.frame_count)); } }else {
@@ -1194,8 +1190,8 @@ static int mmal_setup_components(struct bm2835_mmal_dev *dev, port->current_buffer.size = (f->fmt.pix.sizeimage < (100 <<10 )) - ? (100 <<10 ) : f->fmt.pix. - sizeimage; + ? (100 <<10 ) + : f->fmt.pix.sizeimage; } v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev,
Signature · 1 line
2.15.1
PATCH v3 2/3 staging: vc04_services: Unsplit user-visible strings
In reply to Genki SkyThis was found using checkpatch.pl's SPLIT_STRING warning. While joining these strings makes for long lines, the kernel codebase consistently does it this way to make user-visible strings easier to grep for.
--- drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c | 7 +++---- drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c | 3 +-- 2 files changed, 4 insertions(+), 6 deletions(-)
drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c +3 -4
@@ -347,8 +347,7 @@ static void buffer_cb(struct vchiq_mmal_instance *instance, timestamp =ktime_add_us (dev->capture.kernel_start_ts, runtime_us);v4l2_dbg (1 , bcm2835_v4l2_debug, &dev->v4l2_dev, -"Convert start time %llu and %llu " -"with offset %llu to %llu\n" , +"Convert start time %llu and %llu with offset %llu to %llu\n" ,ktime_to_ns (dev->capture.kernel_start_ts), dev->capture.vc_start_timestamp, pts,ktime_to_ns (timestamp));
@@ -532,8 +531,8 @@ static int start_streaming(struct vb2_queue *vq, unsigned int count)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" , ret); +"Failed to enable capture port - error %d. Disabling camera port again\n" , + ret);vchiq_mmal_port_disable (dev->instance, dev->capture.camera_port);
drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c +1 -2
@@ -1360,8 +1360,7 @@ static int port_action_handle(struct vchiq_mmal_instance *instance, ret = -rmsg->u.port_action_reply.status; - pr_debug("%s:result:%d component:0x%x port:%d action:%s(%d)" \ - " connect component:0x%x connect port:%d\n", + pr_debug("%s:result:%d component:0x%x port:%d action:%s(%d) connect component:0x%x connect port:%d\n", __func__, ret, port->component->handle, port->handle, port_action_type_names[action_type],
Signature · 1 line
2.15.1
PATCH v3 3/3 staging: vc04_services: Use __func__
In reply to Genki SkyThis was found using checkpatch.pl's EMBEDDED_FUNCTION_NAME warning. It is easier to be consistent and always use __func__ instead of having to remember to update any hardcoded references to the original name.
--- drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c +2 -2
@@ -618,8 +618,8 @@ static void buffer_to_host_cb(struct vchiq_mmal_instance *instance,struct mmal_msg_context *msg_context;u32 handle; -pr_debug ("buffer_to_host_cb: instance:%p msg:%p msg_len:%d\n" , - instance, msg, msg_len); +pr_debug ("%s: instance:%p msg:%p msg_len:%d\n" , + __func__, instance, msg, msg_len);if (msg->u.buffer_from_host.drvbuf.magic ==MMAL_MAGIC ) { handle = msg->u.buffer_from_host.drvbuf.client_context;
Signature · 1 line
2.15.1