Commit b74196e7 authored by Hans de Goede's avatar Hans de Goede Committed by Mauro Carvalho Chehab

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.comReviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent 1341bc9e
...@@ -418,24 +418,14 @@ static void __dump_stream_config(struct atomisp_sub_device *asd, ...@@ -418,24 +418,14 @@ static void __dump_stream_config(struct atomisp_sub_device *asd,
} }
static int __destroy_stream(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; struct atomisp_device *isp = asd->isp;
int i;
unsigned long timeout; unsigned long timeout;
if (!stream_env->stream) if (!stream_env->stream)
return 0; 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 if (stream_env->stream_state == CSS_STREAM_STARTED
&& ia_css_stream_stop(stream_env->stream) != 0) { && ia_css_stream_stop(stream_env->stream) != 0) {
dev_err(isp->dev, "stop stream failed.\n"); dev_err(isp->dev, "stop stream failed.\n");
...@@ -469,12 +459,12 @@ static int __destroy_stream(struct atomisp_sub_device *asd, ...@@ -469,12 +459,12 @@ static int __destroy_stream(struct atomisp_sub_device *asd,
return 0; 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; int ret, i;
for (i = 0; i < ATOMISP_INPUT_STREAM_NUM; 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) if (ret)
return ret; return ret;
} }
...@@ -529,21 +519,19 @@ static int __create_streams(struct atomisp_sub_device *asd) ...@@ -529,21 +519,19 @@ static int __create_streams(struct atomisp_sub_device *asd)
return 0; return 0;
rollback: rollback:
for (i--; i >= 0; i--) for (i--; i >= 0; i--)
__destroy_stream(asd, &asd->stream_env[i], true); __destroy_stream(asd, &asd->stream_env[i]);
return ret; return ret;
} }
static int __destroy_stream_pipes(struct atomisp_sub_device *asd, static int __destroy_stream_pipes(struct atomisp_sub_device *asd,
struct atomisp_stream_env *stream_env, struct atomisp_stream_env *stream_env)
bool force)
{ {
struct atomisp_device *isp = asd->isp; struct atomisp_device *isp = asd->isp;
int ret = 0; int ret = 0;
int i; int i;
for (i = 0; i < IA_CSS_PIPE_ID_NUM; i++) { for (i = 0; i < IA_CSS_PIPE_ID_NUM; i++) {
if (!stream_env->pipes[i] || if (!stream_env->pipes[i])
!(force || stream_env->update_pipe[i]))
continue; continue;
if (ia_css_pipe_destroy(stream_env->pipes[i]) if (ia_css_pipe_destroy(stream_env->pipes[i])
!= 0) { != 0) {
...@@ -557,7 +545,7 @@ static int __destroy_stream_pipes(struct atomisp_sub_device *asd, ...@@ -557,7 +545,7 @@ static int __destroy_stream_pipes(struct atomisp_sub_device *asd,
return ret; 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; struct atomisp_device *isp = asd->isp;
int i; int i;
...@@ -571,7 +559,7 @@ static int __destroy_pipes(struct atomisp_sub_device *asd, bool force) ...@@ -571,7 +559,7 @@ static int __destroy_pipes(struct atomisp_sub_device *asd, bool force)
continue; continue;
} }
ret = __destroy_stream_pipes(asd, &asd->stream_env[i], force); ret = __destroy_stream_pipes(asd, &asd->stream_env[i]);
if (ret) if (ret)
return ret; return ret;
} }
...@@ -581,10 +569,10 @@ static int __destroy_pipes(struct atomisp_sub_device *asd, bool force) ...@@ -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) 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"); 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"); dev_warn(asd->isp->dev, "destroy pipe failed.\n");
} }
...@@ -801,7 +789,7 @@ int atomisp_create_pipes_stream(struct atomisp_sub_device *asd) ...@@ -801,7 +789,7 @@ int atomisp_create_pipes_stream(struct atomisp_sub_device *asd)
ret = __create_streams(asd); ret = __create_streams(asd);
if (ret) { if (ret) {
dev_warn(asd->isp->dev, "create stream failed %d.\n", ret); dev_warn(asd->isp->dev, "create stream failed %d.\n", ret);
__destroy_pipes(asd, true); __destroy_pipes(asd);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment