bcm27xx: 6.1: add kernel patches
[openwrt/staging/nbd.git] / target / linux / bcm27xx / patches-6.1 / 950-0634-media-i2c-imx290-Access-link_freq_index-directly.patch
1 From 27404eb8c29cfe1e0d40925f6d628fad8cc5a977 Mon Sep 17 00:00:00 2001
2 From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
3 Date: Mon, 16 Jan 2023 15:44:41 +0100
4 Subject: [PATCH] media: i2c: imx290: Access link_freq_index directly
5
6 Upstream commit 70bbf56aa82c
7
8 The imx290_get_link_freq_index() function hides the fact that it relies
9 on the imx290 current_mode field, which obfuscates the code instead of
10 making it more readable. Inline it in the callers, and use the mode
11 pointer we already have in imx290_ctrl_update() instead of using the
12 current_mode field.
13
14 Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
15 Reviewed-by: Alexander Stein <alexander.stein@ew.tq-group.com>
16 Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
17 Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 ---
19 drivers/media/i2c/imx290.c | 10 ++--------
20 1 file changed, 2 insertions(+), 8 deletions(-)
21
22 --- a/drivers/media/i2c/imx290.c
23 +++ b/drivers/media/i2c/imx290.c
24 @@ -547,14 +547,9 @@ static int imx290_write_current_format(s
25 return 0;
26 }
27
28 -static inline u8 imx290_get_link_freq_index(struct imx290 *imx290)
29 -{
30 - return imx290->current_mode->link_freq_index;
31 -}
32 -
33 static s64 imx290_get_link_freq(struct imx290 *imx290)
34 {
35 - u8 index = imx290_get_link_freq_index(imx290);
36 + u8 index = imx290->current_mode->link_freq_index;
37
38 return *(imx290_link_freqs_ptr(imx290) + index);
39 }
40 @@ -652,8 +647,7 @@ static void imx290_ctrl_update(struct im
41 if (!imx290->ctrls.lock)
42 return;
43
44 - __v4l2_ctrl_s_ctrl(imx290->link_freq,
45 - imx290_get_link_freq_index(imx290));
46 + __v4l2_ctrl_s_ctrl(imx290->link_freq, mode->link_freq_index);
47 __v4l2_ctrl_s_ctrl_int64(imx290->pixel_rate,
48 imx290_calc_pixel_rate(imx290));
49