Re: [media] usbvision-core: Delete unnecessary braces in 11 functions

2017-09-22 Thread SF Markus Elfring
> No.  Multi-line indents get curly braces for readability.

Which of the proposed change possibilities do you not like especially at the 
moment?

Regards,
Markus


Re: [PATCH 3/4] [media] usbvision-core: Delete unnecessary braces in 11 functions

2017-09-22 Thread Dan Carpenter
No.  Multi-line indents get curly braces for readability.

regards,
dan carpenter



[PATCH 3/4] [media] usbvision-core: Delete unnecessary braces in 11 functions

2017-09-21 Thread SF Markus Elfring
From: Markus Elfring 
Date: Thu, 21 Sep 2017 16:24:20 +0200

Do not use curly brackets at some source code places
where a single statement should be sufficient.

Signed-off-by: Markus Elfring 
---
 drivers/media/usb/usbvision/usbvision-core.c | 71 
 1 file changed, 31 insertions(+), 40 deletions(-)

diff --git a/drivers/media/usb/usbvision/usbvision-core.c 
b/drivers/media/usb/usbvision/usbvision-core.c
index bb6f4f69165f..54db35b03106 100644
--- a/drivers/media/usb/usbvision/usbvision-core.c
+++ b/drivers/media/usb/usbvision/usbvision-core.c
@@ -188,10 +188,9 @@ static int scratch_free(struct usb_usbvision *usbvision)
int free = usbvision->scratch_read_ptr - usbvision->scratch_write_ptr;
if (free <= 0)
free += scratch_buf_size;
-   if (free) {
+   if (free)
free -= 1;  
/* at least one byte in the buffer must */

/* left blank, otherwise there is no chance to differ between full and empty */
-   }
PDEBUG(DBG_SCRATCH, "return %d\n", free);
 
return free;
@@ -699,11 +698,12 @@ static enum parse_state usbvision_parse_compress(struct 
usb_usbvision *usbvision
 
frame = usbvision->cur_frame;
image_size = frame->frmwidth * frame->frmheight;
-   if ((frame->v4l2_format.format == V4L2_PIX_FMT_YUV422P) ||
-   (frame->v4l2_format.format == V4L2_PIX_FMT_YVU420)) {   /* this 
is a planar format */
+   if (frame->v4l2_format.format == V4L2_PIX_FMT_YUV422P ||
+   frame->v4l2_format.format == V4L2_PIX_FMT_YVU420)
+   /* this is a planar format */
/* ... v4l2_linesize not used here. */
f = frame->data + (frame->width * frame->curline);
-   } else
+   else
f = frame->data + (frame->v4l2_linesize * frame->curline);
 
if (frame->v4l2_format.format == V4L2_PIX_FMT_YUYV) { /* initialise u 
and v pointers */
@@ -734,22 +734,19 @@ static enum parse_state usbvision_parse_compress(struct 
usb_usbvision *usbvision
return parse_state_next_frame;
}
 
-   if (frame->curline != (int)strip_header[2]) {
+   if (frame->curline != (int)strip_header[2])
/* line number mismatch error */
usbvision->strip_line_number_errors++;
-   }
 
strip_len = 2 * (unsigned int)strip_header[1];
-   if (strip_len > USBVISION_STRIP_LEN_MAX) {
+   if (strip_len > USBVISION_STRIP_LEN_MAX)
/* strip overrun */
/* I think this never happens */
usbvision_request_intra(usbvision);
-   }
 
-   if (scratch_len(usbvision) < strip_len) {
+   if (scratch_len(usbvision) < strip_len)
/* there is not enough data for the strip */
return parse_state_out;
-   }
 
if (usbvision->intra_frame_buffer) {
Y = usbvision->intra_frame_buffer + frame->frmwidth * 
frame->curline;
@@ -1306,11 +1303,11 @@ static void usbvision_isoc_irq(struct urb *urb)
/* If we collected enough data let's parse! */
if (scratch_len(usbvision) > USBVISION_HEADER_LENGTH &&
!list_empty(&(usbvision->inqueue))) {
-   if (!(*f)) {
+   if (!(*f))
(*f) = list_entry(usbvision->inqueue.next,
  struct usbvision_frame,
  frame);
-   }
+
usbvision_parse_data(usbvision);
} else {
/* If we don't have a frame
@@ -1334,12 +1331,10 @@ static void usbvision_isoc_irq(struct urb *urb)
urb->status = 0;
urb->dev = usbvision->dev;
err_code = usb_submit_urb(urb, GFP_ATOMIC);
-
-   if (err_code) {
+   if (err_code)
dev_err(>dev->dev,
"%s: usb_submit_urb failed: error %d\n",
__func__, err_code);
-   }
 
return;
 }
@@ -1398,11 +1393,10 @@ int usbvision_write_reg(struct usb_usbvision 
*usbvision, unsigned char reg,
USB_DIR_OUT | USB_TYPE_VENDOR |
USB_RECIP_ENDPOINT, 0, (__u16) reg,
usbvision->ctrl_urb_buffer, 1, HZ);
-
-   if (err_code < 0) {
+   if (err_code < 0)
dev_err(>dev->dev,
"%s: failed: error %d\n", __func__, err_code);
-   }
+
return err_code;
 }
 
@@ -1443,10 +1437,10 @@ static int usbvision_write_reg_irq(struct usb_usbvision 
*usbvision, int address,
memcpy(usbvision->ctrl_urb_buffer, data, len);
 
err_code =