media: atomisp: sh_css: Removed #ifdef ISP2401 to make code generic
authorKate Hsuan <hpa@redhat.com>
Wed, 2 Aug 2023 09:56:04 +0000 (11:56 +0200)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Wed, 27 Sep 2023 07:40:04 +0000 (09:40 +0200)
Removed #ifdef ISP2401 to allow the destroy function can destroy the
data of both types of ISP.

Link: https://lore.kernel.org/r/20230802095606.1298152-11-hpa@redhat.com
Signed-off-by: Kate Hsuan <hpa@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/staging/media/atomisp/pci/sh_css.c

index 94cb48fa59a2f907045e0e4c5112292c352849ed..28f5184635887404d438910eadf0601c94e74a1d 100644 (file)
@@ -8450,46 +8450,48 @@ ia_css_stream_destroy(struct ia_css_stream *stream)
 
        if ((stream->last_pipe) &&
            ia_css_pipeline_is_mapped(stream->last_pipe->pipe_num)) {
-#if defined(ISP2401)
-               for (i = 0; i < stream->num_pipes; i++) {
-                       struct ia_css_pipe *entry = stream->pipes[i];
-                       unsigned int sp_thread_id;
-                       struct sh_css_sp_pipeline_terminal *sp_pipeline_input_terminal;
-
-                       assert(entry);
-                       if (entry) {
-                               /* get the SP thread id */
-                               if (!ia_css_pipeline_get_sp_thread_id(
-                                       ia_css_pipe_get_pipe_num(entry), &sp_thread_id))
-                                       return -EINVAL;
-                               /* get the target input terminal */
-                               sp_pipeline_input_terminal =
-                               &sh_css_sp_group.pipe_io[sp_thread_id].input;
-
-                               for (i = 0; i < IA_CSS_STREAM_MAX_ISYS_STREAM_PER_CH; i++) {
-                                       ia_css_isys_stream_h isys_stream =
-                                       &sp_pipeline_input_terminal->context.virtual_input_system_stream[i];
-                                       if (stream->config.isys_config[i].valid && isys_stream->valid)
-                                               ia_css_isys_stream_destroy(isys_stream);
-                               }
-                       }
-               }
-               if (stream->config.mode == IA_CSS_INPUT_MODE_BUFFERED_SENSOR) {
+               if (IS_ISP2401) {
                        for (i = 0; i < stream->num_pipes; i++) {
                                struct ia_css_pipe *entry = stream->pipes[i];
-                               /*
-                                * free any mipi frames that are remaining:
-                                * some test stream create-destroy cycles do
-                                * not generate output frames
-                                * and the mipi buffer is not freed in the
-                                * deque function
-                                */
-                               if (entry)
-                                       free_mipi_frames(entry);
+                               unsigned int sp_thread_id;
+                               struct sh_css_sp_pipeline_terminal *sp_pipeline_input_terminal;
+
+                               assert(entry);
+                               if (entry) {
+                                       /* get the SP thread id */
+                                       if (!ia_css_pipeline_get_sp_thread_id(
+                                                       ia_css_pipe_get_pipe_num(entry), &sp_thread_id))
+                                               return -EINVAL;
+
+                                       /* get the target input terminal */
+                                       sp_pipeline_input_terminal =
+                                               &sh_css_sp_group.pipe_io[sp_thread_id].input;
+
+                                       for (i = 0; i < IA_CSS_STREAM_MAX_ISYS_STREAM_PER_CH; i++) {
+                                               ia_css_isys_stream_h isys_stream =
+                                                       &sp_pipeline_input_terminal->context.virtual_input_system_stream[i];
+                                               if (stream->config.isys_config[i].valid && isys_stream->valid)
+                                                       ia_css_isys_stream_destroy(isys_stream);
+                                       }
+                               }
                        }
+
+                       if (stream->config.mode == IA_CSS_INPUT_MODE_BUFFERED_SENSOR) {
+                               for (i = 0; i < stream->num_pipes; i++) {
+                                       struct ia_css_pipe *entry = stream->pipes[i];
+                                       /*
+                                        * free any mipi frames that are remaining:
+                                        * some test stream create-destroy cycles do
+                                        * not generate output frames
+                                        * and the mipi buffer is not freed in the
+                                        * deque function
+                                        */
+                                       if (entry)
+                                               free_mipi_frames(entry);
+                               }
+                       }
+                       stream_unregister_with_csi_rx(stream);
                }
-               stream_unregister_with_csi_rx(stream);
-#endif
 
                for (i = 0; i < stream->num_pipes; i++) {
                        struct ia_css_pipe *curr_pipe = stream->pipes[i];