staging: vc04_services: Re-use generic struct s32_fract
Subsystems (3)
PATCH 1/1 staging: vc04_services: Re-use generic struct s32_fract
Instead of custom data type re-use generic struct s32_fract. No changes intended.
--- .../bcm2835-camera/bcm2835-camera.c | 24 +++++++------- .../vc04_services/bcm2835-camera/controls.c | 33 ++++++++++--------- .../vchiq-mmal/mmal-msg-common.h | 7 ++-- .../vchiq-mmal/mmal-msg-format.h | 6 ++-- .../vchiq-mmal/mmal-parameters.h | 15 ++++----- .../vc04_services/vchiq-mmal/mmal-vchiq.c | 10 +++--- 6 files changed, 46 insertions(+), 49 deletions(-)
drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c +12 -12
@@ -1033,9 +1033,9 @@ static int mmal_setup_video_component(struct bcm2835_mmal_dev *dev, preview_port->es.video.crop.y =0 ; preview_port->es.video.crop.width = f->fmt.pix.width; preview_port->es.video.crop.height = f->fmt.pix.height; - preview_port->es.video.frame_rate.num = + preview_port->es.video.frame_rate.numerator = dev->capture.timeperframe.denominator; - preview_port->es.video.frame_rate.den = + preview_port->es.video.frame_rate.denominator = dev->capture.timeperframe.numerator; ret =vchiq_mmal_port_set_format (dev->instance, preview_port);
@@ -1084,9 +1084,9 @@ static int mmal_setup_encode_component(struct bcm2835_mmal_dev *dev, port->es.video.crop.y =0 ; port->es.video.crop.width = f->fmt.pix.width; port->es.video.crop.height = f->fmt.pix.height; - port->es.video.frame_rate.num = + port->es.video.frame_rate.numerator = dev->capture.timeperframe.denominator; - port->es.video.frame_rate.den = + port->es.video.frame_rate.denominator = dev->capture.timeperframe.numerator; port->format.encoding = mfmt->mmal;
@@ -1225,8 +1225,8 @@ static int mmal_setup_components(struct bcm2835_mmal_dev *dev, camera_port->es.video.crop.y =0 ; camera_port->es.video.crop.width = f->fmt.pix.width; camera_port->es.video.crop.height = f->fmt.pix.height; - camera_port->es.video.frame_rate.num =0 ; - camera_port->es.video.frame_rate.den =1 ; + camera_port->es.video.frame_rate.numerator =0 ; + camera_port->es.video.frame_rate.denominator =1 ; camera_port->es.video.color_space =MMAL_COLOR_SPACE_JPEG_JFIF ; ret =vchiq_mmal_port_set_format (dev->instance, camera_port);
@@ -1629,8 +1629,8 @@ static int mmal_init(struct bcm2835_mmal_dev *dev) format->es->video.crop.y =0 ; format->es->video.crop.width =1024 ; format->es->video.crop.height =768 ; - format->es->video.frame_rate.num =0 ;/* Rely on fps_range */ - format->es->video.frame_rate.den =1 ; + format->es->video.frame_rate.numerator =0 ;/* Rely on fps_range */ + format->es->video.frame_rate.denominator =1 ; format = &camera->output[CAM_PORT_VIDEO ].format;
@@ -1643,8 +1643,8 @@ static int mmal_init(struct bcm2835_mmal_dev *dev) format->es->video.crop.y =0 ; format->es->video.crop.width =1024 ; format->es->video.crop.height =768 ; - format->es->video.frame_rate.num =0 ;/* Rely on fps_range */ - format->es->video.frame_rate.den =1 ; + format->es->video.frame_rate.numerator =0 ;/* Rely on fps_range */ + format->es->video.frame_rate.denominator =1 ; format = &camera->output[CAM_PORT_CAPTURE ].format;
@@ -1656,8 +1656,8 @@ static int mmal_init(struct bcm2835_mmal_dev *dev) format->es->video.crop.y =0 ; format->es->video.crop.width =2592 ; format->es->video.crop.height =1944 ; - format->es->video.frame_rate.num =0 ;/* Rely on fps_range */ - format->es->video.frame_rate.den =1 ; + format->es->video.frame_rate.numerator =0 ;/* Rely on fps_range */ + format->es->video.frame_rate.denominator =1 ; dev->capture.width = format->es->video.width; dev->capture.height = format->es->video.height;
drivers/staging/vc04_services/bcm2835-camera/controls.c +17 -16
@@ -154,13 +154,13 @@ static int ctrl_set_rational(struct bcm2835_mmal_dev *dev,struct v4l2_ctrl *ctrl, const struct bcm2835_mmal_v4l2_ctrl *mmal_ctrl) { - struct mmal_parameter_rational rational_value; + struct s32_fract rational_value;struct vchiq_mmal_port *control; control = &dev->component[COMP_CAMERA ]->control; - rational_value.num = ctrl->val; - rational_value.den =100 ; + rational_value.numumerator = ctrl->val; + rational_value.denominator =100 ; return vchiq_mmal_port_parameter_set(dev->instance, control, mmal_ctrl->mmal_id,
@@ -489,9 +489,10 @@ static int ctrl_set_awb_gains(struct bcm2835_mmal_dev *dev,else if (ctrl->id ==V4L2_CID_BLUE_BALANCE ) dev->blue_gain = ctrl->val; - gains.r_gain.num = dev->red_gain; - gains.b_gain.num = dev->blue_gain; - gains.r_gain.den = gains.b_gain.den =1000 ; + gains.r_gain.numerator = dev->red_gain; + gains.r_gain.denominator =1000 ; + gains.b_gain.numerator = dev->blue_gain; + gains.b_gain.denominator =1000 ; return vchiq_mmal_port_parameter_set(dev->instance, control, mmal_ctrl->mmal_id,
@@ -1271,26 +1272,26 @@ int set_framerate_params(struct bcm2835_mmal_dev *dev)struct mmal_parameter_fps_range fps_range;int ret; - fps_range.fps_high.num = dev->capture.timeperframe.denominator; - fps_range.fps_high.den = dev->capture.timeperframe.numerator; + fps_range.fps_high.numerator = dev->capture.timeperframe.denominator; + fps_range.fps_high.denominator = dev->capture.timeperframe.numerator;if ((dev->exposure_mode_active !=MMAL_PARAM_EXPOSUREMODE_OFF ) && (dev->exp_auto_priority)) {/* Variable FPS. Define min FPS as 1fps. */ - fps_range.fps_low.num =1 ; - fps_range.fps_low.den =1 ; + fps_range.fps_low.numerator =1 ; + fps_range.fps_low.denominator =1 ; }else {/* Fixed FPS - set min and max to be the same */ - fps_range.fps_low.num = fps_range.fps_high.num; - fps_range.fps_low.den = fps_range.fps_high.den; + fps_range.fps_low.numerator = fps_range.fps_high.numerator; + fps_range.fps_low.denominator = fps_range.fps_high.denominator; }v4l2_dbg (1 , bcm2835_v4l2_debug, &dev->v4l2_dev,"Set fps range to %d/%d to %d/%d\n" , - fps_range.fps_low.num, - fps_range.fps_low.den, - fps_range.fps_high.num, - fps_range.fps_high.den); + fps_range.fps_low.numerator, + fps_range.fps_low.denominator, + fps_range.fps_high.numerator, + fps_range.fps_high.denominator); ret = vchiq_mmal_port_parameter_set(dev->instance, &dev->component[COMP_CAMERA]->output[CAM_PORT_PREVIEW],
drivers/staging/vc04_services/vchiq-mmal/mmal-msg-common.h +2 -5
@@ -14,6 +14,8 @@#ifndef MMAL_MSG_COMMON_H #define MMAL_MSG_COMMON_H +#include <linux/types.h> +enum mmal_msg_status {MMAL_MSG_STATUS_SUCCESS =0 ,/**< Success */ MMAL_MSG_STATUS_ENOMEM, /**< Out of memory */
@@ -40,9 +42,4 @@ struct mmal_rect { s32 height; /**< height */ }; -struct mmal_rational { -s32 num;/**< Numerator */ -s32 den;/**< Denominator */ -}; -#endif /* MMAL_MSG_COMMON_H */
drivers/staging/vc04_services/vchiq-mmal/mmal-msg-format.h +4 -2
@@ -14,6 +14,8 @@#ifndef MMAL_MSG_FORMAT_H #define MMAL_MSG_FORMAT_H +#include <linux/math.h> +#include "mmal-msg-common.h" /* MMAL_ES_FORMAT_T */
@@ -30,8 +32,8 @@ struct mmal_video_format {u32 width;/* Width of frame in pixels */ u32 height;/* Height of frame in rows of pixels */ struct mmal_rect crop;/* Visible region of the frame */ -struct mmal_rational frame_rate;/* Frame rate */ -struct mmal_rational par;/* Pixel aspect ratio */ +struct s32_fract frame_rate;/* Frame rate */ +struct s32_fract par;/* Pixel aspect ratio */ /* * FourCC specifying the color space of the video stream. See the
drivers/staging/vc04_services/vchiq-mmal/mmal-parameters.h +6 -9
@@ -22,6 +22,8 @@#ifndef MMAL_PARAMETERS_H #define MMAL_PARAMETERS_H +#include <linux/math.h> +/** Common parameter ID group, used with many types of component. */ #define MMAL_PARAMETER_GROUP_COMMON (0 << 16)/** Camera-specific parameter ID group. */
@@ -223,11 +225,6 @@ enum mmal_parameter_camera_type { MMAL_PARAMETER_CUSTOM_AWB_GAINS, }; -struct mmal_parameter_rational { -s32 num;/**< Numerator */ -s32 den;/**< Denominator */ -}; -enum mmal_parameter_camera_config_timestamp_mode {MMAL_PARAM_TIMESTAMP_MODE_ZERO =0 ,/* Always timestamp frames as 0 */ MMAL_PARAM_TIMESTAMP_MODE_RAW_STC ,/* Use the raw STC value
@@ -243,9 +240,9 @@ enum mmal_parameter_camera_config_timestamp_mode {struct mmal_parameter_fps_range {/**< Low end of the permitted framerate range */ -struct mmal_parameter_rational fps_low; +struct s32_fract fps_low;/**< High end of the permitted framerate range */ -struct mmal_parameter_rational fps_high; +struct s32_fract fps_high; };/* camera configuration parameter */
@@ -350,8 +347,8 @@ enum MMAL_PARAM_FLICKERAVOID { };struct mmal_parameter_awbgains { -struct mmal_parameter_rational r_gain;/**< Red gain */ -struct mmal_parameter_rational b_gain;/**< Blue gain */ +struct s32_fract r_gain;/**< Red gain */ +struct s32_fract b_gain;/**< Blue gain */ };/** Manner of video rate control */
drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +5 -5
@@ -744,9 +744,9 @@ static void dump_port_info(struct vchiq_mmal_port *port) port->es.video.crop.y, port->es.video.crop.width, port->es.video.crop.height);pr_debug (" : framerate %d/%d aspect %d/%d\n" , - port->es.video.frame_rate.num, - port->es.video.frame_rate.den, - port->es.video.par.num, port->es.video.par.den); + port->es.video.frame_rate.numerator, + port->es.video.frame_rate.denominator, + port->es.video.par.numerator, port->es.video.par.denominator); } }
@@ -1549,8 +1549,8 @@ int vchiq_mmal_port_connect_tunnel(struct vchiq_mmal_instance *instance, dst->es.video.crop.y = src->es.video.crop.y; dst->es.video.crop.width = src->es.video.crop.width; dst->es.video.crop.height = src->es.video.crop.height; - dst->es.video.frame_rate.num = src->es.video.frame_rate.num; - dst->es.video.frame_rate.den = src->es.video.frame_rate.den; + dst->es.video.frame_rate.numerator = src->es.video.frame_rate.numerator; + dst->es.video.frame_rate.denominator = src->es.video.frame_rate.denominator;/* set new format */ ret =port_info_set (instance, dst);
Signature · 1 line
2.35.1
kernel test robot
build botI love your patch! Yet something to improve:
Hi Andy,
I love your patch! Yet something to improve:
[auto build test ERROR on staging/staging-testing]
url: https://github.com/intel-lab-lkp/linux/commits/Andy-Shevchenko/staging-vc04_services-Re-use-generic-struct-s32_fract/20220502-200543 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 5fe7856ad59afc56a6ff35d091bfaddd1d4f4bce config: arc-allyesconfig (https://download.01.org/0day-ci/archive/20220502/[email protected]/config) compiler: arceb-elf-gcc (GCC) 11.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/c0fbdbd092e007c2567a367389e86df9d1cd7ee3
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Andy-Shevchenko/staging-vc04_services-Re-use-generic-struct-s32_fract/20220502-200543 git checkout c0fbdbd092e007c2567a367389e86df9d1cd7ee3
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=arc SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
drivers/staging/vc04_services/bcm2835-camera/controls.c: In function 'ctrl_set_rational':
>> drivers/staging/vc04_services/bcm2835-camera/controls.c:162:24: error: 'struct s32_fract' has no member named 'numumerator'; did you mean 'numerator'?
162 | rational_value.numumerator = ctrl->val;
| ^~~~~~~~~~~
| numeratorvim +162 drivers/staging/vc04_services/bcm2835-camera/controls.c
152
153 static int ctrl_set_rational(struct bcm2835_mmal_dev *dev,
154 struct v4l2_ctrl *ctrl,
155 const struct bcm2835_mmal_v4l2_ctrl *mmal_ctrl)
156 {
157 struct s32_fract rational_value;
158 struct vchiq_mmal_port *control;
159
160 control = &dev->component[COMP_CAMERA]->control;
161
> 162 rational_value.numumerator = ctrl->val; 163 rational_value.denominator = 100; 164 165 return vchiq_mmal_port_parameter_set(dev->instance, control, 166 mmal_ctrl->mmal_id, 167 &rational_value, 168 sizeof(rational_value));
169 }
170
Signature · 2 lines
0-DAY CI Kernel Test Service https://01.org/lkp
kernel test robot
build botI love your patch! Yet something to improve:
Hi Andy,
I love your patch! Yet something to improve:
[auto build test ERROR on staging/staging-testing]
url: https://github.com/intel-lab-lkp/linux/commits/Andy-Shevchenko/staging-vc04_services-Re-use-generic-struct-s32_fract/20220502-200543 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 5fe7856ad59afc56a6ff35d091bfaddd1d4f4bce config: hexagon-randconfig-r041-20220502 (https://download.01.org/0day-ci/archive/20220503/[email protected]/config) compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 09325d36061e42b495d1f4c7e933e260eac260ed)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/c0fbdbd092e007c2567a367389e86df9d1cd7ee3
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Andy-Shevchenko/staging-vc04_services-Re-use-generic-struct-s32_fract/20220502-200543
git checkout c0fbdbd092e007c2567a367389e86df9d1cd7ee3
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/staging/vc04_services/bcm2835-camera/
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
>> drivers/staging/vc04_services/bcm2835-camera/controls.c:162:17: error: no member named 'numumerator' in 'struct s32_fract'; did you mean 'numerator'?
rational_value.numumerator = ctrl->val;
^~~~~~~~~~~
numerator
include/linux/math.h:117:1: note: 'numerator' declared here
__STRUCT_FRACT(s32)
^
include/linux/math.h:112:11: note: expanded from macro '__STRUCT_FRACT'
__##type numerator; \
^1 error generated.
vim +162 drivers/staging/vc04_services/bcm2835-camera/controls.c
152
153 static int ctrl_set_rational(struct bcm2835_mmal_dev *dev,
154 struct v4l2_ctrl *ctrl,
155 const struct bcm2835_mmal_v4l2_ctrl *mmal_ctrl)
156 {
157 struct s32_fract rational_value;
158 struct vchiq_mmal_port *control;
159
160 control = &dev->component[COMP_CAMERA]->control;
161
> 162 rational_value.numumerator = ctrl->val; 163 rational_value.denominator = 100; 164 165 return vchiq_mmal_port_parameter_set(dev->instance, control, 166 mmal_ctrl->mmal_id, 167 &rational_value, 168 sizeof(rational_value));
169 }
170
Signature · 2 lines
0-DAY CI Kernel Test Service https://01.org/lkp