media: atomisp: add return codes for pipeline config functions
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Fri, 5 Nov 2021 16:29:14 +0000 (16:29 +0000)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mon, 15 Nov 2021 08:11:51 +0000 (08:11 +0000)
Those functions can internally break, but, as they don't return
errors, internally there are some assert() calls, which is bad,
as it hangs the driver.

So, add return codes there, in preparation for removing such
assert() calls.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
23 files changed:
drivers/staging/media/atomisp/pci/isp/kernels/crop/crop_1.0/ia_css_crop.host.c
drivers/staging/media/atomisp/pci/isp/kernels/crop/crop_1.0/ia_css_crop.host.h
drivers/staging/media/atomisp/pci/isp/kernels/fpn/fpn_1.0/ia_css_fpn.host.c
drivers/staging/media/atomisp/pci/isp/kernels/fpn/fpn_1.0/ia_css_fpn.host.h
drivers/staging/media/atomisp/pci/isp/kernels/ipu2_io_ls/bayer_io_ls/ia_css_bayer_io.host.c
drivers/staging/media/atomisp/pci/isp/kernels/ipu2_io_ls/bayer_io_ls/ia_css_bayer_io.host.h
drivers/staging/media/atomisp/pci/isp/kernels/ipu2_io_ls/yuv444_io_ls/ia_css_yuv444_io.host.c
drivers/staging/media/atomisp/pci/isp/kernels/ipu2_io_ls/yuv444_io_ls/ia_css_yuv444_io.host.h
drivers/staging/media/atomisp/pci/isp/kernels/output/output_1.0/ia_css_output.host.c
drivers/staging/media/atomisp/pci/isp/kernels/output/output_1.0/ia_css_output.host.h
drivers/staging/media/atomisp/pci/isp/kernels/qplane/qplane_2/ia_css_qplane.host.c
drivers/staging/media/atomisp/pci/isp/kernels/qplane/qplane_2/ia_css_qplane.host.h
drivers/staging/media/atomisp/pci/isp/kernels/raw/raw_1.0/ia_css_raw.host.c
drivers/staging/media/atomisp/pci/isp/kernels/raw/raw_1.0/ia_css_raw.host.h
drivers/staging/media/atomisp/pci/isp/kernels/ref/ref_1.0/ia_css_ref.host.c
drivers/staging/media/atomisp/pci/isp/kernels/ref/ref_1.0/ia_css_ref.host.h
drivers/staging/media/atomisp/pci/isp/kernels/tnr/tnr_1.0/ia_css_tnr.host.c
drivers/staging/media/atomisp/pci/isp/kernels/tnr/tnr_1.0/ia_css_tnr.host.h
drivers/staging/media/atomisp/pci/isp/kernels/vf/vf_1.0/ia_css_vf.host.c
drivers/staging/media/atomisp/pci/isp/kernels/vf/vf_1.0/ia_css_vf.host.h
drivers/staging/media/atomisp/pci/runtime/frame/interface/ia_css_frame.h
drivers/staging/media/atomisp/pci/runtime/frame/src/frame.c
drivers/staging/media/atomisp/pci/sh_css_sp.c

index 8ab0604b364a05c4b69c04fed9d567b366318959..69b1c493e020d551bfd45cb3c401a19592b33318 100644 (file)
@@ -36,11 +36,9 @@ ia_css_crop_encode(
        to->crop_pos = from->crop_pos;
 }
 
