diff options
author | Mauro Carvalho Chehab <mchehab+huawei@kernel.org> | 2020-04-19 16:06:45 +0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+huawei@kernel.org> | 2020-05-20 12:32:15 +0200 |
commit | bdfe0beb95eebc864f341fd0c5e903672b90b1a2 (patch) | |
tree | cc56c0b573c272230683e1827add0fdc4a4c27c7 /drivers/staging/media/atomisp/i2c/ov5693 | |
parent | 4636a85cff86b2c014752c6b8fece018558b0d08 (diff) |
media: atomisp: fix several coding style issues
Use checkpatch.pl --fix-inplace --strict to solve several
coding style issues, manually reviewing the produced code and
fixing some troubles caused by checkpatch.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'drivers/staging/media/atomisp/i2c/ov5693')
-rw-r--r-- | drivers/staging/media/atomisp/i2c/ov5693/ad5823.h | 1 | ||||
-rw-r--r-- | drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c | 27 | ||||
-rw-r--r-- | drivers/staging/media/atomisp/i2c/ov5693/ov5693.h | 9 |
3 files changed, 16 insertions, 21 deletions
diff --git a/drivers/staging/media/atomisp/i2c/ov5693/ad5823.h b/drivers/staging/media/atomisp/i2c/ov5693/ad5823.h index 4de44569fe54..c97ab24c5d2b 100644 --- a/drivers/staging/media/atomisp/i2c/ov5693/ad5823.h +++ b/drivers/staging/media/atomisp/i2c/ov5693/ad5823.h @@ -20,7 +20,6 @@ #include <linux/types.h> - #define AD5823_VCM_ADDR 0x0c #define AD5823_REG_RESET 0x01 diff --git a/drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c b/drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c index 714297c36b3e..4a184400c7d7 100644 --- a/drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c +++ b/drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c @@ -119,8 +119,7 @@ static int ad5823_i2c_read(struct i2c_client *client, u8 reg, u8 *val) return 0; } - -static const uint32_t ov5693_embedded_effective_size = 28; +static const u32 ov5693_embedded_effective_size = 28; /* i2c read/write stuff */ static int ov5693_read_reg(struct i2c_client *client, @@ -413,6 +412,7 @@ static int ov5693_write_reg_array(struct i2c_client *client, return __ov5693_flush_reg_array(client, &ctrl); } + static int ov5693_g_focal(struct v4l2_subdev *sd, s32 *val) { *val = (OV5693_FOCAL_LENGTH_NUM << 16) | OV5693_FOCAL_LENGTH_DEM; @@ -463,7 +463,7 @@ static int ov5693_get_intg_factor(struct i2c_client *client, u16 reg_val; int ret; - if (info == NULL) + if (!info) return -EINVAL; /* pixel clock */ @@ -576,7 +576,7 @@ static long __ov5693_set_exposure(struct v4l2_subdev *sd, int coarse_itg, } /* Increase the VTS to match exposure + MARGIN */ if (coarse_itg > vts - OV5693_INTEGRATION_TIME_MARGIN) - vts = (u16) coarse_itg + OV5693_INTEGRATION_TIME_MARGIN; + vts = (u16)coarse_itg + OV5693_INTEGRATION_TIME_MARGIN; ret = ov5693_write_reg(client, OV5693_8BIT, OV5693_TIMING_VTS_H, (vts >> 8) & 0xFF); @@ -718,7 +718,7 @@ static int ov5693_read_otp_reg_array(struct i2c_client *client, u16 size, u16 *pVal = NULL; for (index = 0; index <= size; index++) { - pVal = (u16 *) (buf + index); + pVal = (u16 *)(buf + index); ret = ov5693_read_reg(client, OV5693_8BIT, addr + index, pVal); @@ -873,12 +873,10 @@ out: priv->size = dev->otp_size; return 0; - } static long ov5693_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg) { - switch (cmd) { case ATOMISP_IOC_S_EXPOSURE: return ov5693_s_exposure(sd, arg); @@ -1588,7 +1586,7 @@ static int ov5693_set_fmt(struct v4l2_subdev *sd, if (!fmt) return -EINVAL; ov5693_info = v4l2_get_subdev_hostdata(sd); - if (ov5693_info == NULL) + if (!ov5693_info) return -EINVAL; mutex_lock(&dev->input_lock); @@ -1624,7 +1622,7 @@ static int ov5693_set_fmt(struct v4l2_subdev *sd, for (i = 0; i < OV5693_POWER_UP_RETRY_NUM; i++) { dev_err(&client->dev, "ov5693 retry to power up %d/%d times, result: ", - i+1, OV5693_POWER_UP_RETRY_NUM); + i + 1, OV5693_POWER_UP_RETRY_NUM); power_down(sd); ret = power_up(sd); if (!ret) { @@ -1670,6 +1668,7 @@ err: mutex_unlock(&dev->input_lock); return ret; } + static int ov5693_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_format *format) @@ -1709,7 +1708,7 @@ static int ov5693_detect(struct i2c_client *client) } ret = ov5693_read_reg(client, OV5693_8BIT, OV5693_SC_CMMN_CHIP_ID_L, &low); - id = ((((u16) high) << 8) | (u16) low); + id = ((((u16)high) << 8) | (u16)low); if (id != OV5693_ID) { dev_err(&client->dev, "sensor ID error 0x%x\n", id); @@ -1718,7 +1717,7 @@ static int ov5693_detect(struct i2c_client *client) ret = ov5693_read_reg(client, OV5693_8BIT, OV5693_SC_CMMN_SUB_ID, &high); - revision = (u8) high & 0x0f; + revision = (u8)high & 0x0f; dev_dbg(&client->dev, "sensor_revision = 0x%x\n", revision); dev_dbg(&client->dev, "detect ov5693 success\n"); @@ -1742,7 +1741,6 @@ static int ov5693_s_stream(struct v4l2_subdev *sd, int enable) return ret; } - static int ov5693_s_config(struct v4l2_subdev *sd, int irq, void *platform_data) { @@ -1750,7 +1748,7 @@ static int ov5693_s_config(struct v4l2_subdev *sd, struct i2c_client *client = v4l2_get_subdevdata(sd); int ret = 0; - if (platform_data == NULL) + if (!platform_data) return -ENODEV; dev->platform_data = @@ -1846,7 +1844,6 @@ static int ov5693_enum_frame_size(struct v4l2_subdev *sd, fse->max_height = ov5693_res[index].height; return 0; - } static const struct v4l2_subdev_video_ops ov5693_video_ops = { @@ -1921,7 +1918,7 @@ static int ov5693_probe(struct i2c_client *client) mutex_init(&dev->input_lock); dev->fmt_idx = 0; - v4l2_i2c_subdev_init(&(dev->sd), client, &ov5693_ops); + v4l2_i2c_subdev_init(&dev->sd, client, &ov5693_ops); pdata = gmin_camera_platform_data(&dev->sd, ATOMISP_INPUT_FORMAT_RAW_10, diff --git a/drivers/staging/media/atomisp/i2c/ov5693/ov5693.h b/drivers/staging/media/atomisp/i2c/ov5693/ov5693.h index bba99406785e..0189907969c6 100644 --- a/drivers/staging/media/atomisp/i2c/ov5693/ov5693.h +++ b/drivers/staging/media/atomisp/i2c/ov5693/ov5693.h @@ -36,7 +36,6 @@ */ #define ENABLE_NON_PREVIEW 0 - #define OV5693_POWER_UP_RETRY_NUM 5 /* Defines for register writes and register array processing */ @@ -174,7 +173,7 @@ #define OV5693_OTP_START_ADDR 0x3D00 #define OV5693_OTP_END_ADDR 0x3D0F #define OV5693_OTP_DATA_SIZE 320 -#define OV5693_OTP_PROGRAM_REG 0x3D80 +#define OV5693_OTP_PROGRAM_REG 0x3D80 #define OV5693_OTP_READ_REG 0x3D81 // 1:Enable 0:disable #define OV5693_OTP_BANK_REG 0x3D84 //otp bank and mode #define OV5693_OTP_READY_REG_DONE 1 @@ -586,7 +585,6 @@ static struct ov5693_reg const ov5693_1296x976[] = { }; - /* * 336x256 30fps 17ms VBlanking 2lane 10Bit (Scaling) DS from 2564x1956 @@ -675,7 +673,6 @@ static struct ov5693_reg const ov5693_192x160[] = { {OV5693_TOK_TERM, 0, 0} }; - static struct ov5693_reg const ov5693_736x496[] = { {OV5693_8BIT, 0x3501, 0x3d}, {OV5693_8BIT, 0x3502, 0x00}, @@ -865,7 +862,6 @@ static struct ov5693_reg const ov5693_1616x1216_30fps[] = { {OV5693_TOK_TERM, 0, 0} }; - /* * 1940x1096 30fps 8.8ms VBlanking 2lane 10bit (Scaling) */ @@ -1161,6 +1157,7 @@ static struct ov5693_resolution ov5693_res_preview[] = { .regs = ov5693_2576x1936_30fps, }, }; + #define N_RES_PREVIEW (ARRAY_SIZE(ov5693_res_preview)) /* @@ -1240,6 +1237,7 @@ struct ov5693_resolution ov5693_res_still[] = { .regs = ov5693_2592x1944_30fps, }, }; + #define N_RES_STILL (ARRAY_SIZE(ov5693_res_still)) struct ov5693_resolution ov5693_res_video[] = { @@ -1384,6 +1382,7 @@ struct ov5693_resolution ov5693_res_video[] = { .regs = ov5693_2592x1944_30fps, }, }; + #define N_RES_VIDEO (ARRAY_SIZE(ov5693_res_video)) #endif |