mirror of
				https://github.com/Ysurac/openmptcprouter.git
				synced 2025-03-09 15:40:20 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			49 lines
		
	
	
	
		
			1.7 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
			
		
		
	
	
			49 lines
		
	
	
	
		
			1.7 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
| From b11e67508d3e195d39b0e747a810f806469bcb5b Mon Sep 17 00:00:00 2001
 | |
| From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
 | |
| Date: Mon, 16 Jan 2023 15:44:41 +0100
 | |
| Subject: [PATCH] media: i2c: imx290: Access link_freq_index directly
 | |
| 
 | |
| Upstream commit 70bbf56aa82c
 | |
| 
 | |
| 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: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
 | |
| Reviewed-by: Alexander Stein <alexander.stein@ew.tq-group.com>
 | |
| Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
 | |
| Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
 | |
| ---
 | |
|  drivers/media/i2c/imx290.c | 10 ++--------
 | |
|  1 file changed, 2 insertions(+), 8 deletions(-)
 | |
| 
 | |
| --- a/drivers/media/i2c/imx290.c
 | |
| +++ b/drivers/media/i2c/imx290.c
 | |
| @@ -547,14 +547,9 @@ static int imx290_write_current_format(s
 | |
|  	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)
 | |
|  {
 | |
| -	u8 index = imx290_get_link_freq_index(imx290);
 | |
| +	u8 index = imx290->current_mode->link_freq_index;
 | |
|  
 | |
|  	return *(imx290_link_freqs_ptr(imx290) + index);
 | |
|  }
 | |
| @@ -652,8 +647,7 @@ static void imx290_ctrl_update(struct im
 | |
|  	if (!imx290->ctrls.lock)
 | |
|  		return;
 | |
|  
 | |
| -	__v4l2_ctrl_s_ctrl(imx290->link_freq,
 | |
| -			   imx290_get_link_freq_index(imx290));
 | |
| +	__v4l2_ctrl_s_ctrl(imx290->link_freq, mode->link_freq_index);
 | |
|  	__v4l2_ctrl_s_ctrl_int64(imx290->pixel_rate,
 | |
|  				 imx290_calc_pixel_rate(imx290));
 | |
|  
 |