From b74196e7980b9777090f65cac9604f435a142636 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Wed, 15 Jun 2022 21:50:36 +0100 Subject: [PATCH] media: atomisp: remove force argument from __destroy_[stream[s]|pipe[s]]() The force argument to the __destroy_pipe[s]() and __destroy_stream[s]() functions is always true. Remove the argument and remove the code necessary to handle the false case. Link: https://lore.kernel.org/linux-media/20220615205037.16549-40-hdegoede@redhat.com Reviewed-by: Andy Shevchenko Signed-off-by: Hans de Goede Signed-off-by: Mauro Carvalho Chehab --- .../media/atomisp/pci/atomisp_compat_css20.c | 34 +++++++--------------- 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c index cc8bc3f..5aa108a 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c +++ b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c @@ -418,24 +418,14 @@ static void __dump_stream_config(struct atomisp_sub_device *asd, } static int __destroy_stream(struct atomisp_sub_device *asd, - struct atomisp_stream_env *stream_env, bool force) + struct atomisp_stream_env *stream_env) { struct atomisp_device *isp = asd->isp; - int i; unsigned long timeout; if (!stream_env->stream) return 0; - if (!force) { - for (i = 0; i < IA_CSS_PIPE_ID_NUM; i++) - if (stream_env->update_pipe[i]) - break; - - if (i == IA_CSS_PIPE_ID_NUM) - return 0; - } - if (stream_env->stream_state == CSS_STREAM_STARTED && ia_css_stream_stop(stream_env->stream) != 0) { dev_err(isp->dev, "stop stream failed.\n"); @@ -469,12 +459,12 @@ static int __destroy_stream(struct atomisp_sub_device *asd, return 0; } -static int __destroy_streams(struct atomisp_sub_device *asd, bool force) +static int __destroy_streams(struct atomisp_sub_device *asd) { int ret, i; for (i = 0; i < ATOMISP_INPUT_STREAM_NUM; i++) { - ret = __destroy_stream(asd, &asd->stream_env[i], force); + ret = __destroy_stream(asd, &asd->stream_env[i]); if (ret) return ret; } @@ -529,21 +519,19 @@ static int __create_streams(struct atomisp_sub_device *asd) return 0; rollback: for (i--; i >= 0; i--) - __destroy_stream(asd, &asd->stream_env[i], true); + __destroy_stream(asd, &asd->stream_env[i]); return ret; } static int __destroy_stream_pipes(struct atomisp_sub_device *asd, - struct atomisp_stream_env *stream_env, - bool force) + struct atomisp_stream_env *stream_env) { struct atomisp_device *isp = asd->isp; int ret = 0; int i; for (i = 0; i < IA_CSS_PIPE_ID_NUM; i++) { - if (!stream_env->pipes[i] || - !(force || stream_env->update_pipe[i])) + if (!stream_env->pipes[i]) continue; if (ia_css_pipe_destroy(stream_env->pipes[i]) != 0) { @@ -557,7 +545,7 @@ static int __destroy_stream_pipes(struct atomisp_sub_device *asd, return ret; } -static int __destroy_pipes(struct atomisp_sub_device *asd, bool force) +static int __destroy_pipes(struct atomisp_sub_device *asd) { struct atomisp_device *isp = asd->isp; int i; @@ -571,7 +559,7 @@ static int __destroy_pipes(struct atomisp_sub_device *asd, bool force) continue; } - ret = __destroy_stream_pipes(asd, &asd->stream_env[i], force); + ret = __destroy_stream_pipes(asd, &asd->stream_env[i]); if (ret) return ret; } @@ -581,10 +569,10 @@ static int __destroy_pipes(struct atomisp_sub_device *asd, bool force) void atomisp_destroy_pipes_stream_force(struct atomisp_sub_device *asd) { - if (__destroy_streams(asd, true)) + if (__destroy_streams(asd)) dev_warn(asd->isp->dev, "destroy stream failed.\n"); - if (__destroy_pipes(asd, true)) + if (__destroy_pipes(asd)) dev_warn(asd->isp->dev, "destroy pipe failed.\n"); } @@ -801,7 +789,7 @@ int atomisp_create_pipes_stream(struct atomisp_sub_device *asd) ret = __create_streams(asd); if (ret) { dev_warn(asd->isp->dev, "create stream failed %d.\n", ret); - __destroy_pipes(asd, true); + __destroy_pipes(asd); return ret; } -- 2.7.4