diff options
author | Mauro Carvalho Chehab <mchehab+huawei@kernel.org> | 2020-05-28 10:01:53 +0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+huawei@kernel.org> | 2020-06-11 18:22:56 +0200 |
commit | 41022d35ddf219361f33b59034cc67430a6a590f (patch) | |
tree | 60f0b2296cd252d65f51735ea6ccf71f841a235d /drivers/staging/media/atomisp/pci/camera | |
parent | abbd669dbfbb8c68936b575fe296af3a3184ed3d (diff) | |
download | linux-41022d35ddf219361f33b59034cc67430a6a590f.tar.bz2 |
media: atomisp: get rid of non-Linux error codes
The atomisp driver has its own error codes under the
ia_css_err.h file. On several places, those got already
replaced by standard error codes, but there are still a
lot more to be fixed.
Let's get rid of all of those, mapping them into
the already-existing set of Linux error codes.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'drivers/staging/media/atomisp/pci/camera')
4 files changed, 58 insertions, 58 deletions
diff --git a/drivers/staging/media/atomisp/pci/camera/pipe/interface/ia_css_pipe_binarydesc.h b/drivers/staging/media/atomisp/pci/camera/pipe/interface/ia_css_pipe_binarydesc.h index 551e8d7c5003..844cc70d887b 100644 --- a/drivers/staging/media/atomisp/pci/camera/pipe/interface/ia_css_pipe_binarydesc.h +++ b/drivers/staging/media/atomisp/pci/camera/pipe/interface/ia_css_pipe_binarydesc.h @@ -59,10 +59,10 @@ void ia_css_pipe_get_vfpp_binarydesc( * (= The numerator member in the sh_css_bds_factor structure.) * @param[out] bds_factor_denominator: The denominator of the bayer downscaling factor. * (= The denominator member in the sh_css_bds_factor structure.) - * @return IA_CSS_SUCCESS or error code upon error. + * @return 0 or error code upon error. * */ -enum ia_css_err sh_css_bds_factor_get_numerator_denominator( +int sh_css_bds_factor_get_numerator_denominator( unsigned int bds_factor, unsigned int *bds_factor_numerator, unsigned int *bds_factor_denominator); @@ -75,10 +75,10 @@ enum ia_css_err sh_css_bds_factor_get_numerator_denominator( * @param[in/out] bds_out_info * @param[in/out] out_info * @param[in/out] vf_info - * @return IA_CSS_SUCCESS or error code upon error. + * @return 0 or error code upon error. * */ -enum ia_css_err ia_css_pipe_get_preview_binarydesc( +int ia_css_pipe_get_preview_binarydesc( struct ia_css_pipe *const pipe, struct ia_css_binary_descr *preview_descr, struct ia_css_frame_info *in_info, @@ -93,10 +93,10 @@ enum ia_css_err ia_css_pipe_get_preview_binarydesc( * @param[in/out] in_info * @param[in/out] bds_out_info * @param[in/out] vf_info - * @return IA_CSS_SUCCESS or error code upon error. + * @return 0 or error code upon error. * */ -enum ia_css_err ia_css_pipe_get_video_binarydesc( +int ia_css_pipe_get_video_binarydesc( struct ia_css_pipe *const pipe, struct ia_css_binary_descr *video_descr, struct ia_css_frame_info *in_info, @@ -287,9 +287,9 @@ void ia_css_pipe_get_ldc_binarydesc( * @param[in] input_res * @param[in] output_res * @param[in/out] bds_factor - * @return IA_CSS_SUCCESS or error code upon error. + * @return 0 or error code upon error. */ -enum ia_css_err binarydesc_calculate_bds_factor( +int binarydesc_calculate_bds_factor( struct ia_css_resolution input_res, struct ia_css_resolution output_res, unsigned int *bds_factor); diff --git a/drivers/staging/media/atomisp/pci/camera/pipe/src/pipe_binarydesc.c b/drivers/staging/media/atomisp/pci/camera/pipe/src/pipe_binarydesc.c index c6b07d65ce3e..935874c35073 100644 --- a/drivers/staging/media/atomisp/pci/camera/pipe/src/pipe_binarydesc.c +++ b/drivers/staging/media/atomisp/pci/camera/pipe/src/pipe_binarydesc.c @@ -141,7 +141,7 @@ static struct sh_css_bds_factor bds_factors_list[] = { {8, 1, SH_CSS_BDS_FACTOR_8_00} }; -enum ia_css_err sh_css_bds_factor_get_numerator_denominator( +int sh_css_bds_factor_get_numerator_denominator( unsigned int bds_factor, unsigned int *bds_factor_numerator, unsigned int *bds_factor_denominator) @@ -153,16 +153,16 @@ enum ia_css_err sh_css_bds_factor_get_numerator_denominator( if (bds_factors_list[i].bds_factor == bds_factor) { *bds_factor_numerator = bds_factors_list[i].numerator; *bds_factor_denominator = bds_factors_list[i].denominator; - return IA_CSS_SUCCESS; + return 0; } } /* Throw an error since bds_factor cannot be found in bds_factors_list */ - return IA_CSS_ERR_INVALID_ARGUMENTS; + return -EINVAL; } -enum ia_css_err binarydesc_calculate_bds_factor( +int binarydesc_calculate_bds_factor( struct ia_css_resolution input_res, struct ia_css_resolution output_res, unsigned int *bds_factor) @@ -195,15 +195,15 @@ enum ia_css_err binarydesc_calculate_bds_factor( if (cond) { *bds_factor = bds_factors_list[i].bds_factor; - return IA_CSS_SUCCESS; + return 0; } } /* Throw an error since a suitable bds_factor cannot be found */ - return IA_CSS_ERR_INVALID_ARGUMENTS; + return -EINVAL; } -enum ia_css_err ia_css_pipe_get_preview_binarydesc( +int ia_css_pipe_get_preview_binarydesc( struct ia_css_pipe *const pipe, struct ia_css_binary_descr *preview_descr, struct ia_css_frame_info *in_info, @@ -211,7 +211,7 @@ enum ia_css_err ia_css_pipe_get_preview_binarydesc( struct ia_css_frame_info *out_info, struct ia_css_frame_info *vf_info) { - enum ia_css_err err; + int err; struct ia_css_frame_info *out_infos[IA_CSS_BINARY_MAX_OUTPUT_PORTS]; int mode = IA_CSS_BINARY_MODE_PREVIEW; unsigned int i; @@ -264,7 +264,7 @@ enum ia_css_err ia_css_pipe_get_preview_binarydesc( binarydesc_calculate_bds_factor(in_info->res, bds_out_info->res, &preview_descr->required_bds_factor); - if (err != IA_CSS_SUCCESS) + if (err) return err; } else { bds_out_info->res.width = in_info->res.width / 2; @@ -318,11 +318,11 @@ enum ia_css_err ia_css_pipe_get_preview_binarydesc( preview_descr->enable_dpc = pipe->config.enable_dpc; preview_descr->isp_pipe_version = pipe->config.isp_pipe_version; - IA_CSS_LEAVE_ERR_PRIVATE(IA_CSS_SUCCESS); - return IA_CSS_SUCCESS; + IA_CSS_LEAVE_ERR_PRIVATE(0); + return 0; } -enum ia_css_err ia_css_pipe_get_video_binarydesc( +int ia_css_pipe_get_video_binarydesc( struct ia_css_pipe *const pipe, struct ia_css_binary_descr *video_descr, struct ia_css_frame_info *in_info, @@ -334,7 +334,7 @@ enum ia_css_err ia_css_pipe_get_video_binarydesc( int mode = IA_CSS_BINARY_MODE_VIDEO; unsigned int i; struct ia_css_frame_info *out_infos[IA_CSS_BINARY_MAX_OUTPUT_PORTS]; - enum ia_css_err err = IA_CSS_SUCCESS; + int err = 0; bool stream_dz_config = false; /* vf_info can be NULL */ @@ -407,7 +407,7 @@ enum ia_css_err ia_css_pipe_get_video_binarydesc( binarydesc_calculate_bds_factor( in_info->res, bds_out_info->res, &video_descr->required_bds_factor); - if (err != IA_CSS_SUCCESS) + if (err) return err; } else { bds_out_info->res.width = diff --git a/drivers/staging/media/atomisp/pci/camera/util/interface/ia_css_util.h b/drivers/staging/media/atomisp/pci/camera/util/interface/ia_css_util.h index 75333166ed9b..80ad3e064654 100644 --- a/drivers/staging/media/atomisp/pci/camera/util/interface/ia_css_util.h +++ b/drivers/staging/media/atomisp/pci/camera/util/interface/ia_css_util.h @@ -28,26 +28,26 @@ * @return "ia_css_err" error code * */ -enum ia_css_err ia_css_convert_errno( +int ia_css_convert_errno( int in_err); /* @brief check vf frame info. * * @param[in] info - * @return IA_CSS_SUCCESS or error code upon error. + * @return 0 or error code upon error. * */ -enum ia_css_err ia_css_util_check_vf_info( +int ia_css_util_check_vf_info( const struct ia_css_frame_info *const info); /* @brief check input configuration. * * @param[in] stream_config * @param[in] must_be_raw - * @return IA_CSS_SUCCESS or error code upon error. + * @return 0 or error code upon error. * */ -enum ia_css_err ia_css_util_check_input( +int ia_css_util_check_input( const struct ia_css_stream_config *const stream_config, bool must_be_raw, bool must_be_yuv); @@ -56,10 +56,10 @@ enum ia_css_err ia_css_util_check_input( * * @param[in] out_info * @param[in] vf_info - * @return IA_CSS_SUCCESS or error code upon error. + * @return 0 or error code upon error. * */ -enum ia_css_err ia_css_util_check_vf_out_info( +int ia_css_util_check_vf_out_info( const struct ia_css_frame_info *const out_info, const struct ia_css_frame_info *const vf_info); @@ -67,10 +67,10 @@ enum ia_css_err ia_css_util_check_vf_out_info( * * @param[in] width * @param[in] height - * @return IA_CSS_SUCCESS or error code upon error. + * @return 0 or error code upon error. * */ -enum ia_css_err ia_css_util_check_res( +int ia_css_util_check_res( unsigned int width, unsigned int height); diff --git a/drivers/staging/media/atomisp/pci/camera/util/src/util.c b/drivers/staging/media/atomisp/pci/camera/util/src/util.c index 217fe9cb54ff..3ca79b23da70 100644 --- a/drivers/staging/media/atomisp/pci/camera/util/src/util.c +++ b/drivers/staging/media/atomisp/pci/camera/util/src/util.c @@ -20,30 +20,30 @@ /* for ia_css_binary_max_vf_width() */ #include "ia_css_binary.h" -enum ia_css_err ia_css_convert_errno( +int ia_css_convert_errno( int in_err) { - enum ia_css_err out_err; + int out_err; switch (in_err) { case 0: - out_err = IA_CSS_SUCCESS; + out_err = 0; break; case EINVAL: - out_err = IA_CSS_ERR_INVALID_ARGUMENTS; + out_err = -EINVAL; break; case ENODATA: - out_err = IA_CSS_ERR_QUEUE_IS_EMPTY; + out_err = -ENODATA; break; case ENOSYS: case ENOTSUP: - out_err = IA_CSS_ERR_INTERNAL_ERROR; + out_err = -EINVAL; break; case ENOBUFS: - out_err = IA_CSS_ERR_QUEUE_IS_FULL; + out_err = -ENOBUFS; break; default: - out_err = IA_CSS_ERR_INTERNAL_ERROR; + out_err = -EINVAL; break; } return out_err; @@ -113,49 +113,49 @@ unsigned int ia_css_util_input_format_bpp( return rval; } -enum ia_css_err ia_css_util_check_vf_info( +int ia_css_util_check_vf_info( const struct ia_css_frame_info *const info) { - enum ia_css_err err; + int err; unsigned int max_vf_width; assert(info); err = ia_css_frame_check_info(info); - if (err != IA_CSS_SUCCESS) + if (err) return err; max_vf_width = ia_css_binary_max_vf_width(); if (max_vf_width != 0 && info->res.width > max_vf_width * 2) - return IA_CSS_ERR_INVALID_ARGUMENTS; - return IA_CSS_SUCCESS; + return -EINVAL; + return 0; } -enum ia_css_err ia_css_util_check_vf_out_info( +int ia_css_util_check_vf_out_info( const struct ia_css_frame_info *const out_info, const struct ia_css_frame_info *const vf_info) { - enum ia_css_err err; + int err; assert(out_info); assert(vf_info); err = ia_css_frame_check_info(out_info); - if (err != IA_CSS_SUCCESS) + if (err) return err; err = ia_css_util_check_vf_info(vf_info); - if (err != IA_CSS_SUCCESS) + if (err) return err; - return IA_CSS_SUCCESS; + return 0; } -enum ia_css_err ia_css_util_check_res(unsigned int width, unsigned int height) +int ia_css_util_check_res(unsigned int width, unsigned int height) { /* height can be odd number for jpeg/embedded data from ISYS2401 */ if (((width == 0) || (height == 0) || IS_ODD(width))) { - return IA_CSS_ERR_INVALID_ARGUMENTS; + return -EINVAL; } - return IA_CSS_SUCCESS; + return 0; } /* ISP2401 */ @@ -200,7 +200,7 @@ bool ia_css_util_is_input_format_yuv(enum atomisp_input_format format) format == ATOMISP_INPUT_FORMAT_YUV422_16; } -enum ia_css_err ia_css_util_check_input( +int ia_css_util_check_input( const struct ia_css_stream_config *const stream_config, bool must_be_raw, bool must_be_yuv) @@ -208,18 +208,18 @@ enum ia_css_err ia_css_util_check_input( assert(stream_config); if (!stream_config) - return IA_CSS_ERR_INVALID_ARGUMENTS; + return -EINVAL; if (stream_config->input_config.effective_res.width == 0 || stream_config->input_config.effective_res.height == 0) - return IA_CSS_ERR_INVALID_ARGUMENTS; + return -EINVAL; if (must_be_raw && !ia_css_util_is_input_format_raw(stream_config->input_config.format)) - return IA_CSS_ERR_INVALID_ARGUMENTS; + return -EINVAL; if (must_be_yuv && !ia_css_util_is_input_format_yuv(stream_config->input_config.format)) - return IA_CSS_ERR_INVALID_ARGUMENTS; + return -EINVAL; - return IA_CSS_SUCCESS; + return 0; } |