From patchwork Thu Sep 21 15:08:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9964101 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 64EBA600C5 for ; Thu, 21 Sep 2017 15:09:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 612F92959D for ; Thu, 21 Sep 2017 15:09:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 561AF295A3; Thu, 21 Sep 2017 15:09:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BC2DF2959D for ; Thu, 21 Sep 2017 15:09:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751787AbdIUPJY (ORCPT ); Thu, 21 Sep 2017 11:09:24 -0400 Received: from mout.web.de ([212.227.17.11]:55000 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751629AbdIUPJW (ORCPT ); Thu, 21 Sep 2017 11:09:22 -0400 Received: from [192.168.1.2] ([78.49.37.140]) by smtp.web.de (mrweb101 [213.165.67.124]) with ESMTPSA (Nemesis) id 0Ls95v-1dFMKJ2xXL-013x01; Thu, 21 Sep 2017 17:08:36 +0200 Subject: [PATCH 3/4] [media] usbvision-core: Delete unnecessary braces in 11 functions From: SF Markus Elfring To: linux-media@vger.kernel.org, Davidlohr Bueso , Hans Verkuil , Mauro Carvalho Chehab , Sakari Ailus Cc: LKML , kernel-janitors@vger.kernel.org References: Message-ID: Date: Thu, 21 Sep 2017 17:08:35 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-GB X-Provags-ID: V03:K0:AhNqvUlj7V/39l2vjVyfBLPl7jOxAOOcQJ3oeHlxGlhN1K+nMyF VVYAKuTpSIxvii1m/ZCWjzMTsULHRmO5umebIIGxvjOIMwnGc90xieKcHPUiE7pY98wUCIl N+kbe2MeOsifwLbdOU1V89k90j2eco/R4cLsUhknPyx7bqeo4Ng0ZQkAe+L3kOwFdpyLXfU JQ8iH4O1hxTdRVKpdAEkg== X-UI-Out-Filterresults: notjunk:1; V01:K0:WC1wbTLzT6o=:jZRh/buWbNoQ+MvcW+RRJv W1yIMPQiiH8Y2WTNsxeYd/7Y2wPj5gKCujy0v4gpwiLfSUbAgDK8YA7W4F+ZtllZXwV7w+QE/ tWvUWty9E2U0Fxrca7tcDGI6rceZ1eIXttT7XXiDJ9aooLeBZDFOsYPoUsu9p70UXZ3fCfJpT N5Hs/mhJivFS1krzFQeZ35Cb4mVQGIIjSScEOv7/mM31ETJ8ouopxCwIWvqqyyaPR+iCL1GvL U2dvy/iWfHqzFq4mO/ZwVnk30hO9WidB0cp/f86bgHoVQLP/CosZFDnUyywxtpCUvdWxIXf/Y 2c6hZ2ALlVLGPR2u23XUT/TivFnevm0pfrFceTu2ei9q5aJm4v5xbbiMZ2GlxdKF1nL6g7pHr 5uKgZuuETKFPU2Y1wAVorIDJdqegtevVbYko3COWl3iuDIFYUyT6lJm4GZYPkeMfsCnWRQgIC 3P/H/TCqezNQtV5jrHWT5YUYzZfj/LQP6uvdYSEIofbb5rFsm4RrzE3Q2eXMhHGa+h09fknqN +74LeuAYD9h0M2H1UNS2Te5pHhjqkxYx1fbgN8E8+T2ZryMBqTwWNYWTk5gpc2WfIpg+MGe31 wh8mJBjgerT0o0xdztuWPPHux8pVvDLdg38IGGwDH7bG2ils8pwC8HDpByrqwMBNFvApDQ4OJ tDslRsX3mKmrj17rX9HMudzmNeI5711Nebnu43R2dfT+4Gx90wTC8pp//w35qVKCdhHc1Xpnj Y8aUDgIko7ZT7p9ET5yHB35MaI7ZbBF+uW3bRsIlkIETUjJp73Wb42dUK4I1HFjjY6Olkb5Qa gEzXrp0C8d3UO/vFzt72bSokz/N6lI24YYGc2PdapB5/IuLbkI= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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(&usbvision->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(&usbvision->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 = usb_submit_urb(usbvision->ctrl_urb, GFP_ATOMIC); - if (err_code < 0) { + if (err_code < 0) /* error in usb_submit_urb() */ usbvision->ctrl_urb_busy = 0; - } + PDEBUG(DBG_IRQ, "submit %d byte: error %d", len, err_code); return err_code; } @@ -1477,11 +1471,11 @@ static int usbvision_measure_bandwidth(struct usb_usbvision *usbvision) usbvision->isoc_measure_bandwidth_count++; return 0; } - if ((usbvision->isoc_packet_size > 0) && (usbvision->isoc_packet_count > 0)) { + if (usbvision->isoc_packet_size > 0 && usbvision->isoc_packet_count > 0) usbvision->used_bandwidth = usbvision->isoc_data_count / (usbvision->isoc_packet_count + usbvision->isoc_skip_count) * 100 / usbvision->isoc_packet_size; - } + usbvision->isoc_measure_bandwidth_count = 0; usbvision->isoc_data_count = 0; usbvision->isoc_packet_count = 0; @@ -1648,11 +1642,10 @@ static int usbvision_set_video_format(struct usb_usbvision *usbvision, int forma USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_ENDPOINT, 0, (__u16) USBVISION_FILT_CONT, value, 2, HZ); - - if (rc < 0) { + if (rc < 0) printk(KERN_ERR "%s: ERROR=%d. USBVISION stopped - reconnect or reload driver.\n", proc, rc); - } + usbvision->isoc_mode = format; return rc; } @@ -1935,17 +1928,17 @@ int usbvision_set_input(struct usb_usbvision *usbvision) return 0; /* Set input format expected from decoder*/ - if (usbvision_device_data[usbvision->dev_model].vin_reg1_override) { + if (usbvision_device_data[usbvision->dev_model].vin_reg1_override) value[0] = usbvision_device_data[usbvision->dev_model].vin_reg1; - } else if (usbvision_device_data[usbvision->dev_model].codec == CODEC_SAA7113) { + else if (usbvision_device_data[usbvision->dev_model].codec + == CODEC_SAA7113) /* SAA7113 uses 8 bit output */ value[0] = USBVISION_8_422_SYNC; - } else { + else /* I'm sure only about d2-d0 [010] 16 bit 4:2:2 usin sync pulses * as that is how saa7111 is configured */ value[0] = USBVISION_16_422_SYNC; /* | USBVISION_VSNC_POL | USBVISION_VCLK_POL);*/ - } rc = usbvision_write_reg(usbvision, USBVISION_VIN_REG1, value[0]); if (rc < 0) @@ -2015,12 +2008,12 @@ int usbvision_set_input(struct usb_usbvision *usbvision) dvi_yuv_value = 0x00; /* U comes after V, Ya comes after U/V, Yb comes after Yb */ - if (usbvision_device_data[usbvision->dev_model].dvi_yuv_override) { + if (usbvision_device_data[usbvision->dev_model].dvi_yuv_override) dvi_yuv_value = usbvision_device_data[usbvision->dev_model].dvi_yuv; - } else if (usbvision_device_data[usbvision->dev_model].codec == CODEC_SAA7113) { + else if (usbvision_device_data[usbvision->dev_model].codec + == CODEC_SAA7113) /* This changes as the fine sync control changes. Further investigation necessary */ dvi_yuv_value = 0x06; - } return usbvision_write_reg(usbvision, USBVISION_DVI_YUV, dvi_yuv_value); @@ -2320,11 +2313,10 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision) for (buf_idx = 0; buf_idx < USBVISION_NUMSBUF; buf_idx++) { err_code = usb_submit_urb(usbvision->sbuf[buf_idx].urb, GFP_KERNEL); - if (err_code) { + if (err_code) dev_err(&usbvision->dev->dev, "%s: usb_submit_urb(%d) failed: error %d\n", __func__, buf_idx, err_code); - } } usbvision->streaming = stream_idle; @@ -2352,12 +2344,12 @@ void usbvision_stop_isoc(struct usb_usbvision *usbvision) /* Unschedule all of the iso td's */ for (buf_idx = 0; buf_idx < USBVISION_NUMSBUF; buf_idx++) { usb_kill_urb(usbvision->sbuf[buf_idx].urb); - if (usbvision->sbuf[buf_idx].data) { + if (usbvision->sbuf[buf_idx].data) usb_free_coherent(usbvision->dev, sb_size, usbvision->sbuf[buf_idx].data, usbvision->sbuf[buf_idx].urb->transfer_dma); - } + usb_free_urb(usbvision->sbuf[buf_idx].urb); usbvision->sbuf[buf_idx].urb = NULL; } @@ -2409,14 +2401,13 @@ int usbvision_muxsel(struct usb_usbvision *usbvision, int channel) switch (usbvision_device_data[usbvision->dev_model].codec) { case CODEC_SAA7113: mode[1] = SAA7115_COMPOSITE2; - if (switch_svideo_input) { + if (switch_svideo_input) /* To handle problems with S-Video Input for * some devices. Use switch_svideo_input * parameter when loading the module.*/ mode[2] = SAA7115_COMPOSITE1; - } else { + else mode[2] = SAA7115_SVIDEO1; - } break; case CODEC_SAA7111: default: