diff options
author | Hans de Goede <hdegoede@redhat.com> | 2023-05-29 11:37:23 +0100 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@kernel.org> | 2023-06-09 15:23:02 +0100 |
commit | b0e880e4a85b87b68a76391cdfd1046f024386ef (patch) | |
tree | a201595b7a0ff0e087b07237f46f9e6d8ba076b7 | |
parent | 19cdcf676355a93a139113d3008112c895915cfc (diff) | |
download | linux-b0e880e4a85b87b68a76391cdfd1046f024386ef.tar.gz linux-b0e880e4a85b87b68a76391cdfd1046f024386ef.tar.bz2 linux-b0e880e4a85b87b68a76391cdfd1046f024386ef.zip |
media: atomisp: ov2680: s/input_lock/lock/
s/input_lock/lock/ lock is used by the generic drivers/media/i2c/ov2680.c
driver. Bring the atomisp ov2680 code inline to make it easier to port
changes between the two, with the end goal of getting rid of
the atomisp specific version.
Link: https://lore.kernel.org/r/20230529103741.11904-4-hdegoede@redhat.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
-rw-r--r-- | drivers/staging/media/atomisp/i2c/atomisp-ov2680.c | 16 | ||||
-rw-r--r-- | drivers/staging/media/atomisp/i2c/ov2680.h | 3 |
2 files changed, 10 insertions, 9 deletions
diff --git a/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c b/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c index 2e9a4792a7b2..cf3f9649928a 100644 --- a/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c +++ b/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c @@ -337,9 +337,9 @@ static int ov2680_set_fmt(struct v4l2_subdev *sd, if (format->which == V4L2_SUBDEV_FORMAT_TRY) return 0; - mutex_lock(&sensor->input_lock); + mutex_lock(&sensor->lock); ov2680_calc_mode(sensor, fmt->width, fmt->height); - mutex_unlock(&sensor->input_lock); + mutex_unlock(&sensor->lock); return 0; } @@ -394,7 +394,7 @@ static int ov2680_s_stream(struct v4l2_subdev *sd, int enable) struct i2c_client *client = v4l2_get_subdevdata(sd); int ret = 0; - mutex_lock(&sensor->input_lock); + mutex_lock(&sensor->lock); if (sensor->is_streaming == enable) { dev_warn(&client->dev, "stream already %s\n", enable ? "started" : "stopped"); @@ -427,14 +427,14 @@ static int ov2680_s_stream(struct v4l2_subdev *sd, int enable) v4l2_ctrl_activate(sensor->ctrls.vflip, !enable); v4l2_ctrl_activate(sensor->ctrls.hflip, !enable); - mutex_unlock(&sensor->input_lock); + mutex_unlock(&sensor->lock); return 0; error_power_down: pm_runtime_put(sensor->sd.dev); sensor->is_streaming = false; error_unlock: - mutex_unlock(&sensor->input_lock); + mutex_unlock(&sensor->lock); return ret; } @@ -564,7 +564,7 @@ static int ov2680_init_controls(struct ov2680_dev *sensor) v4l2_ctrl_handler_init(hdl, 4); - hdl->lock = &sensor->input_lock; + hdl->lock = &sensor->lock; ctrls->hflip = v4l2_ctrl_new_std(hdl, ops, V4L2_CID_HFLIP, 0, 1, 1, 0); ctrls->vflip = v4l2_ctrl_new_std(hdl, ops, V4L2_CID_VFLIP, 0, 1, 1, 0); @@ -597,7 +597,7 @@ static void ov2680_remove(struct i2c_client *client) v4l2_async_unregister_subdev(&sensor->sd); media_entity_cleanup(&sensor->sd.entity); v4l2_ctrl_handler_free(&sensor->ctrls.handler); - mutex_destroy(&sensor->input_lock); + mutex_destroy(&sensor->lock); fwnode_handle_put(sensor->ep_fwnode); pm_runtime_disable(&client->dev); } @@ -612,7 +612,7 @@ static int ov2680_probe(struct i2c_client *client) if (!sensor) return -ENOMEM; - mutex_init(&sensor->input_lock); + mutex_init(&sensor->lock); sensor->client = client; v4l2_i2c_subdev_init(&sensor->sd, client, &ov2680_ops); diff --git a/drivers/staging/media/atomisp/i2c/ov2680.h b/drivers/staging/media/atomisp/i2c/ov2680.h index 077ca6ee08b6..4bcdd9fd0ce7 100644 --- a/drivers/staging/media/atomisp/i2c/ov2680.h +++ b/drivers/staging/media/atomisp/i2c/ov2680.h @@ -109,7 +109,8 @@ struct ov2680_dev { struct v4l2_subdev sd; struct media_pad pad; - struct mutex input_lock; + /* Protect against concurrent changes to controls */ + struct mutex lock; struct i2c_client *client; struct gpio_desc *powerdown; struct fwnode_handle *ep_fwnode; |