-void
-ia_css_crop_config(
-    struct sh_css_isp_crop_isp_config *to,
-    const struct ia_css_crop_configuration  *from,
-    unsigned int size)
+int ia_css_crop_config(struct sh_css_isp_crop_isp_config *to,
+                      const struct ia_css_crop_configuration *from,
+                      unsigned int size)
 {
        unsigned int elems_a = ISP_VEC_NELEMS;
 
@@ -50,6 +48,7 @@ ia_css_crop_config(
 
        /* Assume divisiblity here, may need to generalize to fixed point. */
        assert(elems_a % to->port_b.elems == 0);
+       return 0;
 }
 
 int ia_css_crop_configure(const struct ia_css_binary     *binary,
index 877601bfa7c0b84a7207f3a274d1b9bf50079456..e700149c1e95fb71cc8e2ba0911f67749ad2fd2a 100644 (file)
@@ -28,11 +28,9 @@ ia_css_crop_encode(
     const struct ia_css_crop_config *from,
     unsigned int size);
 
-void
-ia_css_crop_config(
-    struct sh_css_isp_crop_isp_config      *to,
-    const struct ia_css_crop_configuration *from,
-    unsigned int size);
+int ia_css_crop_config(struct sh_css_isp_crop_isp_config      *to,
+                      const struct ia_css_crop_configuration *from,
+                      unsigned int size);
 
 int ia_css_crop_configure(const struct ia_css_binary     *binary,
                          const struct ia_css_frame_info *from);
index 9933113adf46660326044c98661a8e2412bf836d..be68192c243723553bb8323188852398273155a2 100644 (file)
@@ -51,11 +51,9 @@ ia_css_fpn_dump(
                            "fpn_enabled", fpn->enabled);
 }
 
-void
-ia_css_fpn_config(
-    struct sh_css_isp_fpn_isp_config *to,
-    const struct ia_css_fpn_configuration *from,
-    unsigned int size)
+int ia_css_fpn_config(struct sh_css_isp_fpn_isp_config *to,
+                     const struct ia_css_fpn_configuration *from,
+                     unsigned int size)
 {
        unsigned int elems_a = ISP_VEC_NELEMS;
 
@@ -65,6 +63,7 @@ ia_css_fpn_config(
 
        /* Assume divisiblity here, may need to generalize to fixed point. */
        assert(elems_a % to->port_b.elems == 0);
+       return 0;
 }
 
 int ia_css_fpn_configure(const struct ia_css_binary     *binary,
index 1c644c0decfe75aa66221b59ab56fa0cb2d9cab8..bd341fa287fe8e653a2ba6b12adf52a818ecf8bb 100644 (file)
@@ -31,11 +31,9 @@ ia_css_fpn_dump(
     const struct sh_css_isp_fpn_params *fpn,
     unsigned int level);
 
-void
-ia_css_fpn_config(
-    struct sh_css_isp_fpn_isp_config      *to,
-    const struct ia_css_fpn_configuration *from,
-    unsigned int size);
+int ia_css_fpn_config(struct sh_css_isp_fpn_isp_config      *to,
+                     const struct ia_css_fpn_configuration *from,
+                     unsigned int size);
 
 int ia_css_fpn_configure(const struct ia_css_binary     *binary,
                         const struct ia_css_frame_info *from);
index ea8055148fb388ab5e589c7daba942cb6bca2f46..5e2755b455867189c074b76d2cb715ce310e541c 100644 (file)
 #include "ia_css_isp_params.h"
 #include "ia_css_frame.h"
 
-void
-ia_css_bayer_io_config(
-    const struct ia_css_binary      *binary,
-    const struct sh_css_binary_args *args)
+int ia_css_bayer_io_config(const struct ia_css_binary      *binary,
+                          const struct sh_css_binary_args *args)
 {
        const struct ia_css_frame *in_frame = args->in_frame;
        const struct ia_css_frame **out_frames = (const struct ia_css_frame **)
@@ -91,4 +89,5 @@ ia_css_bayer_io_config(
                                    "ia_css_bayer_io_config() put part leave:\n");
 #endif
        }
+       return 0;
 }
index 635ccb1b27d071b15e678bf8cd2f7690b9cacbe8..9c7e5a1ad57b7393c789555d9a58cbea4cda730e 100644 (file)
@@ -21,9 +21,7 @@
 #include "ia_css_binary.h"
 #include "sh_css_internal.h"
 
-void
-ia_css_bayer_io_config(
-    const struct ia_css_binary     *binary,
-    const struct sh_css_binary_args *args);
+int ia_css_bayer_io_config(const struct ia_css_binary     *binary,
+                          const struct sh_css_binary_args *args);
 
 #endif /*__BAYER_IO_HOST_H */
index f8bd207b28e18a8bb93983143cd13a8c7bcffe40..46fa1f7085711be271367586880c00630772ebdf 100644 (file)
@@ -22,10 +22,8 @@ more details.
 #include "ia_css_isp_params.h"
 #include "ia_css_frame.h"
 
-void
-ia_css_yuv444_io_config(
-    const struct ia_css_binary      *binary,
-    const struct sh_css_binary_args *args)
+int ia_css_yuv444_io_config(const struct ia_css_binary      *binary,
+                           const struct sh_css_binary_args *args)
 {
        const struct ia_css_frame *in_frame = args->in_frame;
        const struct ia_css_frame **out_frames = (const struct ia_css_frame **)
@@ -91,4 +89,5 @@ ia_css_yuv444_io_config(
                                    "ia_css_yuv444_io_config() put part leave:\n");
 #endif
        }
+       return 0;
 }
index e7cfd380e10810145bc1ae6afb3cbdf7489c578b..13e50590f91e108f9ef6cc66ef29320bcddaa6fd 100644 (file)
@@ -21,9 +21,7 @@ more details.
 #include "ia_css_binary.h"
 #include "sh_css_internal.h"
 
-void
-ia_css_yuv444_io_config(
-    const struct ia_css_binary     *binary,
-    const struct sh_css_binary_args *args);
+int ia_css_yuv444_io_config(const struct ia_css_binary     *binary,
+                           const struct sh_css_binary_args *args);
 
 #endif /*__YUV44_IO_HOST_H */
index cf6311ebbeab5207b8681be40422085e7f55338d..137e5b286ecff9b85eb121c55ec1c4e4c1866b5e 100644 (file)
@@ -52,11 +52,9 @@ ia_css_output_encode(
        to->enable_vflip = from->enable_vflip;
 }
 
-void
-ia_css_output_config(
-    struct sh_css_isp_output_isp_config *to,
-    const struct ia_css_output_configuration  *from,
-    unsigned int size)
+int ia_css_output_config(struct sh_css_isp_output_isp_config *to,
+                        const struct ia_css_output_configuration  *from,
+                        unsigned int size)
 {
        unsigned int elems_a = ISP_VEC_NELEMS;
 
@@ -69,26 +67,21 @@ ia_css_output_config(
 
        /* Assume divisiblity here, may need to generalize to fixed point. */
        assert(elems_a % to->port_b.elems == 0);
+       return 0;
 }
 
-void
-ia_css_output0_config(
-    struct sh_css_isp_output_isp_config       *to,
-    const struct ia_css_output0_configuration *from,
-    unsigned int size)
+int ia_css_output0_config(struct sh_css_isp_output_isp_config       *to,
+                         const struct ia_css_output0_configuration *from,
+                         unsigned int size)
 {
-       ia_css_output_config(
-           to, (const struct ia_css_output_configuration *)from, size);
+       return ia_css_output_config(to, (const struct ia_css_output_configuration *)from, size);
 }
 
-void
-ia_css_output1_config(
-    struct sh_css_isp_output_isp_config       *to,
-    const struct ia_css_output1_configuration *from,
-    unsigned int size)
+int ia_css_output1_config(struct sh_css_isp_output_isp_config       *to,
+                         const struct ia_css_output1_configuration *from,
+                         unsigned int size)
 {
-       ia_css_output_config(
-           to, (const struct ia_css_output_configuration *)from, size);
+       return ia_css_output_config(to, (const struct ia_css_output_configuration *)from, size);
 }
 
 int ia_css_output_configure(const struct ia_css_binary     *binary,
index 04c0023794cca18d288a631fa0fda914f161c675..c8523e95a3948c9d56e6424e19c752b69fdb8e27 100644 (file)
@@ -30,23 +30,17 @@ ia_css_output_encode(
     const struct ia_css_output_config *from,
     unsigned int size);
 
-void
-ia_css_output_config(
-    struct sh_css_isp_output_isp_config      *to,
-    const struct ia_css_output_configuration *from,
-    unsigned int size);
+int ia_css_output_config(struct sh_css_isp_output_isp_config      *to,
+                        const struct ia_css_output_configuration *from,
+                        unsigned int size);
 
-void
-ia_css_output0_config(
-    struct sh_css_isp_output_isp_config       *to,
-    const struct ia_css_output0_configuration *from,
-    unsigned int size);
+int ia_css_output0_config(struct sh_css_isp_output_isp_config       *to,
+                         const struct ia_css_output0_configuration *from,
+                         unsigned int size);
 
-void
-ia_css_output1_config(
-    struct sh_css_isp_output_isp_config       *to,
-    const struct ia_css_output1_configuration *from,
-    unsigned int size);
+int ia_css_output1_config(struct sh_css_isp_output_isp_config       *to,
+                         const struct ia_css_output1_configuration *from,
+                         unsigned int size);
 
 int ia_css_output_configure(const struct ia_css_binary     *binary,
                            const struct ia_css_frame_info *from);
index 7858dc5739802856bbc23a6b0343b5c7f8aa150c..38ad6e52a84866c92df0cf00cdb524788537d00d 100644 (file)
@@ -28,11 +28,9 @@ static const struct ia_css_qplane_configuration default_config = {
        .pipe = (struct sh_css_sp_pipeline *)NULL,
 };
 
-void
-ia_css_qplane_config(
-    struct sh_css_isp_qplane_isp_config *to,
-    const struct ia_css_qplane_configuration  *from,
-    unsigned int size)
+int ia_css_qplane_config(struct sh_css_isp_qplane_isp_config *to,
+                        const struct ia_css_qplane_configuration  *from,
+                        unsigned int size)
 {
        unsigned int elems_a = ISP_VEC_NELEMS;
 
@@ -45,6 +43,7 @@ ia_css_qplane_config(
 
        to->inout_port_config = from->pipe->inout_port_config;
        to->format = from->info->format;
+       return 0;
 }
 
 int ia_css_qplane_configure(const struct sh_css_sp_pipeline *pipe,
index c4b863dc149872e9470e5ccf14ef4ae19739a6c0..b3f8fa30c8cea711129bd827457f4a2646d5eec8 100644 (file)
 #include "ia_css_qplane_types.h"
 #include "ia_css_qplane_param.h"
 
-void
-ia_css_qplane_config(
-    struct sh_css_isp_qplane_isp_config      *to,
-    const struct ia_css_qplane_configuration *from,
-    unsigned int size);
+int ia_css_qplane_config(struct sh_css_isp_qplane_isp_config      *to,
+                        const struct ia_css_qplane_configuration *from,
+                        unsigned int size);
 
 int ia_css_qplane_configure(const struct sh_css_sp_pipeline *pipe,
                            const struct ia_css_binary      *binary,
index b35d81ad1a385f0ac5b3e91a74aec6e00c82023d..aba0409a4a0d5a467a0c7be4a59e411e6499673c 100644 (file)
@@ -64,11 +64,9 @@ css2isp_stream_format(enum atomisp_input_format from) {
        }
 }
 
-void
-ia_css_raw_config(
-    struct sh_css_isp_raw_isp_config *to,
-    const struct ia_css_raw_configuration  *from,
-    unsigned int size)
+int ia_css_raw_config(struct sh_css_isp_raw_isp_config *to,
+                     const struct ia_css_raw_configuration  *from,
+                     unsigned int size)
 {
        unsigned int elems_a = ISP_VEC_NELEMS;
        const struct ia_css_frame_info *in_info = from->in_info;
@@ -104,6 +102,8 @@ ia_css_raw_config(
        to->start_line          = in_info->crop_info.start_line;
        to->enable_left_padding = from->enable_left_padding;
 #endif
+
+       return 0;
 }
 
 int ia_css_raw_configure(const struct sh_css_sp_pipeline *pipe,
index 33374ac9db99c202207e142644fa39e2b467b603..23da51aabc8db0b58b9792d0b4af131262006de4 100644 (file)
 #include "ia_css_raw_types.h"
 #include "ia_css_raw_param.h"
 
-void
-ia_css_raw_config(
-    struct sh_css_isp_raw_isp_config      *to,
-    const struct ia_css_raw_configuration *from,
-    unsigned int size);
+int ia_css_raw_config(struct sh_css_isp_raw_isp_config      *to,
+                     const struct ia_css_raw_configuration *from,
+                     unsigned int size);
 
 int ia_css_raw_configure(const struct sh_css_sp_pipeline *pipe,
                         const struct ia_css_binary     *binary,
index f5b0e333d55428112c79970994d33309cb59d499..663dbb7c39eb116d20fe312106b0450fa0529a1f 100644 (file)
 #include "isp.h"
 #include "ia_css_ref.host.h"
 
-void
-ia_css_ref_config(
-    struct sh_css_isp_ref_isp_config *to,
-    const struct ia_css_ref_configuration  *from,
-    unsigned int size)
+int ia_css_ref_config(struct sh_css_isp_ref_isp_config *to,
+                     const struct ia_css_ref_configuration  *from,
+                     unsigned int size)
 {
        unsigned int elems_a = ISP_VEC_NELEMS, i;
 
@@ -53,6 +51,7 @@ ia_css_ref_config(
 
        /* Assume divisiblity here, may need to generalize to fixed point. */
        assert(elems_a % to->port_b.elems == 0);
+       return 0;
 }
 
 int ia_css_ref_configure(const struct ia_css_binary        *binary,
index c407d471c7a0eb21c6c0fc34f16846b4d4267db8..388cd4c367bae0c54f12196736282c3a305348a8 100644 (file)
 #include "ia_css_ref_param.h"
 #include "ia_css_ref_state.h"
 
-void
-ia_css_ref_config(
-    struct sh_css_isp_ref_isp_config      *to,
-    const struct ia_css_ref_configuration *from,
-    unsigned int size);
+int ia_css_ref_config(struct sh_css_isp_ref_isp_config      *to,
+                     const struct ia_css_ref_configuration *from,
+                     unsigned int size);
 
 int ia_css_ref_configure(const struct ia_css_binary        *binary,
                         const struct ia_css_frame * const *ref_frames,
index 170bd70b6e245825398ceaefb374219025ce7c3e..3a5bea219c484d21645f08af4e414e4de4953307 100644 (file)
@@ -71,11 +71,9 @@ ia_css_tnr_debug_dtrace(
                            config->threshold_y, config->threshold_uv);
 }
 
-void
-ia_css_tnr_config(
-    struct sh_css_isp_tnr_isp_config *to,
-    const struct ia_css_tnr_configuration *from,
-    unsigned int size)
+int ia_css_tnr_config(struct sh_css_isp_tnr_isp_config *to,
+                     const struct ia_css_tnr_configuration *from,
+                     unsigned int size)
 {
        unsigned int elems_a = ISP_VEC_NELEMS;
        unsigned int i;
@@ -91,6 +89,7 @@ ia_css_tnr_config(
 
        /* Assume divisiblity here, may need to generalize to fixed point. */
        assert(elems_a % to->port_b.elems == 0);
+       return 0;
 }
 
 int ia_css_tnr_configure(const struct ia_css_binary     *binary,
index 1c421c6a851290fc555b17b5c23120521e280611..acf92052b44202dd80fb2f433dc69342371d71f7 100644 (file)
@@ -39,11 +39,9 @@ ia_css_tnr_debug_dtrace(
     const struct ia_css_tnr_config *config,
     unsigned int level);
 
-void
-ia_css_tnr_config(
-    struct sh_css_isp_tnr_isp_config      *to,
-    const struct ia_css_tnr_configuration *from,
-    unsigned int size);
+int ia_css_tnr_config(struct sh_css_isp_tnr_isp_config      *to,
+                     const struct ia_css_tnr_configuration *from,
+                     unsigned int size);
 
 int ia_css_tnr_configure(const struct ia_css_binary        *binary,
                         const struct ia_css_frame * const *frames);
index a0926d05f1e1a00bf473b4b6ce2b7dc36c2eaa5a..1ace34f59f8d90b5c5b58401255e3ad29cb5ab82 100644 (file)
 
 #include "isp.h"
 
-void
-ia_css_vf_config(
-    struct sh_css_isp_vf_isp_config      *to,
-    const struct ia_css_vf_configuration *from,
-    unsigned int size)
+int ia_css_vf_config(struct sh_css_isp_vf_isp_config      *to,
+                   const struct ia_css_vf_configuration *from,
+                   unsigned int size)
 {
        unsigned int elems_a = ISP_VEC_NELEMS;
 
@@ -46,6 +44,7 @@ ia_css_vf_config(
                /* Assume divisiblity here, may need to generalize to fixed point. */
                assert(elems_a % to->dma.port_b.elems == 0);
        }
+       return 0;
 }
 
 /* compute the log2 of the downscale factor needed to get closest
index 0e8de034a00e433b52537762edf7578379c55941..d6b45d3754b0cbf975e0f0e944fcf896b165d4df 100644 (file)
@@ -32,11 +32,9 @@ sh_css_vf_downscale_log2(
     const struct ia_css_frame_info *vf_info,
     unsigned int *downscale_log2);
 
-void
-ia_css_vf_config(
-    struct sh_css_isp_vf_isp_config *to,
-    const struct ia_css_vf_configuration *from,
-    unsigned int size);
+int ia_css_vf_config(struct sh_css_isp_vf_isp_config *to,
+                    const struct ia_css_vf_configuration *from,
+                    unsigned int size);
 
 int
 ia_css_vf_configure(
index 31f01e0f58aaf13ca12942099c01b3ab9d29c4f5..51ec7073d86040db34518aaae1e9483e3df3e608 100644 (file)
@@ -138,9 +138,8 @@ bool ia_css_frame_is_same_type(
  * @param[in]  info           The frame info
  * @return
  */
-void ia_css_dma_configure_from_info(
-    struct dma_port_config *config,
-    const struct ia_css_frame_info *info);
+int ia_css_dma_configure_from_info(struct dma_port_config *config,
+                                  const struct ia_css_frame_info *info);
 
 /* ISP2401 */
 /* @brief Finds the cropping resolution
index 10c4907187d9835a879fc2040b68804a2f4a980e..647383e10f5e604f59ee0b47113699cfeb171cf3 100644 (file)
@@ -594,10 +594,8 @@ bool ia_css_frame_is_same_type(const struct ia_css_frame *frame_a,
        return is_equal;
 }
 
-void
-ia_css_dma_configure_from_info(
-    struct dma_port_config *config,
-    const struct ia_css_frame_info *info)
+int ia_css_dma_configure_from_info(struct dma_port_config *config,
+                                  const struct ia_css_frame_info *info)
 {
        unsigned int is_raw_packed = info->format == IA_CSS_FRAME_FORMAT_RAW_PACKED;
        unsigned int bits_per_pixel = is_raw_packed ? info->raw_bit_depth :
@@ -611,6 +609,7 @@ ia_css_dma_configure_from_info(
        config->width  = (uint16_t)info->res.width;
        config->crop   = 0;
        assert(config->width <= info->padded_width);
+       return 0;
 }
 
 /**************************************************************************
index f36f44b5e5b2f373dfe4860cc654f29c0d705f88..77ac720017a2ff1fa0af903c2c20412c64de8228 100644 (file)
@@ -870,8 +870,7 @@ static int configure_isp_from_args(const struct sh_css_sp_pipeline *pipeline,
        ret = ia_css_tnr_configure(binary, args->tnr_frames);
        if (ret)
                return ret;
-       ia_css_bayer_io_config(binary, args);
-       return 0;
+       return ia_css_bayer_io_config(binary, args);
 }
 
 static void