Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

media: i2c: vd55g1: Use first index of mbus codes array as default

Factorize code and prevent future errors in case of media bus codes
change. Rename VD55G1_DEFAULT_MODE to VD55G1_MODE_DEF to mimic other
macros and reduce vd55g1_update_img_pad_format() name to
vd55g1_update_pad_fmt() to stay within the 80 characters limit.

Signed-off-by: Benjamin Mugnier <benjamin.mugnier@foss.st.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>

authored by

Benjamin Mugnier and committed by
Hans Verkuil
3062098a df2f8fd9

+10 -11
+10 -11
drivers/media/i2c/vd55g1.c
··· 111 111 112 112 #define VD55G1_WIDTH 804 113 113 #define VD55G1_HEIGHT 704 114 - #define VD55G1_DEFAULT_MODE 0 114 + #define VD55G1_MODE_DEF 0 115 115 #define VD55G1_NB_GPIOS 4 116 - #define VD55G1_MEDIA_BUS_FMT_DEF MEDIA_BUS_FMT_Y8_1X8 116 + #define VD55G1_MBUS_CODE_DEF 0 117 117 #define VD55G1_DGAIN_DEF 256 118 118 #define VD55G1_AGAIN_DEF 19 119 119 #define VD55G1_EXPO_MAX_TERM 64 ··· 883 883 return ret; 884 884 } 885 885 886 - static void vd55g1_update_img_pad_format(struct vd55g1 *sensor, 887 - const struct vd55g1_mode *mode, 888 - u32 code, 889 - struct v4l2_mbus_framefmt *fmt) 886 + static void vd55g1_update_pad_fmt(struct vd55g1 *sensor, 887 + const struct vd55g1_mode *mode, u32 code, 888 + struct v4l2_mbus_framefmt *fmt) 890 889 { 891 890 fmt->code = code; 892 891 fmt->width = mode->width; ··· 1228 1229 width, height, sd_fmt->format.width, 1229 1230 sd_fmt->format.height); 1230 1231 1231 - vd55g1_update_img_pad_format(sensor, new_mode, sd_fmt->format.code, 1232 - &sd_fmt->format); 1232 + vd55g1_update_pad_fmt(sensor, new_mode, sd_fmt->format.code, 1233 + &sd_fmt->format); 1233 1234 1234 1235 /* 1235 1236 * Use binning to maximize the crop rectangle size, and centre it in the ··· 1259 1260 static int vd55g1_init_state(struct v4l2_subdev *sd, 1260 1261 struct v4l2_subdev_state *sd_state) 1261 1262 { 1262 - unsigned int def_mode = VD55G1_DEFAULT_MODE; 1263 1263 struct vd55g1 *sensor = to_vd55g1(sd); 1264 1264 struct v4l2_subdev_format fmt = { 0 }; 1265 1265 struct v4l2_subdev_route routes[] = { ··· 1275 1277 if (ret) 1276 1278 return ret; 1277 1279 1278 - vd55g1_update_img_pad_format(sensor, &vd55g1_supported_modes[def_mode], 1279 - VD55G1_MEDIA_BUS_FMT_DEF, &fmt.format); 1280 + vd55g1_update_pad_fmt(sensor, &vd55g1_supported_modes[VD55G1_MODE_DEF], 1281 + vd55g1_mbus_codes[VD55G1_MBUS_CODE_DEF].code, 1282 + &fmt.format); 1280 1283 1281 1284 return vd55g1_set_pad_fmt(sd, sd_state, &fmt); 1282 1285 }