Commit 72d2b01e authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Greg Kroah-Hartman

staging/atomisp: fix empty-body warning

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: a49d2536 ("staging/atomisp: Add support for the Intel IPU v2")
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarAlan Cox <alan@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 55a91776
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
#include "ov2680.h" #include "ov2680.h"
#define ov2680_debug(...) //dev_err(__VA_ARGS__)
static int h_flag = 0; static int h_flag = 0;
static int v_flag = 0; static int v_flag = 0;
static enum atomisp_bayer_order ov2680_bayer_order_mapping[] = { static enum atomisp_bayer_order ov2680_bayer_order_mapping[] = {
...@@ -99,7 +98,7 @@ static int ov2680_read_reg(struct i2c_client *client, ...@@ -99,7 +98,7 @@ static int ov2680_read_reg(struct i2c_client *client,
*val = be16_to_cpu(*(u16 *)&data[0]); *val = be16_to_cpu(*(u16 *)&data[0]);
else else
*val = be32_to_cpu(*(u32 *)&data[0]); *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; return 0;
} }
...@@ -114,7 +113,7 @@ static int ov2680_i2c_write(struct i2c_client *client, u16 len, u8 *data) ...@@ -114,7 +113,7 @@ static int ov2680_i2c_write(struct i2c_client *client, u16 len, u8 *data)
msg.len = len; msg.len = len;
msg.buf = data; msg.buf = data;
ret = i2c_transfer(client->adapter, &msg, 1); 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; return ret == num_msg ? 0 : -EIO;
} }
...@@ -235,7 +234,7 @@ static int ov2680_write_reg_array(struct i2c_client *client, ...@@ -235,7 +234,7 @@ static int ov2680_write_reg_array(struct i2c_client *client,
const struct ov2680_reg *next = reglist; const struct ov2680_reg *next = reglist;
struct ov2680_write_ctrl ctrl; struct ov2680_write_ctrl ctrl;
int err; int err;
ov2680_debug(&client->dev, "++++write reg array\n"); dev_dbg(&client->dev, "++++write reg array\n");
ctrl.index = 0; ctrl.index = 0;
for (; next->type != OV2680_TOK_TERM; next++) { for (; next->type != OV2680_TOK_TERM; next++) {
switch (next->type & OV2680_TOK_MASK) { switch (next->type & OV2680_TOK_MASK) {
...@@ -250,7 +249,7 @@ static int ov2680_write_reg_array(struct i2c_client *client, ...@@ -250,7 +249,7 @@ static int ov2680_write_reg_array(struct i2c_client *client,
* If next address is not consecutive, data needs to be * If next address is not consecutive, data needs to be
* flushed before proceed. * 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, if (!__ov2680_write_reg_is_consecutive(client, &ctrl,
next)) { next)) {
err = __ov2680_flush_reg_array(client, &ctrl); err = __ov2680_flush_reg_array(client, &ctrl);
...@@ -296,7 +295,8 @@ static int ov2680_g_fnumber_range(struct v4l2_subdev *sd, s32 *val) ...@@ -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) static int ov2680_g_bin_factor_x(struct v4l2_subdev *sd, s32 *val)
{ {
struct ov2680_device *dev = to_ov2680_sensor(sd); 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; *val = ov2680_res[dev->fmt_idx].bin_factor_x;
return 0; return 0;
...@@ -305,9 +305,10 @@ static int ov2680_g_bin_factor_x(struct v4l2_subdev *sd, s32 *val) ...@@ -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) static int ov2680_g_bin_factor_y(struct v4l2_subdev *sd, s32 *val)
{ {
struct ov2680_device *dev = to_ov2680_sensor(sd); 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; *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; return 0;
} }
...@@ -322,7 +323,7 @@ static int ov2680_get_intg_factor(struct i2c_client *client, ...@@ -322,7 +323,7 @@ static int ov2680_get_intg_factor(struct i2c_client *client,
unsigned int pix_clk_freq_hz; unsigned int pix_clk_freq_hz;
u16 reg_val; u16 reg_val;
int ret; int ret;
ov2680_debug(dev, "++++ov2680_get_intg_factor\n"); dev_dbg(&client->dev, "++++ov2680_get_intg_factor\n");
if (!info) if (!info)
return -EINVAL; return -EINVAL;
...@@ -399,7 +400,7 @@ static long __ov2680_set_exposure(struct v4l2_subdev *sd, int coarse_itg, ...@@ -399,7 +400,7 @@ static long __ov2680_set_exposure(struct v4l2_subdev *sd, int coarse_itg,
u16 vts,hts; u16 vts,hts;
int ret,exp_val; 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; hts = ov2680_res[dev->fmt_idx].pixels_per_line;
vts = ov2680_res[dev->fmt_idx].lines_per_frame; vts = ov2680_res[dev->fmt_idx].lines_per_frame;
...@@ -605,7 +606,7 @@ static int ov2680_v_flip(struct v4l2_subdev *sd, s32 value) ...@@ -605,7 +606,7 @@ static int ov2680_v_flip(struct v4l2_subdev *sd, s32 value)
int ret; int ret;
u16 val; u16 val;
u8 index; 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); ret = ov2680_read_reg(client, OV2680_8BIT, OV2680_FLIP_REG, &val);
if (ret) if (ret)
return ret; return ret;
...@@ -636,7 +637,7 @@ static int ov2680_h_flip(struct v4l2_subdev *sd, s32 value) ...@@ -636,7 +637,7 @@ static int ov2680_h_flip(struct v4l2_subdev *sd, s32 value)
int ret; int ret;
u16 val; u16 val;
u8 index; 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); ret = ov2680_read_reg(client, OV2680_8BIT, OV2680_MIRROR_REG, &val);
if (ret) if (ret)
...@@ -1069,7 +1070,7 @@ static int ov2680_set_fmt(struct v4l2_subdev *sd, ...@@ -1069,7 +1070,7 @@ static int ov2680_set_fmt(struct v4l2_subdev *sd,
struct camera_mipi_info *ov2680_info = NULL; struct camera_mipi_info *ov2680_info = NULL;
int ret = 0; int ret = 0;
int idx = 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) if (format->pad)
return -EINVAL; return -EINVAL;
...@@ -1097,7 +1098,7 @@ static int ov2680_set_fmt(struct v4l2_subdev *sd, ...@@ -1097,7 +1098,7 @@ static int ov2680_set_fmt(struct v4l2_subdev *sd,
return 0; return 0;
} }
dev->fmt_idx = get_resolution_index(fmt->width, fmt->height); 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); dev->fmt_idx);
if (dev->fmt_idx == -1) { if (dev->fmt_idx == -1) {
dev_err(&client->dev, "get resolution fail\n"); dev_err(&client->dev, "get resolution fail\n");
...@@ -1106,7 +1107,7 @@ static int ov2680_set_fmt(struct v4l2_subdev *sd, ...@@ -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, v4l2_info(client, "__s_mbus_fmt i=%d, w=%d, h=%d\n", dev->fmt_idx,
fmt->width, fmt->height); 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); dev->fmt_idx, fmt->width, fmt->height);
ret = ov2680_write_reg_array(client, ov2680_res[dev->fmt_idx].regs); 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) ...@@ -1203,9 +1204,9 @@ static int ov2680_s_stream(struct v4l2_subdev *sd, int enable)
mutex_lock(&dev->input_lock); mutex_lock(&dev->input_lock);
if(enable ) if(enable )
ov2680_debug(&client->dev, "ov2680_s_stream one \n"); dev_dbg(&client->dev, "ov2680_s_stream one \n");
else 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, ret = ov2680_write_reg(client, OV2680_8BIT, OV2680_SW_STREAM,
enable ? OV2680_START_STREAMING : enable ? OV2680_START_STREAMING :
...@@ -1508,11 +1509,11 @@ static int ov2680_probe(struct i2c_client *client, ...@@ -1508,11 +1509,11 @@ static int ov2680_probe(struct i2c_client *client,
if (ret) if (ret)
{ {
ov2680_remove(client); ov2680_remove(client);
ov2680_debug(&client->dev, "+++ remove ov2680 \n"); dev_dbg(&client->dev, "+++ remove ov2680 \n");
} }
return ret; return ret;
out_free: out_free:
ov2680_debug(&client->dev, "+++ out free \n"); dev_dbg(&client->dev, "+++ out free \n");
v4l2_device_unregister_subdev(&dev->sd); v4l2_device_unregister_subdev(&dev->sd);
kfree(dev); kfree(dev);
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment