Commit e25a2589 authored by Hans de Goede's avatar Hans de Goede Committed by Mauro Carvalho Chehab

media: atomisp: ov2680: s/dev/sensor/

Using dev as name for variables pointing to struct ov2680_device is a bit
unfortunate choice.

All the recently added / rewritten code is already using sensor for this,
replace the remaining usages of "struct ov2680_device *dev" with
"struct ov2680_device *sensor".

Note the power_up()/power_down() related functions are not changed as
these will be removed in one of the next patches.

No functional changes.
Reviewed-by: default avatarAndy Shevchenko <andy@kernel.org>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent 36183508
...@@ -473,24 +473,24 @@ static int ov2680_set_fmt(struct v4l2_subdev *sd, ...@@ -473,24 +473,24 @@ static int ov2680_set_fmt(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state, struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_format *format) struct v4l2_subdev_format *format)
{ {
struct ov2680_device *dev = to_ov2680_sensor(sd); struct ov2680_device *sensor = to_ov2680_sensor(sd);
struct v4l2_mbus_framefmt *fmt; struct v4l2_mbus_framefmt *fmt;
unsigned int width, height; unsigned int width, height;
width = min_t(unsigned int, ALIGN(format->format.width, 2), OV2680_NATIVE_WIDTH); width = min_t(unsigned int, ALIGN(format->format.width, 2), OV2680_NATIVE_WIDTH);
height = min_t(unsigned int, ALIGN(format->format.height, 2), OV2680_NATIVE_HEIGHT); height = min_t(unsigned int, ALIGN(format->format.height, 2), OV2680_NATIVE_HEIGHT);
fmt = __ov2680_get_pad_format(dev, sd_state, format->pad, format->which); fmt = __ov2680_get_pad_format(sensor, sd_state, format->pad, format->which);
ov2680_fill_format(dev, fmt, width, height); ov2680_fill_format(sensor, fmt, width, height);
format->format = *fmt; format->format = *fmt;
if (format->which == V4L2_SUBDEV_FORMAT_TRY) if (format->which == V4L2_SUBDEV_FORMAT_TRY)
return 0; return 0;
mutex_lock(&dev->input_lock); mutex_lock(&sensor->input_lock);
ov2680_calc_mode(dev, fmt->width, fmt->height); ov2680_calc_mode(sensor, fmt->width, fmt->height);
mutex_unlock(&dev->input_lock); mutex_unlock(&sensor->input_lock);
return 0; return 0;
} }
...@@ -498,10 +498,10 @@ static int ov2680_get_fmt(struct v4l2_subdev *sd, ...@@ -498,10 +498,10 @@ static int ov2680_get_fmt(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state, struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_format *format) struct v4l2_subdev_format *format)
{ {
struct ov2680_device *dev = to_ov2680_sensor(sd); struct ov2680_device *sensor = to_ov2680_sensor(sd);
struct v4l2_mbus_framefmt *fmt; struct v4l2_mbus_framefmt *fmt;
fmt = __ov2680_get_pad_format(dev, sd_state, format->pad, format->which); fmt = __ov2680_get_pad_format(sensor, sd_state, format->pad, format->which);
format->format = *fmt; format->format = *fmt;
return 0; return 0;
} }
...@@ -591,17 +591,17 @@ static int ov2680_s_stream(struct v4l2_subdev *sd, int enable) ...@@ -591,17 +591,17 @@ static int ov2680_s_stream(struct v4l2_subdev *sd, int enable)
static int ov2680_s_config(struct v4l2_subdev *sd, static int ov2680_s_config(struct v4l2_subdev *sd,
int irq, void *platform_data) int irq, void *platform_data)
{ {
struct ov2680_device *dev = to_ov2680_sensor(sd); struct ov2680_device *sensor = to_ov2680_sensor(sd);
struct i2c_client *client = v4l2_get_subdevdata(sd); struct i2c_client *client = v4l2_get_subdevdata(sd);
int ret = 0; int ret = 0;
if (!platform_data) if (!platform_data)
return -ENODEV; return -ENODEV;
dev->platform_data = sensor->platform_data =
(struct camera_sensor_platform_data *)platform_data; (struct camera_sensor_platform_data *)platform_data;
mutex_lock(&dev->input_lock); mutex_lock(&sensor->input_lock);
ret = pm_runtime_get_sync(&client->dev); ret = pm_runtime_get_sync(&client->dev);
if (ret < 0) { if (ret < 0) {
...@@ -609,7 +609,7 @@ static int ov2680_s_config(struct v4l2_subdev *sd, ...@@ -609,7 +609,7 @@ static int ov2680_s_config(struct v4l2_subdev *sd,
goto fail_power_on; goto fail_power_on;
} }
ret = dev->platform_data->csi_cfg(sd, 1); ret = sensor->platform_data->csi_cfg(sd, 1);
if (ret) if (ret)
goto fail_csi_cfg; goto fail_csi_cfg;
...@@ -622,16 +622,16 @@ static int ov2680_s_config(struct v4l2_subdev *sd, ...@@ -622,16 +622,16 @@ static int ov2680_s_config(struct v4l2_subdev *sd,
/* turn off sensor, after probed */ /* turn off sensor, after probed */
pm_runtime_put(&client->dev); pm_runtime_put(&client->dev);
mutex_unlock(&dev->input_lock); mutex_unlock(&sensor->input_lock);
return 0; return 0;
fail_csi_cfg: fail_csi_cfg:
dev->platform_data->csi_cfg(sd, 0); sensor->platform_data->csi_cfg(sd, 0);
fail_power_on: fail_power_on:
pm_runtime_put(&client->dev); pm_runtime_put(&client->dev);
dev_err(&client->dev, "sensor power-gating failed\n"); dev_err(&client->dev, "sensor power-gating failed\n");
mutex_unlock(&dev->input_lock); mutex_unlock(&sensor->input_lock);
return ret; return ret;
} }
...@@ -766,35 +766,35 @@ static int ov2680_init_controls(struct ov2680_device *sensor) ...@@ -766,35 +766,35 @@ static int ov2680_init_controls(struct ov2680_device *sensor)
static void ov2680_remove(struct i2c_client *client) static void ov2680_remove(struct i2c_client *client)
{ {
struct v4l2_subdev *sd = i2c_get_clientdata(client); struct v4l2_subdev *sd = i2c_get_clientdata(client);
struct ov2680_device *dev = to_ov2680_sensor(sd); struct ov2680_device *sensor = to_ov2680_sensor(sd);
dev_dbg(&client->dev, "ov2680_remove...\n"); dev_dbg(&client->dev, "ov2680_remove...\n");
dev->platform_data->csi_cfg(sd, 0); sensor->platform_data->csi_cfg(sd, 0);
v4l2_device_unregister_subdev(sd); v4l2_device_unregister_subdev(sd);
media_entity_cleanup(&dev->sd.entity); media_entity_cleanup(&sensor->sd.entity);
v4l2_ctrl_handler_free(&dev->ctrls.handler); v4l2_ctrl_handler_free(&sensor->ctrls.handler);
pm_runtime_disable(&client->dev); pm_runtime_disable(&client->dev);
kfree(dev); kfree(sensor);
} }
static int ov2680_probe(struct i2c_client *client) static int ov2680_probe(struct i2c_client *client)
{ {
struct ov2680_device *dev; struct ov2680_device *sensor;
int ret; int ret;
void *pdata; void *pdata;
dev = kzalloc(sizeof(*dev), GFP_KERNEL); sensor = kzalloc(sizeof(*sensor), GFP_KERNEL);
if (!dev) if (!sensor)
return -ENOMEM; return -ENOMEM;
mutex_init(&dev->input_lock); mutex_init(&sensor->input_lock);
dev->client = client; sensor->client = client;
v4l2_i2c_subdev_init(&dev->sd, client, &ov2680_ops); v4l2_i2c_subdev_init(&sensor->sd, client, &ov2680_ops);
pdata = gmin_camera_platform_data(&dev->sd, pdata = gmin_camera_platform_data(&sensor->sd,
ATOMISP_INPUT_FORMAT_RAW_10, ATOMISP_INPUT_FORMAT_RAW_10,
atomisp_bayer_order_bggr); atomisp_bayer_order_bggr);
if (!pdata) { if (!pdata) {
...@@ -807,29 +807,29 @@ static int ov2680_probe(struct i2c_client *client) ...@@ -807,29 +807,29 @@ static int ov2680_probe(struct i2c_client *client)
pm_runtime_set_autosuspend_delay(&client->dev, 1000); pm_runtime_set_autosuspend_delay(&client->dev, 1000);
pm_runtime_use_autosuspend(&client->dev); pm_runtime_use_autosuspend(&client->dev);
ret = ov2680_s_config(&dev->sd, client->irq, pdata); ret = ov2680_s_config(&sensor->sd, client->irq, pdata);
if (ret) if (ret)
goto out_free; goto out_free;
dev->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; sensor->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
dev->pad.flags = MEDIA_PAD_FL_SOURCE; sensor->pad.flags = MEDIA_PAD_FL_SOURCE;
dev->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR; sensor->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR;
ret = ov2680_init_controls(dev); ret = ov2680_init_controls(sensor);
if (ret) { if (ret) {
ov2680_remove(client); ov2680_remove(client);
return ret; return ret;
} }
ret = media_entity_pads_init(&dev->sd.entity, 1, &dev->pad); ret = media_entity_pads_init(&sensor->sd.entity, 1, &sensor->pad);
if (ret) { if (ret) {
ov2680_remove(client); ov2680_remove(client);
return ret; return ret;
} }
ov2680_fill_format(dev, &dev->mode.fmt, OV2680_NATIVE_WIDTH, OV2680_NATIVE_HEIGHT); ov2680_fill_format(sensor, &sensor->mode.fmt, OV2680_NATIVE_WIDTH, OV2680_NATIVE_HEIGHT);
ret = atomisp_register_i2c_module(&dev->sd, pdata, RAW_CAMERA); ret = atomisp_register_i2c_module(&sensor->sd, pdata, RAW_CAMERA);
if (ret) { if (ret) {
ov2680_remove(client); ov2680_remove(client);
return ret; return ret;
...@@ -838,8 +838,8 @@ static int ov2680_probe(struct i2c_client *client) ...@@ -838,8 +838,8 @@ static int ov2680_probe(struct i2c_client *client)
return 0; return 0;
out_free: out_free:
dev_dbg(&client->dev, "+++ out free\n"); dev_dbg(&client->dev, "+++ out free\n");
v4l2_device_unregister_subdev(&dev->sd); v4l2_device_unregister_subdev(&sensor->sd);
kfree(dev); kfree(sensor);
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