mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 02:50:49 +09:00
media: ov2680: Don't take the lock for try_fmt calls
[ Upstream commite521b9cc1a] On ov2680_set_fmt() calls with format->which == V4L2_SUBDEV_FORMAT_TRY, ov2680_set_fmt() does not talk to the sensor. So in this case there is no need to lock the sensor->lock mutex or to check that the sensor is streaming. Fixes:3ee47cad3e("media: ov2680: Add Omnivision OV2680 sensor driver") Acked-by: Rui Miguel Silva <rmfrfs@gmail.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
e0b6edf4a3
commit
90fbf01c80
@@ -595,24 +595,22 @@ static int ov2680_set_fmt(struct v4l2_subdev *sd,
|
|||||||
if (format->pad != 0)
|
if (format->pad != 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
mutex_lock(&sensor->lock);
|
|
||||||
|
|
||||||
if (sensor->is_streaming) {
|
|
||||||
ret = -EBUSY;
|
|
||||||
goto unlock;
|
|
||||||
}
|
|
||||||
|
|
||||||
mode = v4l2_find_nearest_size(ov2680_mode_data,
|
mode = v4l2_find_nearest_size(ov2680_mode_data,
|
||||||
ARRAY_SIZE(ov2680_mode_data), width,
|
ARRAY_SIZE(ov2680_mode_data), width,
|
||||||
height, fmt->width, fmt->height);
|
height, fmt->width, fmt->height);
|
||||||
if (!mode) {
|
if (!mode)
|
||||||
ret = -EINVAL;
|
return -EINVAL;
|
||||||
goto unlock;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (format->which == V4L2_SUBDEV_FORMAT_TRY) {
|
if (format->which == V4L2_SUBDEV_FORMAT_TRY) {
|
||||||
try_fmt = v4l2_subdev_get_try_format(sd, sd_state, 0);
|
try_fmt = v4l2_subdev_get_try_format(sd, sd_state, 0);
|
||||||
format->format = *try_fmt;
|
format->format = *try_fmt;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
mutex_lock(&sensor->lock);
|
||||||
|
|
||||||
|
if (sensor->is_streaming) {
|
||||||
|
ret = -EBUSY;
|
||||||
goto unlock;
|
goto unlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user