Commit 70bbf56a authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Mauro Carvalho Chehab

media: i2c: imx290: Access link_freq_index directly

The imx290_get_link_freq_index() function hides the fact that it relies
on the imx290 current_mode field, which obfuscates the code instead of
making it more readable. Inline it in the callers, and use the mode
pointer we already have in imx290_ctrl_update() instead of using the
current_mode field.
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: default avatarAlexander Stein <alexander.stein@ew.tq-group.com>
Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent a7941da3
...@@ -547,14 +547,9 @@ static int imx290_write_current_format(struct imx290 *imx290) ...@@ -547,14 +547,9 @@ static int imx290_write_current_format(struct imx290 *imx290)
return 0; return 0;
} }
static inline u8 imx290_get_link_freq_index(struct imx290 *imx290)
{
return imx290->current_mode->link_freq_index;
}
static s64 imx290_get_link_freq(struct imx290 *imx290) static s64 imx290_get_link_freq(struct imx290 *imx290)
{ {
u8 index = imx290_get_link_freq_index(imx290); u8 index = imx290->current_mode->link_freq_index;
return *(imx290_link_freqs_ptr(imx290) + index); return *(imx290_link_freqs_ptr(imx290) + index);
} }
...@@ -652,8 +647,7 @@ static void imx290_ctrl_update(struct imx290 *imx290, ...@@ -652,8 +647,7 @@ static void imx290_ctrl_update(struct imx290 *imx290,
if (!imx290->ctrls.lock) if (!imx290->ctrls.lock)
return; return;
__v4l2_ctrl_s_ctrl(imx290->link_freq, __v4l2_ctrl_s_ctrl(imx290->link_freq, mode->link_freq_index);
imx290_get_link_freq_index(imx290));
__v4l2_ctrl_s_ctrl_int64(imx290->pixel_rate, __v4l2_ctrl_s_ctrl_int64(imx290->pixel_rate,
imx290_calc_pixel_rate(imx290)); imx290_calc_pixel_rate(imx290));
......
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