Commit 3ea1cb24 authored by Stefan Wahren's avatar Stefan Wahren Committed by Greg Kroah-Hartman

staging: bcm2835-camera: reduce indentation in ctrl_set_image_effect

We can reduce the indentation in the loop by using continue in case the
effect doesn't match.
Reviewed-by: default avatarNicolas Saenz Julienne <nsaenzjulienne@suse.de>
Signed-off-by: default avatarStefan Wahren <stefan.wahren@i2se.com>
Link: https://lore.kernel.org/r/1585485901-10172-10-git-send-email-stefan.wahren@i2se.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a60f0c8b
......@@ -514,42 +514,41 @@ static int ctrl_set_image_effect(struct bm2835_mmal_dev *dev,
struct mmal_parameter_imagefx_parameters imagefx;
for (i = 0; i < ARRAY_SIZE(v4l2_to_mmal_effects_values); i++) {
if (ctrl->val == v4l2_to_mmal_effects_values[i].v4l2_effect) {
imagefx.effect =
v4l2_to_mmal_effects_values[i].mmal_effect;
imagefx.num_effect_params =
v4l2_to_mmal_effects_values[i].num_effect_params;
if (imagefx.num_effect_params > MMAL_MAX_IMAGEFX_PARAMETERS)
imagefx.num_effect_params = MMAL_MAX_IMAGEFX_PARAMETERS;
for (j = 0; j < imagefx.num_effect_params; j++)
imagefx.effect_parameter[j] =
v4l2_to_mmal_effects_values[i].effect_params[j];
dev->colourfx.enable =
v4l2_to_mmal_effects_values[i].col_fx_enable;
if (!v4l2_to_mmal_effects_values[i].col_fx_fixed_cbcr) {
dev->colourfx.u =
v4l2_to_mmal_effects_values[i].u;
dev->colourfx.v =
v4l2_to_mmal_effects_values[i].v;
}
if (ctrl->val != v4l2_to_mmal_effects_values[i].v4l2_effect)
continue;
imagefx.effect =
v4l2_to_mmal_effects_values[i].mmal_effect;
imagefx.num_effect_params =
v4l2_to_mmal_effects_values[i].num_effect_params;
control = &dev->component[COMP_CAMERA]->control;
if (imagefx.num_effect_params > MMAL_MAX_IMAGEFX_PARAMETERS)
imagefx.num_effect_params = MMAL_MAX_IMAGEFX_PARAMETERS;
ret = vchiq_mmal_port_parameter_set(
dev->instance, control,
MMAL_PARAMETER_IMAGE_EFFECT_PARAMETERS,
&imagefx, sizeof(imagefx));
if (ret)
goto exit;
for (j = 0; j < imagefx.num_effect_params; j++)
imagefx.effect_parameter[j] =
v4l2_to_mmal_effects_values[i].effect_params[j];
ret = vchiq_mmal_port_parameter_set(
dev->instance, control,
MMAL_PARAMETER_COLOUR_EFFECT,
&dev->colourfx, sizeof(dev->colourfx));
dev->colourfx.enable =
v4l2_to_mmal_effects_values[i].col_fx_enable;
if (!v4l2_to_mmal_effects_values[i].col_fx_fixed_cbcr) {
dev->colourfx.u = v4l2_to_mmal_effects_values[i].u;
dev->colourfx.v = v4l2_to_mmal_effects_values[i].v;
}
control = &dev->component[COMP_CAMERA]->control;
ret = vchiq_mmal_port_parameter_set(
dev->instance, control,
MMAL_PARAMETER_IMAGE_EFFECT_PARAMETERS,
&imagefx, sizeof(imagefx));
if (ret)
goto exit;
ret = vchiq_mmal_port_parameter_set(
dev->instance, control,
MMAL_PARAMETER_COLOUR_EFFECT,
&dev->colourfx, sizeof(dev->colourfx));
}
exit:
......
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