From patchwork Mon Mar 20 09:32:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9633999 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 01EE96020B for ; Mon, 20 Mar 2017 12:44:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EC96323B23 for ; Mon, 20 Mar 2017 12:44:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E17B42780C; Mon, 20 Mar 2017 12:44:57 +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 A5BA927F95 for ; Mon, 20 Mar 2017 12:44:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753596AbdCTJdS (ORCPT ); Mon, 20 Mar 2017 05:33:18 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:55898 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753445AbdCTJcz (ORCPT ); Mon, 20 Mar 2017 05:32:55 -0400 Received: from wuerfel.lan ([78.42.17.5]) by mrelayeu.kundenserver.de (mreue101 [212.227.15.145]) with ESMTPA (Nemesis) id 0MPGpE-1cuJWW0I7M-004QDT; Mon, 20 Mar 2017 10:32:44 +0100 From: Arnd Bergmann To: Mauro Carvalho Chehab Cc: Greg Kroah-Hartman , Alan Cox , linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Arnd Bergmann Subject: [PATCH 2/9] staging/atomisp: fix empty-body warning Date: Mon, 20 Mar 2017 10:32:18 +0100 Message-Id: <20170320093225.1180723-2-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170320093225.1180723-1-arnd@arndb.de> References: <20170320093225.1180723-1-arnd@arndb.de> X-Provags-ID: V03:K0:l7qn6GzBbU+Rcg3uuqfakwU7mXtEAqDcg2kzpbOF87IPpHSF1fG Oo0aFPj4HA7MAd4qNtEmyOFQD7LSjyMgK63C4mRrVvhfCqnK8wIPEt6+ygyRk/D0cBFzmlN uUw3NMtwl0gOCIyJe+AZs9bitrltO9Y4a0GYmmI61ByhaGFzuU7QJywRoa9D+EqyJoqXjaq U/qKh0Gj5+3uZJwfijC2w== X-UI-Out-Filterresults: notjunk:1; V01:K0:oHiil6/Dhmo=:/KWsxutPa7AV08kgqNjeR4 DDXKpjoGosDwvAyFCbcLzAflUKRsQLiH01S9gh0Eo64nXkscCnlm+QUvGoPFx3eYD+uYi3rR5 0bQYcL9TbLX1llcvIQWBU92QKLuX9wqAKK6x/cgki7FxkqUIbERwaSZJFzWXjHTlCD6ze4XXE ScwWoPty14CiFvjzYmp+SNREFviMyVSyL15oFT1Of05JYzgi30VLpekwlK43N359nDgc23IWq rCX8b0T3IYr+Dma6qps2fH1rPZrl6hBt5iC40ATTyxFyMYTF3xR2i3vSU27c1nDVJgits3oBM RpTX5C+zZtJn4nX5c+ZjKYWXoig8PiE89g3nMzNNNWi7hHxRFMVNlsAXf04DPgy9MPLuvNvV6 VM7iiUrCgf/EefAlQPNfpSKjt7CaMgv6is1MDo/9HwNmwxI6RmAsnCasg7CDaNgUMBwFxP4ti ROkbqm/75oXqAdqO1I/79KQRrDixPhnBvd5qXMhzqfWHcjIlOSnoafMyAA5/ztf80ACcjUA3k x2mF4FLnJwS+WW1Xe12+eqfKfL33k7/w0OAEBl8ndghmWG23MB3VXU4DSx0EUAFY57Xy3kE59 C5xofCp90SWI5zQKsFURrjmn7hAf4Vp5kW8oNS56OZNSsh+LPhjNUvHnEh29R2O3zf8Bl+I6g PZSrqAEcJVdb3mVajGcn6R67auV+r+WlswXROZJc6/WKy2/d8apmOvyHCIKAq45CDM9w= 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 Defining a debug function to nothing causes a warning with an empty block after if()/else(): drivers/staging/media/atomisp/i2c/ov2680.c: In function 'ov2680_s_stream': drivers/staging/media/atomisp/i2c/ov2680.c:1208:55: error: suggest braces around empty body in an 'else' statement [-Werror=empty-body] This changes the empty debug statement to dev_dbg(), which by default also does nothing, but avoids this warning and also checks the format string. As a side-effect, we can now use dynamic debugging to turn on the output at runtime. Fixes: a49d25364dfb ("staging/atomisp: Add support for the Intel IPU v2") Signed-off-by: Arnd Bergmann --- drivers/staging/media/atomisp/i2c/ov2680.c | 37 +++++++++++++++--------------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/drivers/staging/media/atomisp/i2c/ov2680.c b/drivers/staging/media/atomisp/i2c/ov2680.c index 58d2a075d436..c08dd0b18fbb 100644 --- a/drivers/staging/media/atomisp/i2c/ov2680.c +++ b/drivers/staging/media/atomisp/i2c/ov2680.c @@ -35,7 +35,6 @@ #include "ov2680.h" -#define ov2680_debug(...) //dev_err(__VA_ARGS__) static int h_flag = 0; static int v_flag = 0; static enum atomisp_bayer_order ov2680_bayer_order_mapping[] = { @@ -99,7 +98,7 @@ static int ov2680_read_reg(struct i2c_client *client, *val = be16_to_cpu(*(u16 *)&data[0]); else *val = be32_to_cpu(*(u32 *)&data[0]); - //ov2680_debug(&client->dev, "++++i2c read adr%x = %x\n", reg,*val); + //dev_dbg(&client->dev, "++++i2c read adr%x = %x\n", reg,*val); return 0; } @@ -114,7 +113,7 @@ static int ov2680_i2c_write(struct i2c_client *client, u16 len, u8 *data) msg.len = len; msg.buf = data; ret = i2c_transfer(client->adapter, &msg, 1); - //ov2680_debug(&client->dev, "+++i2c write reg=%x->%x\n", data[0]*256 +data[1],data[2]); + //dev_dbg(&client->dev, "+++i2c write reg=%x->%x\n", data[0]*256 +data[1],data[2]); return ret == num_msg ? 0 : -EIO; } @@ -235,7 +234,7 @@ static int ov2680_write_reg_array(struct i2c_client *client, const struct ov2680_reg *next = reglist; struct ov2680_write_ctrl ctrl; int err; - ov2680_debug(&client->dev, "++++write reg array\n"); + dev_dbg(&client->dev, "++++write reg array\n"); ctrl.index = 0; for (; next->type != OV2680_TOK_TERM; next++) { switch (next->type & OV2680_TOK_MASK) { @@ -250,7 +249,7 @@ static int ov2680_write_reg_array(struct i2c_client *client, * If next address is not consecutive, data needs to be * flushed before proceed. */ - ov2680_debug(&client->dev, "+++ov2680_write_reg_array reg=%x->%x\n", next->reg,next->val); + dev_dbg(&client->dev, "+++ov2680_write_reg_array reg=%x->%x\n", next->reg,next->val); if (!__ov2680_write_reg_is_consecutive(client, &ctrl, next)) { err = __ov2680_flush_reg_array(client, &ctrl); @@ -296,7 +295,8 @@ static int ov2680_g_fnumber_range(struct v4l2_subdev *sd, s32 *val) static int ov2680_g_bin_factor_x(struct v4l2_subdev *sd, s32 *val) { struct ov2680_device *dev = to_ov2680_sensor(sd); - ov2680_debug(dev, "++++ov2680_g_bin_factor_x\n"); + struct i2c_client *client = v4l2_get_subdevdata(sd); + dev_dbg(&client->dev, "++++ov2680_g_bin_factor_x\n"); *val = ov2680_res[dev->fmt_idx].bin_factor_x; return 0; @@ -305,9 +305,10 @@ static int ov2680_g_bin_factor_x(struct v4l2_subdev *sd, s32 *val) static int ov2680_g_bin_factor_y(struct v4l2_subdev *sd, s32 *val) { struct ov2680_device *dev = to_ov2680_sensor(sd); + struct i2c_client *client = v4l2_get_subdevdata(sd); *val = ov2680_res[dev->fmt_idx].bin_factor_y; - ov2680_debug(dev, "++++ov2680_g_bin_factor_y\n"); + dev_dbg(&client->dev, "++++ov2680_g_bin_factor_y\n"); return 0; } @@ -322,7 +323,7 @@ static int ov2680_get_intg_factor(struct i2c_client *client, unsigned int pix_clk_freq_hz; u16 reg_val; int ret; - ov2680_debug(dev, "++++ov2680_get_intg_factor\n"); + dev_dbg(&client->dev, "++++ov2680_get_intg_factor\n"); if (!info) return -EINVAL; @@ -399,7 +400,7 @@ static long __ov2680_set_exposure(struct v4l2_subdev *sd, int coarse_itg, u16 vts,hts; int ret,exp_val; - ov2680_debug(dev, "+++++++__ov2680_set_exposure coarse_itg %d, gain %d, digitgain %d++\n",coarse_itg, gain, digitgain); + dev_dbg(&client->dev, "+++++++__ov2680_set_exposure coarse_itg %d, gain %d, digitgain %d++\n",coarse_itg, gain, digitgain); hts = ov2680_res[dev->fmt_idx].pixels_per_line; vts = ov2680_res[dev->fmt_idx].lines_per_frame; @@ -605,7 +606,7 @@ static int ov2680_v_flip(struct v4l2_subdev *sd, s32 value) int ret; u16 val; u8 index; - ov2680_debug(&client->dev, "@%s: value:%d\n", __func__, value); + dev_dbg(&client->dev, "@%s: value:%d\n", __func__, value); ret = ov2680_read_reg(client, OV2680_8BIT, OV2680_FLIP_REG, &val); if (ret) return ret; @@ -636,7 +637,7 @@ static int ov2680_h_flip(struct v4l2_subdev *sd, s32 value) int ret; u16 val; u8 index; - ov2680_debug(&client->dev, "@%s: value:%d\n", __func__, value); + dev_dbg(&client->dev, "@%s: value:%d\n", __func__, value); ret = ov2680_read_reg(client, OV2680_8BIT, OV2680_MIRROR_REG, &val); if (ret) @@ -1069,7 +1070,7 @@ static int ov2680_set_fmt(struct v4l2_subdev *sd, struct camera_mipi_info *ov2680_info = NULL; int ret = 0; int idx = 0; - ov2680_debug(&client->dev, "+++++ov2680_s_mbus_fmt+++++l\n"); + dev_dbg(&client->dev, "+++++ov2680_s_mbus_fmt+++++l\n"); if (format->pad) return -EINVAL; @@ -1097,7 +1098,7 @@ static int ov2680_set_fmt(struct v4l2_subdev *sd, return 0; } dev->fmt_idx = get_resolution_index(fmt->width, fmt->height); - ov2680_debug(&client->dev, "+++++get_resolution_index=%d+++++l\n", + dev_dbg(&client->dev, "+++++get_resolution_index=%d+++++l\n", dev->fmt_idx); if (dev->fmt_idx == -1) { dev_err(&client->dev, "get resolution fail\n"); @@ -1106,7 +1107,7 @@ static int ov2680_set_fmt(struct v4l2_subdev *sd, } v4l2_info(client, "__s_mbus_fmt i=%d, w=%d, h=%d\n", dev->fmt_idx, fmt->width, fmt->height); - ov2680_debug(&client->dev, "__s_mbus_fmt i=%d, w=%d, h=%d\n", + dev_dbg(&client->dev, "__s_mbus_fmt i=%d, w=%d, h=%d\n", dev->fmt_idx, fmt->width, fmt->height); ret = ov2680_write_reg_array(client, ov2680_res[dev->fmt_idx].regs); @@ -1203,9 +1204,9 @@ static int ov2680_s_stream(struct v4l2_subdev *sd, int enable) mutex_lock(&dev->input_lock); if(enable ) - ov2680_debug(&client->dev, "ov2680_s_stream one \n"); + dev_dbg(&client->dev, "ov2680_s_stream one \n"); else - ov2680_debug(&client->dev, "ov2680_s_stream off \n"); + dev_dbg(&client->dev, "ov2680_s_stream off \n"); ret = ov2680_write_reg(client, OV2680_8BIT, OV2680_SW_STREAM, enable ? OV2680_START_STREAMING : @@ -1508,11 +1509,11 @@ static int ov2680_probe(struct i2c_client *client, if (ret) { ov2680_remove(client); - ov2680_debug(&client->dev, "+++ remove ov2680 \n"); + dev_dbg(&client->dev, "+++ remove ov2680 \n"); } return ret; out_free: - ov2680_debug(&client->dev, "+++ out free \n"); + dev_dbg(&client->dev, "+++ out free \n"); v4l2_device_unregister_subdev(&dev->sd); kfree(dev); return ret;