Re: [PATCH 4/4] media: usb: cpia2: Fixed coding style issues
From: Hans Verkuil
Date: Wed May 26 2021 - 09:15:49 EST
On 30/04/2021 17:43, Piyush Thange wrote:
> Addition of more fixes on coding style.
>
> Signed-off-by: Piyush Thange <pthange19@xxxxxxxxx>
> ---
> drivers/media/usb/cpia2/cpia2_v4l.c | 18 +++++++++---------
> 1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/media/usb/cpia2/cpia2_v4l.c b/drivers/media/usb/cpia2/cpia2_v4l.c
> index 261ced144793..d950f9171208 100644
> --- a/drivers/media/usb/cpia2/cpia2_v4l.c
> +++ b/drivers/media/usb/cpia2/cpia2_v4l.c
> @@ -883,12 +883,12 @@ static int cpia2_dqbuf(struct file *file, void *fh, struct v4l2_buffer *buf)
>
> frame = find_earliest_filled_buffer(cam);
>
> - if(frame < 0 && file->f_flags&O_NONBLOCK)
> + if (frame < 0 && file->f_flags&O_NONBLOCK)
Add spaces around & as well.
There is no need to split this up into four patches. Just post a single patch
for all these changes.
> return -EAGAIN;
>
> - if(frame < 0) {
> + if (frame < 0) {
> /* Wait for a frame to become available */
> - struct framebuf *cb=cam->curbuff;
> + struct framebuf *cb = cam->curbuff;
> mutex_unlock(&cam->v4l2_lock);
> wait_event_interruptible(cam->wq_stream,
> !video_is_registered(&cam->vdev) ||
> @@ -970,7 +970,7 @@ static int cpia2_mmap(struct file *file, struct vm_area_struct *area)
> return -ERESTARTSYS;
> retval = cpia2_remap_buffer(cam, area);
>
> - if(!retval)
> + if (!retval)
> cam->stream_fh = file->private_data;
> mutex_unlock(&cam->v4l2_lock);
> return retval;
> @@ -1160,10 +1160,10 @@ void cpia2_unregister_camera(struct camera_data *cam)
> *****************************************************************************/
> static void __init check_parameters(void)
> {
> - if(buffer_size < PAGE_SIZE) {
> + if (buffer_size < PAGE_SIZE) {
> buffer_size = PAGE_SIZE;
> LOG("buffer_size too small, setting to %d\n", buffer_size);
> - } else if(buffer_size > 1024*1024) {
> + } else if (buffer_size > 1024*1024) {
Add spaces around * as well. checkpatch.pl --strict warns about that!
Regards,
Hans
> /* arbitrary upper limiit */
> buffer_size = 1024*1024;
> LOG("buffer_size ridiculously large, setting to %d\n",
> @@ -1173,15 +1173,15 @@ static void __init check_parameters(void)
> buffer_size &= ~(PAGE_SIZE-1);
> }
>
> - if(num_buffers < 1) {
> + if (num_buffers < 1) {
> num_buffers = 1;
> LOG("num_buffers too small, setting to %d\n", num_buffers);
> - } else if(num_buffers > VIDEO_MAX_FRAME) {
> + } else if (num_buffers > VIDEO_MAX_FRAME) {
> num_buffers = VIDEO_MAX_FRAME;
> LOG("num_buffers too large, setting to %d\n", num_buffers);
> }
>
> - if(alternate < USBIF_ISO_1 || alternate > USBIF_ISO_6) {
> + if (alternate < USBIF_ISO_1 || alternate > USBIF_ISO_6) {
> alternate = DEFAULT_ALT;
> LOG("alternate specified is invalid, using %d\n", alternate);
> }
>